Skip to content

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

Open
MeriemMechri wants to merge 60 commits intolatestfrom
ws-playwright-sample-tests
Open

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

Conversation

@MeriemMechri
Copy link
Copy Markdown
Contributor

@MeriemMechri MeriemMechri commented Feb 2, 2026

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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates the Next.js Home Page E2E coverage from Cypress patterns toward Playwright using the BBC unified web E2E framework, alongside Yarn/CI adjustments to support installing a private GitHub dependency in CI.

Changes:

  • 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.

Reviewed changes

Copilot reviewed 15 out of 37 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
yarn.lock Adds Playwright + unified E2E framework (and related transitive deps) to the lockfile.
ws-nextjs-app/package.json Adds @playwright/test and @bbc/unified-web-e2e-framework to the Next.js app.
ws-nextjs-app/playwright.config.ts Wires unified framework config to point at playwright/specs.
ws-nextjs-app/playwright/specs/homePage.spec.ts Adds initial Playwright Home Page smoke spec.
ws-nextjs-app/playwright/support/helpers/runUrlValidationTest.ts Adds a Playwright URL validation helper mirroring existing Cypress coverage.
ws-nextjs-app/playwright/support/runtTestForPage.playwright.ts Adds a Playwright analogue of the Cypress runTestsForPage harness.
ws-nextjs-app/playwright/README.md Adds minimal Playwright run instructions.
ws-nextjs-app/playwright/.eslintrc Adds Playwright-folder ESLint overrides.
ws-nextjs-app/jest.config.ts Ignores the playwright directory for Jest runs in ws-nextjs-app.
tsconfig.json Excludes ws-nextjs-app Playwright TS files from the root TS project.
package.json Updates unit-test scripts’ ignore patterns and bumps Yarn packageManager version.
.yarnrc.yml Updates Yarn config formatting and yarnPath to Yarn 4.13.0.
.gitignore Adds an ignore entry intended for Playwright report assets.
.github/workflows/simorgh-unit-tests.yml Updates install step to support private GitHub dependency fetch.
.github/workflows/simorgh-misc-checks.yml Updates install step to support private GitHub dependency fetch.
.github/workflows/simorgh-local-server-tests.yml Updates install step to support private GitHub dependency fetch.
.github/workflows/simorgh-integration-tests.yml Updates install step to support private GitHub dependency fetch.
.github/workflows/simorgh-e2e-playwright.yml Adds a dedicated Playwright workflow to run E2E checks and upload reports.
.yarn/cache/fsevents-patch-6b67494872-10.zip Adds Yarn offline cache artifact for fsevents patch.
.yarn/cache/fsevents-patch-19706e7e35-10.zip Adds Yarn offline cache artifact for fsevents patch (variant).
.yarn/cache/fsevents-npm-2.3.2-a881d6ac9f-6b5b6f5692.zip Adds Yarn offline cache artifact for fsevents 2.3.2.
.yarn/cache/@playwright-test-npm-1.59.1-8a59644a90-27a894c4d4.zip Adds Yarn offline cache artifact for @playwright/test.
.yarn/cache/@unrs-resolver-binding-linux-x64-gnu-npm-1.11.0-f4a171e974-10.zip Adds Yarn offline cache artifact (platform binding).
.yarn/cache/@img-sharp-linux-x64-npm-0.34.5-06b002e5f6-10.zip Adds Yarn offline cache artifact (sharp binary).
.yarn/cache/@img-sharp-libvips-linux-x64-npm-1.2.4-105fd6d44d-10.zip Adds Yarn offline cache artifact (libvips).
.yarn/cache/@esbuild-linux-x64-npm-0.27.2-11f1a3d9db-10.zip Adds Yarn offline cache artifact (esbuild binary).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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",
},
Copy link

Copilot AI Apr 13, 2026

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 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
});
Copy link

Copilot AI Apr 13, 2026

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.
@MeriemMechri
Copy link
Copy Markdown
Contributor Author

MeriemMechri commented Apr 14, 2026

@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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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
Copy link

Copilot AI Apr 14, 2026

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
Copy link

Copilot AI Apr 14, 2026

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
Copy link

Copilot AI Apr 14, 2026

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