Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds cypress split testing #11812

Closed
wants to merge 13 commits into from
70 changes: 68 additions & 2 deletions .github/workflows/simorgh-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,63 @@ permissions:
contents: read

jobs:
install:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Simorgh E2E Build
uses: cypress-io/github-action@v6
with:
runTests: false
build: yarn build

- name: Simorgh NextJS E2E Build
uses: cypress-io/github-action@v6
with:
working-directory: ws-nextjs-app
runTests: false
build: yarn build

- name: Save Simorgh E2E Build
uses: actions/upload-artifact@v4
with:
name: simorgh-build
if-no-files-found: error
path: build

- name: Save Simorgh NextJS E2E Build
uses: actions/upload-artifact@v4
with:
name: simorgh-nextjs-build
if-no-files-found: error
path: ws-nextjs-app/build

cypress-run:
runs-on: ubuntu-latest
needs: install
strategy:
fail-fast: false
matrix:
node-version: [18.x]
containers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
env:
CI: true
LOG_LEVEL: 'error'
CYPRESS_SKIP_EU: true
CYPRESS_SMOKE: true
BFF_PATH: 'https://web-cdn.test.api.bbci.co.uk/fd/simorgh-bff'
CYPRESS_APP_ENV: 'local'
YARN_ENABLE_IMMUTABLE_INSTALLS: false

steps:
- name: Checkout
Expand All @@ -38,15 +83,36 @@ jobs:
- name: Add bbc.com domain
run: sudo echo "127.0.0.1 localhost.bbc.com" | sudo tee -a /etc/hosts

- name: Download the Simorgh build folder
uses: actions/download-artifact@v4
with:
name: simorgh-build
path: build

- name: Download the Simorgh Next.js build folder
uses: actions/download-artifact@v4
with:
name: simorgh-nextjs-build
path: ws-nextjs-app/build

- name: List all files
run: ls -a && cp envConfig/local.env .env

- name: Run Simorgh E2Es
uses: cypress-io/github-action@v6
env:
SPLIT: ${{ strategy.job-total }}
SPLIT_INDEX: ${{ strategy.job-index }}
with:
build: yarn build
install-command: yarn install
start: yarn start

- name: Run Simorgh NextJS E2Es
uses: cypress-io/github-action@v6
env:
SPLIT: ${{ strategy.job-total }}
SPLIT_INDEX: ${{ strategy.job-index }}
with:
working-directory: ws-nextjs-app
build: yarn build
install-command: yarn install
start: yarn start
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn/cache/fsevents-patch-6b67494872-10.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from 'cypress';
import webpackPreprocessor from '@cypress/webpack-preprocessor';
import fs from 'fs';
import path from 'path';
import cypressSplit from 'cypress-split';
import MomentTimezoneInclude from './src/app/legacy/psammead/moment-timezone-include/src';
import { webpackDirAlias } from './dirAlias';

Expand All @@ -17,6 +18,7 @@ export default defineConfig({
},
e2e: {
setupNodeEvents(on, config) {
cypressSplit(on, config);
if (!config.env.APP_ENV) {
config.env.APP_ENV = 'local';
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
"cypress": "13.10.0",
"cypress-axe": "1.5.0",
"cypress-multi-reporters": "1.6.4",
"cypress-split": "^1.24.0",
"cypress-terminal-report": "6.0.2",
"depcheck": "1.4.7",
"eslint": "7.32.0",
Expand Down
2 changes: 2 additions & 0 deletions ws-nextjs-app/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* eslint-disable no-param-reassign */
import { defineConfig } from 'cypress';
import cypressSplit from 'cypress-split';

export default defineConfig({
// Consider moving 'retries' to a per-test level once we have more tests
retries: 3,
e2e: {
setupNodeEvents(on, config) {
cypressSplit(on, config);
if (!config.env.APP_ENV) {
config.env.APP_ENV = 'local';
}
Expand Down
1 change: 1 addition & 0 deletions ws-nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@testing-library/react": "15.0.7",
"babel-plugin-transform-rename-import": "2.3.0",
"cypress": "13.10.0",
"cypress-split": "^1.24.0",
"cypress-terminal-report": "6.0.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand Down
Loading
Loading