House keeping (05-04-2023) - #131
Conversation
|
@orama254 is attempting to deploy a commit to a Personal Account owned by @reactdeveloperske on Vercel. @reactdeveloperske first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
@orama254 The tests seem to be failing because they do not have access to the environment variables. I usually prefer creating a .env file in CI similar to how we have it locally. Here is how I would suggest the e2e.yml workflow to be written instead to include the additional step to Prepare .env file (the top-level env: key-value pair can be removed):
name: End-to-end Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
e2e:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare .env file
run: |
rm -f .env && touch .env
echo "NEXT_PUBLIC_FORMSPREE_ID=${{ secrets.NEXT_PUBLIC_FORMSPREE_ID }}" >> .env
echo "NEXT_PUBLIC_RECAPTCHA_SITE_KEY=${{ secrets.NEXT_PUBLIC_RECAPTCHA_SITE_KEY }}" >> .env
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 5Another thing I have noticed is that we have the word "Events" appearing severally on the page and this will cause one of the tests to be ambiguous and fail. This test in home.spec.ts should be adjusted to be an exact match by adding exact: true:
test('should show Events section', async ({ page }) => {
await expect(
page.getByRole('heading', { name: 'Events', exact: true })
).toBeVisible();
});
antosan
left a comment
There was a problem hiding this comment.
@orama254 The trace file still shows this error You must provide a form key or hashid (e.g. useForm("myForm") or useForm("123xyz") which means that the value of secrets.NEXT_PUBLIC_FORMSPREE_ID and secrets.NEXT_PUBLIC_RECAPTCHA_SITE_KEY are undefined. Since the values do not necessarily need to be the exact keys, can you try using fake values hardcoded in the workflow file instead, like this:
- name: Prepare .env file
run: |
rm -f .env && touch .env
echo "NEXT_PUBLIC_FORMSPREE_ID=fake" >> .env
echo "NEXT_PUBLIC_RECAPTCHA_SITE_KEY=fake" >> .env
@antosan Very nice, the tests are passing. on the requested changes above, I'm getting an error with typescript that these are the expected parameters for that:
|
Changes proposed
Fixes the remaining parts of #118 plus also adds additional information to the contribution guidelines.
Also added some updated workflow for end to end playwright tests