WS-2281 Migrate a Few Homepage E2E Tests from Cypress to Playwright and Integrate with CI#13670
Conversation
…right-sample-tests
…right-sample-tests
…right-sample-tests
…right-sample-tests
…right-sample-tests
…right-sample-tests
f0b411a to
3a08945
Compare
510d0f8 to
100939e
Compare
100939e to
c1e217f
Compare
5050a62 to
d7e7319
Compare
…right-sample-tests
…right-sample-tests
…right-sample-tests
…right-sample-tests
…right-sample-tests
| // these rules seem to be used as the common pattern for looping elemnts in playwright | ||
| "no-restricted-syntax": ["off", "ForOfStatement"], | ||
| "no-await-in-loop": "off", | ||
| }, |
There was a problem hiding this comment.
This .eslintrc file is likely to fail parsing: it’s extensionless (YAML/JSON legacy format), but it contains // comments and trailing commas (e.g. after "no-await-in-loop": "off"). Consider switching to a .eslintrc.js (or valid YAML/JSON without trailing commas) and set the rule values using ESLint’s expected shapes (e.g. no-restricted-syntax: "off").
| // these rules seem to be used as the common pattern for looping elemnts in playwright | |
| "no-restricted-syntax": ["off", "ForOfStatement"], | |
| "no-await-in-loop": "off", | |
| }, | |
| "no-restricted-syntax": "off", | |
| "no-await-in-loop": "off" | |
| } |
| base.beforeAll(async ({ page }) => { | ||
| for (const fn of beforeAll) fn(); | ||
| await page.goto(path, { waitUntil: 'domcontentloaded' }); | ||
| }); | ||
|
|
||
| base.beforeEach(async () => { | ||
| for (const fn of beforeEachFns) fn(); | ||
| // Add any Playwright-specific setup here | ||
| }); |
There was a problem hiding this comment.
The beforeAll / beforeEachFns hooks are invoked without await, and they’re typed as synchronous () => void. If any of these setup functions need to be async (common for Playwright), the current implementation will race. Consider allowing () => void | Promise<void> and awaiting each function inside the Playwright hooks.
|
@alex-magana , @andrewscfc I am ignoring the copilot comments about |
…right-sample-tests
…right-sample-tests
remove unused helper for now, and add command to package
…right-sample-tests
…right-sample-tests
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 24 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
.github/workflows/simorgh-unit-tests.yml:48
- This workflow now relies on repo secrets (
WS_UTF_*) duringpull_requestruns. For PRs from forks, GitHub Actions does not provide secrets, soyarn installwill fail when it tries to fetch the private GitHub dependency. Consider gating the job (or at least the secret-dependent install snippet) to same-repo PRs, similar to how other steps already checkgithub.event.pull_request.head.repo.full_name.
- name: Install Node Modules
if: steps.cache.outputs.cache-hit != 'true'
run: |
rm -rf node_modules
git config --global user.name "${{ secrets.WS_UTF_USERNAME }}"
git config --global user.email "${{ secrets.WS_UTF_EMAIL }}"
git config --global url.https://${{ secrets.WS_UTF_AUTH }}@github.com/.insteadOf https://github.com/
./scripts/installNodeModules.sh
- name: Build Simorgh - Express App
run: yarn build
- name: Build Simorgh - Next.JS App
working-directory: ./ws-nextjs-app
| - name: Install Node Modules | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| run: ./scripts/installNodeModules.sh | ||
| run: | | ||
| rm -rf node_modules | ||
| git config --global user.name "${{ secrets.WS_UTF_USERNAME }}" | ||
| git config --global user.email "${{ secrets.WS_UTF_EMAIL }}" | ||
| git config --global url.https://${{ secrets.WS_UTF_AUTH }}@github.com/.insteadOf https://github.com/ | ||
| ./scripts/installNodeModules.sh |
There was a problem hiding this comment.
This workflow now relies on repo secrets (WS_UTF_*) during pull_request runs. For PRs from forks, GitHub Actions does not provide secrets, so yarn install will fail when it tries to fetch the private GitHub dependency. Consider gating the job (or the secret-dependent install snippet) to same-repo PRs to avoid failing forked PRs unexpectedly.
| - name: Install Node Modules | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| run: ./scripts/installNodeModules.sh | ||
| run: | | ||
| rm -rf node_modules | ||
| git config --global user.name "${{ secrets.WS_UTF_USERNAME }}" | ||
| git config --global user.email "${{ secrets.WS_UTF_EMAIL }}" | ||
| git config --global url.https://${{ secrets.WS_UTF_AUTH }}@github.com/.insteadOf https://github.com/ | ||
| ./scripts/installNodeModules.sh |
There was a problem hiding this comment.
This workflow now relies on repo secrets (WS_UTF_*) during pull_request runs. For PRs from forks, GitHub Actions does not provide secrets, so yarn install will fail when it tries to fetch the private GitHub dependency. Consider gating the job (or the secret-dependent install snippet) to same-repo PRs to avoid failing forked PRs unexpectedly.
| - name: Install Node Modules | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| run: ./scripts/installNodeModules.sh | ||
| run: | | ||
| rm -rf node_modules | ||
| git config --global user.name "${{ secrets.WS_UTF_USERNAME }}" | ||
| git config --global user.email "${{ secrets.WS_UTF_EMAIL }}" | ||
| git config --global url.https://${{ secrets.WS_UTF_AUTH }}@github.com/.insteadOf https://github.com/ | ||
| ./scripts/installNodeModules.sh |
There was a problem hiding this comment.
This workflow now relies on repo secrets (WS_UTF_*) during pull_request runs. For PRs from forks, GitHub Actions does not provide secrets, so yarn install will fail when it tries to fetch the private GitHub dependency. Consider gating the job (or the secret-dependent install snippet) to same-repo PRs to avoid failing forked PRs unexpectedly.
There was a problem hiding this comment.
This comment is valid, it should probably have a broader tech ticket around actions to run for open source forks
| - name: Install Node Modules | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| run: ./scripts/installNodeModules.sh | ||
| run: | | ||
| rm -rf node_modules | ||
| git config --global user.name "${{ secrets.WS_UTF_USERNAME }}" | ||
| git config --global user.email "${{ secrets.WS_UTF_EMAIL }}" | ||
| git config --global url.https://${{ secrets.WS_UTF_AUTH }}@github.com/.insteadOf https://github.com/ | ||
| ./scripts/installNodeModules.sh |
There was a problem hiding this comment.
This comment is valid, it should probably have a broader tech ticket around actions to run for open source forks
Resolves JIRA: WS-2015
Summary
Code changes
I got into several issues in this upgrade since this project uses yarn, unlike other internal projects that use npm, evenutally - after a LOT of failed attempts - I had to:
Testing
Useful Links