Skip to content

WS-2281 Migrate a Few Homepage E2E Tests from Cypress to Playwright and Integrate with CI#13670

Merged
MeriemMechri merged 60 commits into
latestfrom
ws-playwright-sample-tests
Apr 15, 2026
Merged

WS-2281 Migrate a Few Homepage E2E Tests from Cypress to Playwright and Integrate with CI#13670
MeriemMechri merged 60 commits into
latestfrom
ws-playwright-sample-tests

Conversation

@MeriemMechri

@MeriemMechri MeriemMechri commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Resolves JIRA: WS-2015

Summary

  • Add Playwright + unified E2E framework dependencies and initial Home Page Playwright spec/helpers.
  • Introduce a dedicated Playwright GitHub Actions workflow and adjust existing workflows’ install step to authenticate GitHub dependency fetches.
  • Bump Yarn version/config and update Jest/TS configs to avoid picking up Playwright files in unit test runs.

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:

  • I had to bump yarn version from 4.0.9 to 4.13.0 because of this error - the fix for it is to upgrade to >=4.12
  • To be able to run yarn on CI for a private repo, I did this solution .. I tried setting up npmAuth for yarn but didn't work.

Testing

  1. List the steps required to test this PR.

Useful Links

@MeriemMechri MeriemMechri force-pushed the ws-playwright-sample-tests branch 2 times, most recently from f0b411a to 3a08945 Compare March 24, 2026 11:55
@MeriemMechri MeriemMechri force-pushed the ws-playwright-sample-tests branch 3 times, most recently from 510d0f8 to 100939e Compare March 24, 2026 14:37
@MeriemMechri MeriemMechri force-pushed the ws-playwright-sample-tests branch from 100939e to c1e217f Compare March 24, 2026 14:47
@MeriemMechri MeriemMechri force-pushed the ws-playwright-sample-tests branch 7 times, most recently from 5050a62 to d7e7319 Compare March 24, 2026 15:19
Comment thread .github/workflows/simorgh-misc-checks.yml Outdated
Comment thread ws-nextjs-app/playwright/specs/homePage.spec.ts Outdated
Comment thread ws-nextjs-app/playwright.config.ts
Comment thread ws-nextjs-app/playwright/support/helpers/runUrlValidationTest.ts Outdated
Comment thread ws-nextjs-app/playwright/specs/homePage.spec.ts Outdated
Comment thread ws-nextjs-app/playwright/support/runTestForPage.playwright.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 25 changed files in this pull request and generated 12 comments.

Comment thread ws-nextjs-app/playwright/.eslintrc Outdated
Comment on lines +3 to +6
// 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",
},

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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").

Suggested change
// 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"
}

Copilot uses AI. Check for mistakes.
Comment thread ws-nextjs-app/playwright/.eslintrc Outdated
Comment thread ws-nextjs-app/playwright/support/runTestForPage.playwright.ts Outdated
Comment on lines +52 to +60
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
});

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread ws-nextjs-app/playwright/support/runTestForPage.playwright.ts Outdated
Comment thread .github/workflows/simorgh-local-server-tests.yml Outdated
Comment thread .github/workflows/simorgh-integration-tests.yml Outdated
Comment thread .github/workflows/simorgh-e2e-playwright.yml Outdated
Comment thread .github/workflows/simorgh-e2e-playwright.yml
Comment thread ws-nextjs-app/playwright/README.md Outdated
@MeriemMechri

MeriemMechri commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

@alex-magana , @andrewscfc I am ignoring the copilot comments about runTestsForPage - this file is based on the Cypress helpers we had to make the migration from Cypress to PlayWright easier, and is likely going to change a lot once the actual migration starts. The scope of this PR was mainly to get PlayWright and the unified testing framework running locally and on CI.

Comment thread package.json

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_*) 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 at least the secret-dependent install snippet) to same-repo PRs, similar to how other steps already check github.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

Comment thread ws-nextjs-app/playwright/README.md Outdated
Comment thread ws-nextjs-app/playwright/specs/homePage.spec.ts Outdated
Comment on lines 41 to +48
- 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

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 36 to +43
- 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

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 36 to +43
- 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

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is valid, it should probably have a broader tech ticket around actions to run for open source forks

Comment thread ws-nextjs-app/package.json Outdated
Comment on lines 36 to +43
- 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is valid, it should probably have a broader tech ticket around actions to run for open source forks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants