Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
30ff686
test(playwright):start migration with homePage
MeriemMechri Feb 2, 2026
9fb58ff
test(playwright):add helpers files
MeriemMechri Feb 2, 2026
1fd6733
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Feb 2, 2026
78179d7
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Feb 3, 2026
e7b5da6
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Feb 19, 2026
d874188
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Feb 20, 2026
935f8e6
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Feb 24, 2026
6acc7dd
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Feb 26, 2026
3a08945
test: print user info in GH action
MeriemMechri Feb 27, 2026
66510d1
Merge branch 'latest' into ws-playwright-sample-tests
MeriemMechri Mar 24, 2026
40da1ab
test WS_UTF_AUTH token
MeriemMechri Mar 24, 2026
98daebe
test
MeriemMechri Mar 24, 2026
eae14d7
test
MeriemMechri Mar 24, 2026
5ead5fa
test:add curl command
MeriemMechri Mar 24, 2026
33797a2
chore: test token for cloning
MeriemMechri Mar 24, 2026
c1e217f
chore: test token for cloning
MeriemMechri Mar 24, 2026
e23b582
chore: use yarn 4.12
MeriemMechri Mar 24, 2026
e408d08
chore: try to use yarn config set
MeriemMechri Mar 24, 2026
b595d5c
chore: cleanup
MeriemMechri Mar 24, 2026
84e4788
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 25, 2026
9077462
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 25, 2026
2c14ea8
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 25, 2026
8323dc4
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 25, 2026
e08365d
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 25, 2026
0c8bf06
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 26, 2026
4dd8ec2
refactor: per comments review
MeriemMechri Mar 26, 2026
df0cc6f
refactor:update details
MeriemMechri Mar 26, 2026
8ccaca0
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 26, 2026
6935adb
refactor: move user and email to secrets
MeriemMechri Mar 26, 2026
2e27dfd
chore: add UTF user to all yarn install steps
MeriemMechri Mar 26, 2026
5444e23
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 26, 2026
1274a30
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 26, 2026
da3c3b8
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 31, 2026
d9eacb1
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Mar 31, 2026
3eb49ad
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 1, 2026
f5b161e
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 2, 2026
a9ec091
chore: remove playwright tests from unit tests run
MeriemMechri Apr 6, 2026
e222c8c
chore: run on CI
MeriemMechri Apr 6, 2026
9740865
chore: update to latest unified framework
MeriemMechri Apr 7, 2026
91c2b27
fix: ensure playwright is headless on CI
MeriemMechri Apr 7, 2026
199ce9f
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 7, 2026
3fa8bd6
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 8, 2026
e1a7565
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 8, 2026
e4da992
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 9, 2026
be08253
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 9, 2026
ed50721
refactor: fix typos in github actions
MeriemMechri Apr 9, 2026
f80cbc5
refactor: update path for playwright report
MeriemMechri Apr 9, 2026
c542fcf
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 9, 2026
382d635
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 9, 2026
28841b7
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 10, 2026
2d30a86
refactor: per comments review
MeriemMechri Apr 12, 2026
c4a89cb
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 13, 2026
0ba9d12
refactor: remove unused code
MeriemMechri Apr 14, 2026
5b01e60
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 14, 2026
537c87e
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 14, 2026
b13c636
refactor: code review comments
MeriemMechri Apr 14, 2026
f78ef41
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 14, 2026
d171ebc
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 14, 2026
9040a06
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playw…
MeriemMechri Apr 14, 2026
11fb587
refactor: copilot code review comments
MeriemMechri Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/simorgh-e2e-playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Playwright E2E - Simorgh
on:
pull_request:
branches:
- '**'
permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
env:
CI: true
LOG_LEVEL: 'error'

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Cache Node Modules
id: cache
uses: actions/cache@v4
with:
path: |
node_modules
ws-nextjs-app/node_modules
key: node-modules-${{ hashFiles('yarn.lock', 'ws-nextjs-app/yarn.lock') }}

- 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
Comment thread
MeriemMechri marked this conversation as resolved.

- name: Install Playwright Browsers
Comment thread
MeriemMechri marked this conversation as resolved.
working-directory: ws-nextjs-app
run: npx playwright install --with-deps

- name: Run Playwright tests
working-directory: ws-nextjs-app
run: HEADLESS=true npx playwright test --project="WorldService - Chrome"

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: ws-nextjs-app/playwright-report
retention-days: 30
7 changes: 6 additions & 1 deletion .github/workflows/simorgh-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ jobs:

- 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
Comment thread
MeriemMechri marked this conversation as resolved.
Comment on lines 36 to +43
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.
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


- name: Integration Tests - Express
run: yarn test:integration:ci
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/simorgh-local-server-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ jobs:

- 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
Comment thread
MeriemMechri marked this conversation as resolved.
Comment on lines 36 to +43
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.

- name: Build Simorgh - Express App
run: yarn build:local
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/simorgh-misc-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ jobs:

- 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/
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 git config key won’t be interpreted correctly because the URL contains dots (e.g. github.com) and needs quoting as a subsection. Use the standard form like git config --global url."https://${{ secrets.WS_UTF_AUTH }}@github.com/".insteadOf "https://github.com/" so Git writes the intended [url "..."] section.

Suggested change
git config --global url.https://${{ secrets.WS_UTF_AUTH }}@github.com/.insteadOf https://github.com/
git config --global url."https://${{ secrets.WS_UTF_AUTH }}@github.com/".insteadOf "https://github.com/"

Copilot uses AI. Check for mistakes.
./scripts/installNodeModules.sh
Comment thread
MeriemMechri marked this conversation as resolved.
Comment on lines 41 to +48
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.

- name: Chromatic UI Tests
uses: chromaui/action@latest
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/simorgh-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ jobs:

- 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/
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 git config key won’t be interpreted correctly because the URL contains dots (e.g. github.com) and needs quoting as a subsection. Use the standard form like git config --global url."https://${{ secrets.WS_UTF_AUTH }}@github.com/".insteadOf "https://github.com/" so Git writes the intended [url "..."] section.

Suggested change
git config --global url.https://${{ secrets.WS_UTF_AUTH }}@github.com/.insteadOf https://github.com/
git config --global url."https://${{ secrets.WS_UTF_AUTH }}@github.com/".insteadOf "https://github.com/"

Copilot uses AI. Check for mistakes.
./scripts/installNodeModules.sh
Comment thread
MeriemMechri marked this conversation as resolved.

- name: Build Simorgh - Express App
run: yarn build
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ secret.env
src/app/legacy/moment-timezone-include/tz
tsconfig.tsbuildinfo
src/service-worker-test.js
# playwright report files
__assets__
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn/cache/fsevents-patch-19706e7e35-10.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
940 changes: 940 additions & 0 deletions .yarn/releases/yarn-4.13.0.cjs

Large diffs are not rendered by default.

942 changes: 0 additions & 942 deletions .yarn/releases/yarn-4.9.4.cjs

This file was deleted.

10 changes: 5 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ checksumBehavior: update

compressionLevel: mixed

defaultSemverRangePrefix: ''
defaultSemverRangePrefix: ""

enableGlobalCache: false

Expand All @@ -13,13 +13,13 @@ nodeLinker: node-modules
npmAuditExcludePackages: []

npmAuditIgnoreAdvisories:
- 1112686 # https://github.com/advisories/GHSA-p5wg-g6qr-c7cg
- 1112686

plugins:
- checksum: 5e73a1acbb9741fce1e8335e243c9480ea2107b9b4b65ed7643785ddea9e3019aee254a92a853b1cd71023b16fff5b7d3afd5256fe57cd35a54f8785b8c30281
path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: 'https://go.mskelton.dev/yarn-outdated/v4'
spec: "https://go.mskelton.dev/yarn-outdated/v4"

progressBarStyle: 'patrick' # https://yarnpkg.com/configuration/yarnrc#progressBarStyle
progressBarStyle: patrick

yarnPath: .yarn/releases/yarn-4.9.4.cjs
yarnPath: .yarn/releases/yarn-4.13.0.cjs
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@
"test:puppeteer": "jest --ci --colors --verbose ./puppeteer",
"test:puppeteer:local": "PUPPETEER_APP_ENV=local yarn test:puppeteer",
"test:unit": "test -z $CI && yarn test:unit:local || yarn test:unit:ci",
"test:unit:local": "NODE_OPTIONS=--experimental-vm-modules jest --colors --shard=1/1 --testPathIgnorePatterns=\"src/integration/pages\" \"scripts/bundleSize\" \"puppeteer\" \"ws-nextjs-app\"",
"test:unit:local": "NODE_OPTIONS=--experimental-vm-modules jest --colors --shard=1/1 --testPathIgnorePatterns=\"src/integration/pages\" \"scripts/bundleSize\" \"puppeteer\" \"ws-nextjs-app\" \"playwright\"",
Comment thread
MeriemMechri marked this conversation as resolved.
"test:unit:ci": "yarn test:unit:local --ci",
"test:unit:scripts": "jest --colors --testPathPatterns=\"scripts/bundleSize/\"",
"test:unit:onetest": "test -z && NODE_OPTIONS=--experimental-vm-modules jest --colors --testPathPatterns=\"src/server/\" || NODE_OPTIONS=--experimental-vm-modules jest --ci --runInBand --colors --testPathPatterns=\"src/server/\"",
"test:unit:watch": "yarn test:unit -- --watch",
"test:unit:updatesnapshots": "NODE_OPTIONS=--experimental-vm-modules jest --updateSnapshot --silent=false --colors --testPathIgnorePatterns=\"src/integration/pages\" \"scripts/bundleSize\" \"puppeteer\" \"ws-nextjs-app\"",
"test:unit:updatesnapshots": "NODE_OPTIONS=--experimental-vm-modules jest --updateSnapshot --silent=false --colors --testPathIgnorePatterns=\"src/integration/pages\" \"scripts/bundleSize\" \"puppeteer\" \"ws-nextjs-app\" \"playwright\"",
"test:integration": "NODE_OPTIONS=\"--no-experimental-strip-types --experimental-vm-modules\" node src/integration/utils/runTests/index.js",
"test:integration:updatesnapshots": "run-p test:integration:express:updatesnapshots test:integration:nextjs:updatesnapshots",
"test:integration:express:updatesnapshots": "NODE_OPTIONS=\"--no-experimental-strip-types --experimental-vm-modules\" node src/integration/utils/runTests/index.js --updateSnapshot",
Expand Down Expand Up @@ -269,5 +269,5 @@
"cloud-init"
]
},
"packageManager": "yarn@4.9.4"
"packageManager": "yarn@4.13.0"
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
}
},
"include": ["src/**/*", "src/app/legacy/**/*.ts*"],
"exclude": ["node_modules", "build"]
"exclude": ["node_modules", "build", "ws-nextjs-app/playwright/**/*.ts"]
}
1 change: 1 addition & 0 deletions ws-nextjs-app/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const buildConfig = async (config: Config): Promise<Config> => {
...(config.testPathIgnorePatterns || []),
'build',
'node_modules',
'playwright',
],
})();
};
Expand Down
6 changes: 4 additions & 2 deletions ws-nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
"cypress": "cypress run --browser chrome",
"cypress:interactive": "cypress open --browser chrome",
"test:e2e": "yarn stop && yarn build && run-p --race start cypress -- --e2e",
"test:e2e:interactive": "yarn stop && yarn build && run-p --race start cypress:interactive -- --e2e"
},
"test:e2e:interactive": "yarn stop && yarn build && run-p --race start cypress:interactive -- --e2e",
"test:e2e:playwright": "npx playwright test --project=\"WorldService - Chrome\""},
"devDependencies": {
"@bbc/unified-web-e2e-framework": "github:bbc/unified-web-e2e-framework#v4.0.0",
"@cypress/webpack-preprocessor": "7.0.1",
"@jest/environment": "30.2.0",
"@jest/types": "30.2.0",
"@playwright/test": "1.59.1",
"@swc/core": "1.15.24",
"@testing-library/jest-dom": "6.9.1",
"@testing-library/react": "16.3.1",
Expand Down
8 changes: 8 additions & 0 deletions ws-nextjs-app/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { config } from '@bbc/unified-web-e2e-framework';

config.testDir = 'playwright/specs';
if (config.use) {
config.use.baseURL = 'https://www.bbc.com';
}

Comment thread
MeriemMechri marked this conversation as resolved.
export default config;
7 changes: 7 additions & 0 deletions ws-nextjs-app/playwright/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rules": {
// these rules seem to be used as the common pattern for looping elements in playwright
"no-restricted-syntax": ["off", "ForOfStatement"],
"no-await-in-loop": "off",
},
}
Comment thread
MeriemMechri marked this conversation as resolved.
4 changes: 4 additions & 0 deletions ws-nextjs-app/playwright/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Playwright

To run the Playwright tests for the World Service Chrome project, change to the `ws-nextjs-app` directory and use the package script:
`cd ws-nextjs-app && yarn test:e2e:playwright --project="WorldService - Chrome"`
85 changes: 85 additions & 0 deletions ws-nextjs-app/playwright/specs/homePage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import SERVICES from '#app/lib/config/services';
import { test } from '@bbc/unified-web-e2e-framework';
import { expect } from '@playwright/test';

const SERVICES_PATTERN = SERVICES.join('|');

const VALID_HREF_REGEX = new RegExp(
`^https://www\\.bbc\\.com/(?:${SERVICES_PATTERN}|usingthebbc/[^/]+(?:/.*)?|programmes/[a-z0-9]{8,15})(?:/.*)?$`,
);

Comment on lines +2 to +10
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

runUrlValidationTest is imported but not used. With noUnusedLocals enabled in the inherited tsconfig, this will cause TypeScript type-checking/build to fail. Remove the import or use it.

Copilot uses AI. Check for mistakes.
const testSuites = [
{
path: '/arabic',
service: 'arabic',
},
{
path: '/dari',
service: 'dari',
},
{
path: '/kyrgyz',
service: 'kyrgyz',
},
{
path: '/magyarul',
service: 'magyarul',
expectedPath: '/magyarul/articles/cwywderkzy2o',
},
{
path: '/polska',
service: 'polska',
},
{
path: '/portuguese',
service: 'portuguese',
},
{
path: '/romania',
service: 'romania',
expectedPath: '/romania/articles/c993yged1xno',
},
{
path: '/serbian/lat',
service: 'serbian',
variant: 'lat',
},
{
path: '/serbian/cyr',
service: 'serbian',
variant: 'cyr',
},
{
path: '/uzbek/lat',
service: 'uzbek',
variant: 'lat',
},
{
path: '/uzbek/cyr',
service: 'uzbek',
variant: 'cyr',
},
];

testSuites.forEach(suite => {
test.describe(`Home Page - ${suite.service}${suite.variant ?? ''}`, () => {
test('all links within <main> element should be a valid World Service URL', async ({
page,
}) => {
const expectedPath = suite.expectedPath || suite.path;

await page.goto(suite.path);
await expect(page).toHaveURL(expectedPath);

const pageLinks = await page
.locator('main a[href^="https://www.bbc.com"]')
.all();

for (const link of pageLinks) {
const href = await link.getAttribute('href');
expect(href).not.toBeNull();
expect(href).toMatch(VALID_HREF_REGEX);
}
});
});
});
Loading
Loading