From a71afb83665e672914c6dbd08e4b737e3f29c83c Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Thu, 2 Jul 2026 14:26:35 +0100 Subject: [PATCH 01/11] add playwright framework + linting --- .github/workflows/playwright-lint.yml | 30 + .../.env.example | 12 + .../.gitignore | 11 + .../.prettierignore | 5 + .../.prettierrc.json | 6 + .../eslint.config.cjs | 29 + .../fixtures/test.ts | 17 + .../package-lock.json | 1422 +++++++++++++++++ .../package.json | 33 + .../playwright.config.ts | 32 + .../support/authenticationInterceptor.ts | 15 + .../support/load-env.ts | 4 + .../support/login.ts | 8 + .../support/services.ts | 49 + .../support/types.ts | 9 + .../tests/lsrp/first_test.spec.ts | 11 + .../tests/transfers/first_test.spec.ts | 11 + .../tests/visits/first_test.spec.ts | 11 + .../tsconfig.json | 14 + 19 files changed, 1729 insertions(+) create mode 100644 .github/workflows/playwright-lint.yml create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/.env.example create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/.gitignore create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/.prettierignore create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/.prettierrc.json create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright.config.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/authenticationInterceptor.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/load-env.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/login.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/services.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/lsrp/first_test.spec.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/transfers/first_test.spec.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/visits/first_test.spec.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tsconfig.json diff --git a/.github/workflows/playwright-lint.yml b/.github/workflows/playwright-lint.yml new file mode 100644 index 00000000..6b762cc2 --- /dev/null +++ b/.github/workflows/playwright-lint.yml @@ -0,0 +1,30 @@ +name: Playwright test linting + +on: + pull_request: + paths: + - src/Tests/DfE.ExternalApplications.PlaywrightTests/** + types: [ opened, synchronize ] + +jobs: + lint: + runs-on: ubuntu-latest + defaults: + run: + working-directory: src/Tests/DfE.ExternalApplications.PlaywrightTests + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Setup Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json + + - name: Lint and format check + run: | + npm ci --ignore-scripts + npm run lint + npm run format:check diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/.env.example b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.env.example new file mode 100644 index 00000000..eb3ec599 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.env.example @@ -0,0 +1,12 @@ +TRANSFERS_URL= +TRANSFERS_USERNAME= +TRANSFERS_API_KEY= +TRANSFERS_TENANT_ID= +LSRP_URL= +LSRP_USERNAME= +LSRP_API_KEY= +LSRP_TENANT_ID= +VISITS_URL= +VISITS_USERNAME= +VISITS_API_KEY= +VISITS_TENANT_ID= \ No newline at end of file diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/.gitignore b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.gitignore new file mode 100644 index 00000000..dae25682 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.gitignore @@ -0,0 +1,11 @@ +# Environment variables +.env +!.env.example + +# Playwright +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ +/playwright/.auth/ diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/.prettierignore b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.prettierignore new file mode 100644 index 00000000..0bd80674 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.prettierignore @@ -0,0 +1,5 @@ +node_modules/ +playwright-report/ +test-results/ +reports/ +package-lock.json diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/.prettierrc.json b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.prettierrc.json new file mode 100644 index 00000000..a4175b70 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "semi": true, + "singleQuote": true, + "trailingComma": "all", + "printWidth": 120 +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs b/src/Tests/DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs new file mode 100644 index 00000000..6c77fddd --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs @@ -0,0 +1,29 @@ +const eslint = require('@eslint/js'); +const { defineConfig, globalIgnores } = require('eslint/config'); +const tseslint = require('typescript-eslint'); +const playwright = require('eslint-plugin-playwright'); +const eslintConfigPrettier = require('eslint-config-prettier'); +const globals = require('globals'); + +module.exports = defineConfig( + globalIgnores(['node_modules/', 'playwright-report/', 'test-results/', 'reports/', 'eslint.config.cjs']), + eslint.configs.recommended, + ...tseslint.configs.recommended, + eslintConfigPrettier, + { + files: ['tests/**/*.ts', 'fixtures/**/*.ts'], + extends: [playwright.configs['flat/recommended']], + }, + { + files: ['scripts/**/*.js'], + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'commonjs', + globals: globals.node, + }, + rules: { + '@typescript-eslint/no-require-imports': 'off', + 'no-console': 'off', + }, + }, +); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts new file mode 100644 index 00000000..abae4c8f --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts @@ -0,0 +1,17 @@ +import { test as base } from '@playwright/test'; +import { registerAuthentication } from '../support/authenticationInterceptor'; +import { getServiceConfig } from '../support/services'; +import type { ServiceConfig, ServiceName } from '../support/types'; + +export const test = base.extend<{ serviceConfig: ServiceConfig }>({ + serviceConfig: async ({}, use, testInfo) => { + await use(getServiceConfig(testInfo.project.name as ServiceName)); + }, + + context: async ({ context, serviceConfig }, use) => { + await registerAuthentication(context, serviceConfig); + await use(context); + }, +}); + +export { expect } from '@playwright/test'; diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json new file mode 100644 index 00000000..b19ce520 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json @@ -0,0 +1,1422 @@ +{ + "name": "dfe.externalapplications.playwrighttests", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "dfe.externalapplications.playwrighttests", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "@eslint/js": "^10.0.1", + "@playwright/test": "^1.61.1", + "@types/node": "^26.1.0", + "dotenv": "^17.4.2", + "eslint": "^10.6.0", + "eslint-config-prettier": "^10.1.1", + "eslint-plugin-playwright": "^2.2.2", + "globals": "^16.0.0", + "prettier": "^3.5.3", + "typescript": "^5.8.2", + "typescript-eslint": "^8.26.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.6.0.tgz", + "integrity": "sha512-ii6Bw9jJ2zi2cWA2Z+9/QZ/+3DX6kwaV5Q986D/CdP3Lap3w/pgQZ373FV7byY/i7L4IRH/G43I5dz1ClsCbpA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.2.tgz", + "integrity": "sha512-+CNAzxglkrpNf/kKywqQfk74QjtceuOE7Qm+AF8miRvPF/wmmK5+OJOgVh3AVTT3RP2mH3+FOaxlE5v72owk0A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@playwright/test": { + "version": "1.61.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.61.1.tgz", + "integrity": "sha512-8nKv6+0RJSL9FE4jYOEGXnPeM/Hg12qZpmqzZjRh3qM0Y7c3z1mrOTfFLids72RDQYVh9WpLEfR5WdpNX4fkig==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.61.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "26.1.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.0.tgz", + "integrity": "sha512-O0A1G3xPGy4w7AgQdAQYUlQ+BKk2Oovw8eRpofyp5KdBZULnbe+WqaOVNrm705SHphCiG4XHsACrSmPu1f+Kgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~8.3.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.62.1.tgz", + "integrity": "sha512-4EQM77WgVNxj7OkL/5b/D/xZsw00G577+UriYTC7JF5opcF3T2AuoeY7ueLaZgSVjSgCS6yOAJB5bRGLPSJUzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.62.1", + "@typescript-eslint/type-utils": "8.62.1", + "@typescript-eslint/utils": "8.62.1", + "@typescript-eslint/visitor-keys": "8.62.1", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.62.1", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.62.1.tgz", + "integrity": "sha512-sPhE4iHuJDSvoAiec+Ro8JyXw8f0ql13HFR82P99nCm9GwTEKG0KYLvDe6REk8BCXuit6vJAv/Yxg5ABaNS2rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.62.1", + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/typescript-estree": "8.62.1", + "@typescript-eslint/visitor-keys": "8.62.1", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.62.1.tgz", + "integrity": "sha512-yQ3RgY5RkSBpsNS1Bx/JQEcA24FOSdfGktoyprAr5u18390UQdtVcfnEv4nIrIshNnavlVyZBKxQwT1fIAE6cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.62.1", + "@typescript-eslint/types": "^8.62.1", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.62.1.tgz", + "integrity": "sha512-r4d249KbQ1SFdpeStvob8Ih6aPPIzfqllPVOtvhve6ZcpuVcYo5/7zUWckKpHE7StASX4kTKZTLf0WQm/wPkcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/visitor-keys": "8.62.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.62.1.tgz", + "integrity": "sha512-xadytJqX9vJVQ2fdQjkcIVigwaOJNWkpjdLt6cEQ+xPnrI1fkp+/jZE/I97k9KUjqtpd25i0HeyZf3T6dutv2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.62.1.tgz", + "integrity": "sha512-aXM5xlqXiTxPibXB93cLAURfT3rlizf7uMXISCXy66Isr/9hISJx3yDsKl0L7lKa51b8JpFuNKby0/O0pEm9jg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/typescript-estree": "8.62.1", + "@typescript-eslint/utils": "8.62.1", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.62.1.tgz", + "integrity": "sha512-ooCzJFaf+Hg+uG6fA3NRFGuFjlfNlDhBthbv4ZPU/0elCAFUfnyXUvf/WOpHz/jYwSmvU2GkR2LtyUfy1AxZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.62.1.tgz", + "integrity": "sha512-xMcW9oP9u7fAMXYs9A65CVmtLQe2r//oXINHfi8HV+oiqhih17sbLdhXr4540YWlgpDKQdY854OL5ZrdCiQsAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.62.1", + "@typescript-eslint/tsconfig-utils": "8.62.1", + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/visitor-keys": "8.62.1", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.62.1.tgz", + "integrity": "sha512-sHtbPfuKNZCG+ih8SyjjucqRntSVmp8XgL5u6o9mAhiSn8ds5o/M/XdM0abweme2Tln3szOstOrZ9OXitvPh0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.62.1", + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/typescript-estree": "8.62.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.62.1.tgz", + "integrity": "sha512-4g3BLxfdTMy8iZG0MaBkadnlRrCJ74cQiFbyEVMrkwIoqdyaXXQM22cotDvrl4x28wgIZ9rEJRoM+mmhSJpJ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.62.1", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/acorn": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", + "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.7.tgz", + "integrity": "sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/dotenv": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", + "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.6.0.tgz", + "integrity": "sha512-6lVbcqSodALYo+4ELD0heG6lFiFxnLMuLkiMi2qV8LMp54N8tE8FT1GMH+ev4Ti00nFjNze2+Su6DsV5OQW3Dg==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.6.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.2", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-playwright": { + "version": "2.10.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-playwright/-/eslint-plugin-playwright-2.10.4.tgz", + "integrity": "sha512-l0V/VxyqfFbtqCTxj5AdRn3Q6S/hIW4nKBnKZVleVbZ24N2My6Usj//ytX3dKKqAoSbvKck9YtSytfdZ5qjLuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "globals": "^17.3.0" + }, + "engines": { + "node": ">=16.9.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/eslint-plugin-playwright/node_modules/globals": { + "version": "17.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.7.0.tgz", + "integrity": "sha512-Czmyns5dUsq4seFBR/Kdydhmo8y9kC79hiSkPn0YcGtNnYWnrgt0vjrSjx9tspoDGWm2CMarffRuLjM4xUz8xg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", + "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/playwright": { + "version": "1.61.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.61.1.tgz", + "integrity": "sha512-DWnY5o3YbLWK4GovuAVwpqL+1VwGNdUGrRr++8j8PtQQzvAVZUIMjKQ90fY689sEJZJBbZVw1rXaOKSTitkzPQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.61.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.61.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.1.tgz", + "integrity": "sha512-h7Qlt6m4REp25qvIdvbDtVmD4LqVXfpRxhORv9L0jzETM05p4fuPJ3dKyuSXQxDSbXnmS79HAgi9589lGSpLkg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.9.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.4.tgz", + "integrity": "sha512-yWG/o/4oJfo036EKAfK6ACAoDOfHeRHx4tuxkfBZiauURiaSmYwlpOr5LQqKtIkRD2z1PLteme2WoxEnj4tHTg==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.62.1.tgz", + "integrity": "sha512-vymnnM5g0AKQDSAyfP12nMIBvgwgA42syg74kkuZ4x1VuTzwQKwc5h9rGxeShCjny5o+zWAb6OEoz7XLgrIkIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.62.1", + "@typescript-eslint/parser": "8.62.1", + "@typescript-eslint/typescript-estree": "8.62.1", + "@typescript-eslint/utils": "8.62.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/undici-types": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", + "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json new file mode 100644 index 00000000..d02e953e --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json @@ -0,0 +1,33 @@ +{ + "name": "dfe.externalapplications.playwrighttests", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "pl:open": "playwright test --ui", + "pl:run": "playwright test", + "pl:test:report": "playwright show-report", + "zap:report": "node scripts/generate-zap-report.js", + "zap:report:teams": "node scripts/send-zap-teams-notification.js", + "lint": "eslint .", + "lint:fix": "eslint . --fix", + "format": "prettier --write .", + "format:check": "prettier --check ." + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@eslint/js": "^10.0.1", + "@playwright/test": "^1.61.1", + "@types/node": "^26.1.0", + "dotenv": "^17.4.2", + "eslint": "^10.6.0", + "eslint-config-prettier": "^10.1.1", + "eslint-plugin-playwright": "^2.2.2", + "globals": "^16.0.0", + "prettier": "^3.5.3", + "typescript": "^5.8.2", + "typescript-eslint": "^8.26.0" + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright.config.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright.config.ts new file mode 100644 index 00000000..aeae719e --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright.config.ts @@ -0,0 +1,32 @@ +import './support/load-env'; +import { defineConfig, devices } from '@playwright/test'; +import { getServiceConfigs } from './support/services'; + +const serviceConfigs = getServiceConfigs(); +const zapProxy = process.env.ZAP_PROXY; + +export default defineConfig({ + testDir: './tests', + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 2 : 0, + workers: process.env.CI ? 1 : undefined, + reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : [['html', { open: 'never' }], ['list']], + use: { + trace: 'on-first-retry', + ignoreHTTPSErrors: true, + ...(zapProxy + ? { + proxy: { server: zapProxy }, + } + : {}), + }, + projects: serviceConfigs.map((service) => ({ + name: service.name, + testMatch: new RegExp(`${service.name}/.*\\.spec\\.ts`), + use: { + ...devices['Desktop Chrome'], + baseURL: service.url, + }, + })), +}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/authenticationInterceptor.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/authenticationInterceptor.ts new file mode 100644 index 00000000..17bef863 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/authenticationInterceptor.ts @@ -0,0 +1,15 @@ +import type { BrowserContext } from '@playwright/test'; +import type { ServiceConfig } from './types'; + +export async function registerAuthentication(context: BrowserContext, config: ServiceConfig): Promise { + await context.route(`${config.url}/**`, async (route) => { + const headers = { + ...route.request().headers(), + 'x-service-email': config.username, + 'x-service-api-key': config.apiKey, + 'X-Tenant-ID': config.tenantId, + }; + + await route.continue({ headers }); + }); +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/load-env.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/load-env.ts new file mode 100644 index 00000000..81df2b53 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/load-env.ts @@ -0,0 +1,4 @@ +import path from 'node:path'; +import dotenv from 'dotenv'; + +dotenv.config({ path: path.resolve(__dirname, '../.env') }); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/login.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/login.ts new file mode 100644 index 00000000..7ecc7a6d --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/login.ts @@ -0,0 +1,8 @@ +import type { Page } from '@playwright/test'; + +export async function login(page: Page): Promise { + await page.context().clearCookies(); + await page.context().clearPermissions(); + await page.goto('/'); + await page.waitForURL(/\/applications\/dashboard/); +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/services.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/services.ts new file mode 100644 index 00000000..97252f2d --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/services.ts @@ -0,0 +1,49 @@ +import type { ServiceConfig, ServiceName } from './types'; + +export function requireEnv(name: string): string { + const value = process.env[name]?.trim(); + + if (!value) { + throw new Error(`${name} environment variable is required`); + } + + return value; +} + +function normalizeUrl(url: string): string { + return url.replace(/\/$/, ''); +} + +function createServiceConfig( + name: ServiceName, + urlEnv: string, + usernameEnv: string, + apiKeyEnv: string, + tenantIdEnv: string, +): ServiceConfig { + return { + name, + url: normalizeUrl(requireEnv(urlEnv)), + username: requireEnv(usernameEnv), + apiKey: requireEnv(apiKeyEnv), + tenantId: requireEnv(tenantIdEnv), + }; +} + +export function getServiceConfigs(): ServiceConfig[] { + return [ + createServiceConfig('transfers', 'TRANSFERS_URL', 'TRANSFERS_USERNAME', 'TRANSFERS_API_KEY', 'TRANSFERS_TENANT_ID'), + createServiceConfig('lsrp', 'LSRP_URL', 'LSRP_USERNAME', 'LSRP_API_KEY', 'LSRP_TENANT_ID'), + createServiceConfig('visits', 'VISITS_URL', 'VISITS_USERNAME', 'VISITS_API_KEY', 'VISITS_TENANT_ID'), + ]; +} + +export function getServiceConfig(name: ServiceName): ServiceConfig { + const config = getServiceConfigs().find((service) => service.name === name); + + if (!config) { + throw new Error(`Unknown service: ${name}`); + } + + return config; +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts new file mode 100644 index 00000000..c4cdeb9e --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts @@ -0,0 +1,9 @@ +export type ServiceName = 'transfers' | 'lsrp' | 'visits'; + +export interface ServiceConfig { + name: ServiceName; + url: string; + username: string; + apiKey: string; + tenantId: string; +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/lsrp/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/lsrp/first_test.spec.ts new file mode 100644 index 00000000..4a7d2bc4 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/lsrp/first_test.spec.ts @@ -0,0 +1,11 @@ +import { test, expect } from '../../fixtures/test'; +import { login } from '../../support/login'; + +test.describe('LSRP initial test', () => { + test('should login and navigate to the dashboard', async ({ page, serviceConfig }) => { + await login(page, serviceConfig); + + await expect(page).toHaveURL(/\/applications\/dashboard/); + await expect(page.getByRole('heading', { level: 1, name: 'Your plans' })).toBeVisible(); + }); +}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/transfers/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/transfers/first_test.spec.ts new file mode 100644 index 00000000..21d8095a --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/transfers/first_test.spec.ts @@ -0,0 +1,11 @@ +import { test, expect } from '../../fixtures/test'; +import { login } from '../../support/login'; + +test.describe('Transfers initial test', () => { + test('should login and navigate to the dashboard', async ({ page, serviceConfig }) => { + await login(page, serviceConfig); + + await expect(page).toHaveURL(/\/applications\/dashboard/); + await expect(page.getByRole('heading', { level: 1, name: 'Your applications' })).toBeVisible(); + }); +}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/visits/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/visits/first_test.spec.ts new file mode 100644 index 00000000..9473a1e6 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/visits/first_test.spec.ts @@ -0,0 +1,11 @@ +import { expect, test } from '../../fixtures/test'; +import { login } from '../../support/login'; + +test.describe('Visits initial test', () => { + test('should login and navigate to the dashboard', async ({ page, serviceConfig }) => { + await login(page, serviceConfig); + + await expect(page).toHaveURL(/\/applications\/dashboard/); + await expect(page.getByRole('heading', { level: 1, name: 'Your visits' })).toBeVisible(); + }); +}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tsconfig.json b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tsconfig.json new file mode 100644 index 00000000..a4c687e0 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "commonjs", + "moduleResolution": "node", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "types": ["node"] + }, + "include": ["**/*.ts"] +} From 9e99980cba33e72d50a040466991bd030ed560d2 Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Fri, 3 Jul 2026 17:06:08 +0100 Subject: [PATCH 02/11] add playwright workflow and refactor to use different service-env combinations --- .github/workflows/deploy.yml | 13 + .github/workflows/playwright-tests.yml | 81 ++++ .../.env.example | 13 +- .../.gitignore | 1 + .../fixtures/test.ts | 12 +- .../package-lock.json | 354 ++++++++++++++++++ .../package.json | 15 +- .../playwright.config.ts | 24 +- .../scripts/send-teams-notification.js | 217 +++++++++++ .../support/app-settings.ts | 120 ++++++ .../support/environment.ts | 60 +++ .../support/services.ts | 49 --- .../support/test-config.ts | 43 +++ .../support/types.ts | 2 +- .../tests/{lsrp => Lsrp}/first_test.spec.ts | 4 +- .../{visits => RGVisits}/first_test.spec.ts | 4 +- .../first_test.spec.ts | 4 +- 17 files changed, 929 insertions(+), 87 deletions(-) create mode 100644 .github/workflows/playwright-tests.yml create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/scripts/send-teams-notification.js create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/environment.ts delete mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/services.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts rename src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/{lsrp => Lsrp}/first_test.spec.ts (85%) rename src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/{visits => RGVisits}/first_test.spec.ts (85%) rename src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/{transfers => Transfers}/first_test.spec.ts (85%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b926172f..cb82439d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -125,3 +125,16 @@ jobs: AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID || '' }} AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION_ID || '' }} AZURE_ACA_CLIENT_ID: ${{ secrets.ACA_CLIENT_ID || '' }} + + playwright-tests: + name: Run Playwright Tests + needs: [set-env, build-import-deploy] + if: | + endsWith(needs.set-env.outputs.environment, '-development') || + endsWith(needs.set-env.outputs.environment, '-test') + uses: ./.github/workflows/playwright-tests.yml + secrets: inherit + with: + application: ${{ needs.set-env.outputs.application }} + environment: ${{ needs.set-env.outputs.environment }} + branch-name: ${{ needs.set-env.outputs.branch }} diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml new file mode 100644 index 00000000..55aecf98 --- /dev/null +++ b/.github/workflows/playwright-tests.yml @@ -0,0 +1,81 @@ +name: Playwright UI Tests +run-name: Playwright tests for '${{ inputs.application }}' - `${{ inputs.environment }}` - `${{ inputs.branch-name }}` + +on: + workflow_call: + inputs: + application: + required: true + type: string + environment: + required: true + type: string + branch-name: + required: true + type: string + secrets: + SERVICE_API_KEY: + required: true + TEAMS_WEBHOOK_URL: + required: false + +concurrency: + group: ${{ github.workflow }}-${{ inputs.application }}-${{ inputs.environment }} + +jobs: + playwright-tests: + name: Run Playwright Tests + timeout-minutes: 20 + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + defaults: + run: + working-directory: src/Tests/DfE.ExternalApplications.PlaywrightTests + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + ref: ${{ inputs.branch-name }} + + - name: Setup Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json + + - name: Install dependencies + run: npm ci --ignore-scripts + + - name: Install Playwright browsers + run: npx playwright install --with-deps chromium + + - name: Run tests + env: + SERVICE: ${{ inputs.application }} + ENVIRONMENT: ${{ inputs.environment }} + SERVICE_API_KEY: ${{ secrets.SERVICE_API_KEY }} + run: npm run pl:run + + - name: Upload test results + if: ${{ failure() }} + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: test-results-${{ inputs.environment }} + path: src/Tests/DfE.ExternalApplications.PlaywrightTests/test-results + + - name: Upload report + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: reports-${{ inputs.environment }} + path: | + src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright-report + src/Tests/DfE.ExternalApplications.PlaywrightTests/reports + + - name: Report results to Teams + if: always() + run: node scripts/send-teams-notification.js + env: + TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} + ENVIRONMENT: ${{ inputs.environment }} + INFORMATION_LINK: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/.env.example b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.env.example index eb3ec599..d4792090 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/.env.example +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.env.example @@ -1,12 +1 @@ -TRANSFERS_URL= -TRANSFERS_USERNAME= -TRANSFERS_API_KEY= -TRANSFERS_TENANT_ID= -LSRP_URL= -LSRP_USERNAME= -LSRP_API_KEY= -LSRP_TENANT_ID= -VISITS_URL= -VISITS_USERNAME= -VISITS_API_KEY= -VISITS_TENANT_ID= \ No newline at end of file +SERVICE_API_KEY= \ No newline at end of file diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/.gitignore b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.gitignore index dae25682..cc19d1c2 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/.gitignore +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/.gitignore @@ -6,6 +6,7 @@ node_modules/ /test-results/ /playwright-report/ +/reports/ /blob-report/ /playwright/.cache/ /playwright/.auth/ diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts index abae4c8f..9daeba03 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts @@ -1,14 +1,10 @@ import { test as base } from '@playwright/test'; import { registerAuthentication } from '../support/authenticationInterceptor'; -import { getServiceConfig } from '../support/services'; -import type { ServiceConfig, ServiceName } from '../support/types'; +import { getServiceConfigFromEnv } from '../support/test-config'; -export const test = base.extend<{ serviceConfig: ServiceConfig }>({ - serviceConfig: async ({}, use, testInfo) => { - await use(getServiceConfig(testInfo.project.name as ServiceName)); - }, - - context: async ({ context, serviceConfig }, use) => { +export const test = base.extend({ + context: async ({ context }, use) => { + const serviceConfig = getServiceConfigFromEnv(); await registerAuthentication(context, serviceConfig); await use(context); }, diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json index b19ce520..ecb034a0 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package-lock.json @@ -12,6 +12,8 @@ "@eslint/js": "^10.0.1", "@playwright/test": "^1.61.1", "@types/node": "^26.1.0", + "axios": "^1.9.0", + "cross-env": "^7.0.3", "dotenv": "^17.4.2", "eslint": "^10.6.0", "eslint-config-prettier": "^10.1.1", @@ -516,6 +518,19 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/ajv": { "version": "6.15.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", @@ -533,6 +548,26 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/axios": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.1.tgz", + "integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.16.0", + "form-data": "^4.0.5", + "https-proxy-agent": "^5.0.1", + "proxy-from-env": "^2.1.0" + } + }, "node_modules/balanced-match": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", @@ -556,6 +591,52 @@ "node": "18 || 20 || >=22" } }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -596,6 +677,16 @@ "dev": true, "license": "MIT" }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/dotenv": { "version": "17.4.2", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", @@ -609,6 +700,70 @@ "url": "https://dotenvx.com" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -912,6 +1067,44 @@ "dev": true, "license": "ISC" }, + "node_modules/follow-redirects": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", + "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -927,6 +1120,55 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -953,6 +1195,75 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -1064,6 +1375,39 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "10.2.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", @@ -1235,6 +1579,16 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/proxy-from-env": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", + "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json index d02e953e..72421af6 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json @@ -4,8 +4,19 @@ "description": "", "main": "index.js", "scripts": { - "pl:open": "playwright test --ui", "pl:run": "playwright test", + "pl:open:Transfers:dev": "cross-env SERVICE=Transfers playwright test --ui", + "pl:open:Lsrp:dev": "cross-env SERVICE=Lsrp playwright test --ui", + "pl:open:RGVisits:dev": "cross-env SERVICE=RGVisits playwright test --ui", + "pl:open:Transfers:test": "cross-env SERVICE=Transfers ENVIRONMENT=Test playwright test --ui", + "pl:open:Lsrp:test": "cross-env SERVICE=Lsrp ENVIRONMENT=Test playwright test --ui", + "pl:open:RGVisits:test": "cross-env SERVICE=RGVisits ENVIRONMENT=Test playwright test --ui", + "pl:run:Transfers:dev": "cross-env SERVICE=Transfers playwright test", + "pl:run:Lsrp:dev": "cross-env SERVICE=Lsrp playwright test", + "pl:run:RGVisits:dev": "cross-env SERVICE=RGVisits playwright test", + "pl:run:Transfers:test": "cross-env SERVICE=Transfers ENVIRONMENT=Test playwright test", + "pl:run:Lsrp:test": "cross-env SERVICE=Lsrp ENVIRONMENT=Test playwright test", + "pl:run:RGVisits:test": "cross-env SERVICE=RGVisits ENVIRONMENT=Test playwright test", "pl:test:report": "playwright show-report", "zap:report": "node scripts/generate-zap-report.js", "zap:report:teams": "node scripts/send-zap-teams-notification.js", @@ -21,7 +32,9 @@ "@eslint/js": "^10.0.1", "@playwright/test": "^1.61.1", "@types/node": "^26.1.0", + "cross-env": "^7.0.3", "dotenv": "^17.4.2", + "axios": "^1.9.0", "eslint": "^10.6.0", "eslint-config-prettier": "^10.1.1", "eslint-plugin-playwright": "^2.2.2", diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright.config.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright.config.ts index aeae719e..2428fac4 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright.config.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/playwright.config.ts @@ -1,8 +1,8 @@ import './support/load-env'; import { defineConfig, devices } from '@playwright/test'; -import { getServiceConfigs } from './support/services'; +import { getServiceConfigFromEnv } from './support/test-config'; -const serviceConfigs = getServiceConfigs(); +const serviceConfig = getServiceConfigFromEnv(); const zapProxy = process.env.ZAP_PROXY; export default defineConfig({ @@ -11,7 +11,9 @@ export default defineConfig({ forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, - reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : [['html', { open: 'never' }], ['list']], + reporter: process.env.CI + ? [['list'], ['html', { open: 'never' }], ['json', { outputFile: 'reports/report.json' }]] + : [['html', { open: 'never' }], ['list']], use: { trace: 'on-first-retry', ignoreHTTPSErrors: true, @@ -21,12 +23,14 @@ export default defineConfig({ } : {}), }, - projects: serviceConfigs.map((service) => ({ - name: service.name, - testMatch: new RegExp(`${service.name}/.*\\.spec\\.ts`), - use: { - ...devices['Desktop Chrome'], - baseURL: service.url, + projects: [ + { + name: serviceConfig.name, + testMatch: new RegExp(`${serviceConfig.name}/.*\\.spec\\.ts`), + use: { + ...devices['Desktop Chrome'], + baseURL: serviceConfig.url, + }, }, - })), + ], }); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/scripts/send-teams-notification.js b/src/Tests/DfE.ExternalApplications.PlaywrightTests/scripts/send-teams-notification.js new file mode 100644 index 00000000..2808cb79 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/scripts/send-teams-notification.js @@ -0,0 +1,217 @@ +const axios = require('axios'); +const fs = require('node:fs'); +const path = require('node:path'); + +function readReportData() { + let reportStats = { tests: 0, passes: 0, failures: 0 }; + let failedTests = []; + + const reportPath = path.join(process.cwd(), 'reports', 'report.json'); + + if (fs.existsSync(reportPath)) { + const reportData = JSON.parse(fs.readFileSync(reportPath, 'utf8')); + + if (reportData?.stats) { + const { expected = 0, unexpected = 0, flaky = 0, skipped = 0 } = reportData.stats; + + reportStats = { + tests: expected + unexpected + flaky + skipped, + passes: expected + flaky, + failures: unexpected, + }; + + if (reportStats.failures > 0 && reportData.suites) { + failedTests = extractFailedTests(reportData.suites); + } + } + } else { + console.warn('Report file not found at:', reportPath); + } + + return { reportStats, failedTests }; +} + +function extractFailedTests(suites, titlePath = []) { + const failedTests = []; + + for (const suite of suites) { + const currentPath = suite.title ? [...titlePath, suite.title] : titlePath; + + for (const spec of suite.specs ?? []) { + if (!spec.ok) { + const lastResult = spec.tests?.[0]?.results?.at(-1); + const errorMessage = lastResult?.errors?.[0]?.message || 'No error message available'; + const fullTitle = [...currentPath, spec.title].filter(Boolean).join(' > '); + + failedTests.push({ + fullTitle, + errorMessage: cleanErrorMessage(errorMessage), + }); + } + } + + if (suite.suites?.length) { + failedTests.push(...extractFailedTests(suite.suites, currentPath)); + } + } + + return failedTests; +} + +function buildCardBody(reportStats, failedTests) { + const hasFailures = reportStats.failures > 0; + const statusText = hasFailures ? '**Playwright Test Run Failed**' : '**Playwright Test Run Passed**'; + + const cardBody = [ + { + type: 'TextBlock', + wrap: true, + text: statusText, + size: 'large', + horizontalAlignment: 'center', + }, + { + type: 'TextBlock', + wrap: true, + text: '**Branch:** ' + process.env.GITHUB_REF, + }, + { + type: 'TextBlock', + wrap: true, + text: '**Workflow:** ' + process.env.GITHUB_WORKFLOW, + }, + { + type: 'TextBlock', + wrap: true, + text: '**Environment:** ' + process.env.ENVIRONMENT, + }, + { + type: 'FactSet', + facts: [ + { title: 'Total Tests:', value: reportStats.tests.toString() }, + { title: 'Passed:', value: reportStats.passes.toString() }, + { title: 'Failed:', value: reportStats.failures.toString() }, + ], + }, + ]; + + if (hasFailures && failedTests.length > 0) { + addFailedTestDetails(cardBody, failedTests); + } + + cardBody.push({ + type: 'TextBlock', + wrap: true, + text: '**See more information:** [' + process.env.INFORMATION_LINK + '](' + process.env.INFORMATION_LINK + ')', + spacing: 'medium', + }); + + return cardBody; +} + +function addFailedTestDetails(cardBody, failedTests) { + cardBody.push({ + type: 'TextBlock', + wrap: true, + text: '**Failed Tests:**', + weight: 'bolder', + spacing: 'medium', + }); + + for (const [index, test] of failedTests.entries()) { + if (index < 10) { + cardBody.push( + { + type: 'TextBlock', + wrap: true, + text: `**${index + 1}.** ${test.fullTitle}`, + weight: 'bolder', + spacing: 'small', + }, + { + type: 'TextBlock', + wrap: true, + text: `*Error:* ${truncateText(test.errorMessage, 500)}`, + spacing: 'none', + isSubtle: true, + }, + ); + } + } + + if (failedTests.length > 10) { + cardBody.push({ + type: 'TextBlock', + wrap: true, + text: `*... and ${failedTests.length - 10} more failed tests. See full report for details.*`, + spacing: 'small', + isSubtle: true, + }); + } +} + +function createTeamsMessage(cardBody, hasFailures) { + const style = hasFailures ? 'attention' : 'good'; + + return { + type: 'message', + attachments: [ + { + contentType: 'application/vnd.microsoft.card.adaptive', + contentUrl: null, + content: { + $schema: 'https://adaptivecards.io/schemas/adaptive-card.json', + type: 'AdaptiveCard', + version: '1.2', + body: [ + { + type: 'Container', + style, + items: cardBody, + }, + ], + }, + }, + ], + }; +} + +function cleanErrorMessage(errorMessage) { + if (!errorMessage) return 'No error message available'; + + const lines = errorMessage.split('\n'); + const relevantLines = []; + + for (const line of lines) { + if (line.includes(' at ')) { + break; + } + + if (line.trim() !== '') { + relevantLines.push(line.trim()); + } + } + + return relevantLines.join(' ').trim() || errorMessage.split('\n')[0]; +} + +function truncateText(text, maxLength) { + if (!text || text.length <= maxLength) return text; + return text.substring(0, maxLength) + '...'; +} + +async function sendTeamsNotification() { + try { + const { reportStats, failedTests } = readReportData(); + const cardBody = buildCardBody(reportStats, failedTests); + const message = createTeamsMessage(cardBody, reportStats.failures > 0); + + await axios.post(process.env.TEAMS_WEBHOOK_URL, message); + console.log('Message sent to Teams successfully'); + } catch (error) { + console.error('Error sending notification to Teams:', error); + process.exit(1); + } +} + +sendTeamsNotification(); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts new file mode 100644 index 00000000..679c7803 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts @@ -0,0 +1,120 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { resolveAspNetEnvironment } from './environment'; +import type { ServiceName } from './types'; + +type JsonValue = string | number | boolean | null | JsonObject | JsonValue[]; +interface JsonObject { + [key: string]: JsonValue; +} + +interface InternalServiceAccount { + Email?: string; + ApiKey?: string; +} + +interface AppSettings { + DfESignIn?: { + RedirectUri?: string; + }; + ExternalApplicationsApiClient?: { + TenantId?: string; + }; + InternalServiceAuth?: { + Services?: InternalServiceAccount[]; + }; +} + +const webConfigurationsRoot = path.resolve(__dirname, '../../../DfE.ExternalApplications.Web/configurations'); + +function isObject(value: JsonValue | undefined): value is JsonObject { + return typeof value === 'object' && value !== null && !Array.isArray(value); +} + +function deepMerge(base: JsonObject, override: JsonObject): JsonObject { + const merged: JsonObject = { ...base }; + + for (const [key, value] of Object.entries(override)) { + const existing = merged[key]; + + if (isObject(existing) && isObject(value)) { + merged[key] = deepMerge(existing, value); + continue; + } + + merged[key] = value; + } + + return merged; +} + +function readJsonFile(filePath: string): JsonObject { + if (!fs.existsSync(filePath)) { + return {}; + } + + const contents = fs.readFileSync(filePath, 'utf8'); + return JSON.parse(contents) as JsonObject; +} + +function loadApplicationSettings(applicationFolder: string, aspNetEnvironment: string): AppSettings { + const configurationDirectory = path.join(webConfigurationsRoot, applicationFolder); + const baseSettings = readJsonFile(path.join(configurationDirectory, 'appsettings.json')); + const environmentSettings = readJsonFile(path.join(configurationDirectory, `appsettings.${aspNetEnvironment}.json`)); + + return deepMerge(baseSettings, environmentSettings) as AppSettings; +} + +export function loadServiceAppSettings( + serviceName: ServiceName, + aspNetEnvironment = resolveAspNetEnvironment(), +): AppSettings { + return loadApplicationSettings(serviceName, aspNetEnvironment); +} + +export function resolveBaseUrl(settings: AppSettings): string { + const redirectUri = settings.DfESignIn?.RedirectUri?.trim(); + + if (!redirectUri) { + throw new Error('DfESignIn:RedirectUri is not configured in appsettings'); + } + + return new URL(redirectUri).origin; +} + +export function resolveTenantId(settings: AppSettings): string { + const tenantId = settings.ExternalApplicationsApiClient?.TenantId?.trim(); + + if (!tenantId) { + throw new Error('ExternalApplicationsApiClient:TenantId is not configured in appsettings'); + } + + return tenantId; +} + +export function resolvePlaywrightServiceAccount( + settings: AppSettings, + emailMarker: string, +): { email: string; apiKey: string; index: number } { + const services = settings.InternalServiceAuth?.Services; + + if (!services?.length) { + throw new Error('InternalServiceAuth:Services is not configured in appsettings'); + } + + const index = services.findIndex((service) => service.Email?.toLowerCase().includes(emailMarker.toLowerCase())); + + if (index < 0) { + throw new Error(`No InternalServiceAuth service account containing '${emailMarker}' was found in appsettings`); + } + + const service = services[index]; + const email = service.Email?.trim(); + const apiKey = service.ApiKey?.trim(); + + if (!email || !apiKey) { + throw new Error(`InternalServiceAuth service account at index ${index} is missing Email or ApiKey`); + } + + return { email, apiKey, index }; +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/environment.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/environment.ts new file mode 100644 index 00000000..7d9a5a96 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/environment.ts @@ -0,0 +1,60 @@ +import type { ServiceName } from './types'; + +export const applications: readonly ServiceName[] = ['Transfers', 'Lsrp', 'RGVisits']; + +const aspNetEnvironmentNames: Record = { + development: 'Development', + test: 'Test', + production: 'Production', +}; + +const aspNetEnvironmentValues = new Set(Object.values(aspNetEnvironmentNames)); + +export const playwrightServiceEmailMarker = 'eat-cypress'; + +export function requireService(): ServiceName { + const service = process.env.SERVICE?.trim(); + + if (!service || !applications.includes(service as ServiceName)) { + throw new Error(`SERVICE environment variable is required (one of: ${applications.join(', ')})`); + } + + return service as ServiceName; +} + +export function toGitHubEnvironmentPrefix(application: ServiceName): string { + return application.toLowerCase(); +} + +export function resolveAspNetEnvironment(): string { + const environment = process.env.ENVIRONMENT?.trim(); + + if (!environment) { + return 'Development'; + } + + if (aspNetEnvironmentValues.has(environment)) { + return environment; + } + + const service = requireService(); + const prefix = `${toGitHubEnvironmentPrefix(service)}-`; + const normalizedEnvironment = environment.toLowerCase(); + + if (!normalizedEnvironment.startsWith(prefix)) { + throw new Error( + `ENVIRONMENT '${environment}' does not match SERVICE '${service}' (expected prefix '${prefix}')`, + ); + } + + const suffix = normalizedEnvironment.slice(prefix.length); + const aspNetEnvironment = aspNetEnvironmentNames[suffix]; + + if (!aspNetEnvironment) { + throw new Error( + `Unsupported environment suffix '${suffix}' in GitHub environment '${environment}'`, + ); + } + + return aspNetEnvironment; +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/services.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/services.ts deleted file mode 100644 index 97252f2d..00000000 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/services.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { ServiceConfig, ServiceName } from './types'; - -export function requireEnv(name: string): string { - const value = process.env[name]?.trim(); - - if (!value) { - throw new Error(`${name} environment variable is required`); - } - - return value; -} - -function normalizeUrl(url: string): string { - return url.replace(/\/$/, ''); -} - -function createServiceConfig( - name: ServiceName, - urlEnv: string, - usernameEnv: string, - apiKeyEnv: string, - tenantIdEnv: string, -): ServiceConfig { - return { - name, - url: normalizeUrl(requireEnv(urlEnv)), - username: requireEnv(usernameEnv), - apiKey: requireEnv(apiKeyEnv), - tenantId: requireEnv(tenantIdEnv), - }; -} - -export function getServiceConfigs(): ServiceConfig[] { - return [ - createServiceConfig('transfers', 'TRANSFERS_URL', 'TRANSFERS_USERNAME', 'TRANSFERS_API_KEY', 'TRANSFERS_TENANT_ID'), - createServiceConfig('lsrp', 'LSRP_URL', 'LSRP_USERNAME', 'LSRP_API_KEY', 'LSRP_TENANT_ID'), - createServiceConfig('visits', 'VISITS_URL', 'VISITS_USERNAME', 'VISITS_API_KEY', 'VISITS_TENANT_ID'), - ]; -} - -export function getServiceConfig(name: ServiceName): ServiceConfig { - const config = getServiceConfigs().find((service) => service.name === name); - - if (!config) { - throw new Error(`Unknown service: ${name}`); - } - - return config; -} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts new file mode 100644 index 00000000..cd3e2584 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts @@ -0,0 +1,43 @@ +import { playwrightServiceEmailMarker, requireService, resolveAspNetEnvironment } from './environment'; +import { + loadServiceAppSettings, + resolveBaseUrl, + resolvePlaywrightServiceAccount, + resolveTenantId, +} from './app-settings'; +import type { ServiceConfig, ServiceName } from './types'; + +function normalizeUrl(url: string): string { + return url.replace(/\/$/, ''); +} + +function requireApiKey(localApiKey: string): string { + const explicitApiKey = process.env.SERVICE_API_KEY?.trim(); + if (explicitApiKey) { + return explicitApiKey; + } + + if (localApiKey !== 'secret') { + return localApiKey; + } + + throw new Error('SERVICE_API_KEY is required. Set it in .env locally or as a GitHub environment secret in CI.'); +} + +export function createServiceConfig(serviceName: ServiceName): ServiceConfig { + const aspNetEnvironment = resolveAspNetEnvironment(); + const settings = loadServiceAppSettings(serviceName, aspNetEnvironment); + const playwrightService = resolvePlaywrightServiceAccount(settings, playwrightServiceEmailMarker); + + return { + name: serviceName, + url: normalizeUrl(resolveBaseUrl(settings)), + username: playwrightService.email, + apiKey: requireApiKey(playwrightService.apiKey), + tenantId: resolveTenantId(settings), + }; +} + +export function getServiceConfigFromEnv(): ServiceConfig { + return createServiceConfig(requireService()); +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts index c4cdeb9e..a263bbbe 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts @@ -1,4 +1,4 @@ -export type ServiceName = 'transfers' | 'lsrp' | 'visits'; +export type ServiceName = 'Transfers' | 'Lsrp' | 'RGVisits'; export interface ServiceConfig { name: ServiceName; diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/lsrp/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/first_test.spec.ts similarity index 85% rename from src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/lsrp/first_test.spec.ts rename to src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/first_test.spec.ts index 4a7d2bc4..696276de 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/lsrp/first_test.spec.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/first_test.spec.ts @@ -2,8 +2,8 @@ import { test, expect } from '../../fixtures/test'; import { login } from '../../support/login'; test.describe('LSRP initial test', () => { - test('should login and navigate to the dashboard', async ({ page, serviceConfig }) => { - await login(page, serviceConfig); + test('should login and navigate to the dashboard', async ({ page }) => { + await login(page); await expect(page).toHaveURL(/\/applications\/dashboard/); await expect(page.getByRole('heading', { level: 1, name: 'Your plans' })).toBeVisible(); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/visits/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/first_test.spec.ts similarity index 85% rename from src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/visits/first_test.spec.ts rename to src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/first_test.spec.ts index 9473a1e6..766f4f5f 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/visits/first_test.spec.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/first_test.spec.ts @@ -2,8 +2,8 @@ import { expect, test } from '../../fixtures/test'; import { login } from '../../support/login'; test.describe('Visits initial test', () => { - test('should login and navigate to the dashboard', async ({ page, serviceConfig }) => { - await login(page, serviceConfig); + test('should login and navigate to the dashboard', async ({ page }) => { + await login(page); await expect(page).toHaveURL(/\/applications\/dashboard/); await expect(page.getByRole('heading', { level: 1, name: 'Your visits' })).toBeVisible(); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/transfers/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/first_test.spec.ts similarity index 85% rename from src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/transfers/first_test.spec.ts rename to src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/first_test.spec.ts index 21d8095a..e09878c7 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/transfers/first_test.spec.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/first_test.spec.ts @@ -2,8 +2,8 @@ import { test, expect } from '../../fixtures/test'; import { login } from '../../support/login'; test.describe('Transfers initial test', () => { - test('should login and navigate to the dashboard', async ({ page, serviceConfig }) => { - await login(page, serviceConfig); + test('should login and navigate to the dashboard', async ({ page }) => { + await login(page); await expect(page).toHaveURL(/\/applications\/dashboard/); await expect(page.getByRole('heading', { level: 1, name: 'Your applications' })).toBeVisible(); From 446849a5342e0fe1f56112bc5fbc9249da0eac50 Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Mon, 6 Jul 2026 11:14:19 +0100 Subject: [PATCH 03/11] temp. replace SERVICE_API_KEY with CYPRESS_TEST_SECRET --- .github/workflows/playwright-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml index 55aecf98..72a9ed78 100644 --- a/.github/workflows/playwright-tests.yml +++ b/.github/workflows/playwright-tests.yml @@ -14,7 +14,7 @@ on: required: true type: string secrets: - SERVICE_API_KEY: + CYPRESS_TEST_SECRET: # temp replacement for SERVICE_API_KEY required: true TEAMS_WEBHOOK_URL: required: false @@ -53,7 +53,7 @@ jobs: env: SERVICE: ${{ inputs.application }} ENVIRONMENT: ${{ inputs.environment }} - SERVICE_API_KEY: ${{ secrets.SERVICE_API_KEY }} + SERVICE_API_KEY: ${{ secrets.CYPRESS_TEST_SECRET }} # temp replacement for SERVICE_API_KEY run: npm run pl:run - name: Upload test results From ca8722d0ae0c0bb21a145f6fdb9c7dd8c3cc98cf Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Mon, 6 Jul 2026 11:16:51 +0100 Subject: [PATCH 04/11] format --- .../support/environment.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/environment.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/environment.ts index 7d9a5a96..011e1c43 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/environment.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/environment.ts @@ -42,18 +42,14 @@ export function resolveAspNetEnvironment(): string { const normalizedEnvironment = environment.toLowerCase(); if (!normalizedEnvironment.startsWith(prefix)) { - throw new Error( - `ENVIRONMENT '${environment}' does not match SERVICE '${service}' (expected prefix '${prefix}')`, - ); + throw new Error(`ENVIRONMENT '${environment}' does not match SERVICE '${service}' (expected prefix '${prefix}')`); } const suffix = normalizedEnvironment.slice(prefix.length); const aspNetEnvironment = aspNetEnvironmentNames[suffix]; if (!aspNetEnvironment) { - throw new Error( - `Unsupported environment suffix '${suffix}' in GitHub environment '${environment}'`, - ); + throw new Error(`Unsupported environment suffix '${suffix}' in GitHub environment '${environment}'`); } return aspNetEnvironment; From fb47aa57763ec1d55483530b1b97467053a87eb7 Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Tue, 7 Jul 2026 14:26:57 +0100 Subject: [PATCH 05/11] change secret requirements --- .github/workflows/playwright-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml index 72a9ed78..82ef50d7 100644 --- a/.github/workflows/playwright-tests.yml +++ b/.github/workflows/playwright-tests.yml @@ -15,9 +15,9 @@ on: type: string secrets: CYPRESS_TEST_SECRET: # temp replacement for SERVICE_API_KEY - required: true - TEAMS_WEBHOOK_URL: required: false + TEAMS_WEBHOOK_URL: + required: true concurrency: group: ${{ github.workflow }}-${{ inputs.application }}-${{ inputs.environment }} From abd3138454861d266dbcbd03c3feca2ace5c91de Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Tue, 7 Jul 2026 14:43:16 +0100 Subject: [PATCH 06/11] fix checkout --- .github/workflows/playwright-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml index 82ef50d7..06ad5c89 100644 --- a/.github/workflows/playwright-tests.yml +++ b/.github/workflows/playwright-tests.yml @@ -34,7 +34,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: - ref: ${{ inputs.branch-name }} + ref: ${{ github.ref }} - name: Setup Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 From dfd95942ece1b1a9ced5a354f994b0ef6a0a5f15 Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Tue, 7 Jul 2026 15:27:43 +0100 Subject: [PATCH 07/11] secrets fix --- .github/workflows/deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cb82439d..7fd8e447 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -133,8 +133,10 @@ jobs: endsWith(needs.set-env.outputs.environment, '-development') || endsWith(needs.set-env.outputs.environment, '-test') uses: ./.github/workflows/playwright-tests.yml - secrets: inherit with: application: ${{ needs.set-env.outputs.application }} environment: ${{ needs.set-env.outputs.environment }} branch-name: ${{ needs.set-env.outputs.branch }} + secrets: + CYPRESS_TEST_SECRET: ${{ secrets.CYPRESS_TEST_SECRET }} + TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} From b1b4d5554b5d79bd90e2548c97c1eb5400450896 Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Wed, 8 Jul 2026 10:40:42 +0100 Subject: [PATCH 08/11] general imporvements/refactor --- .github/workflows/deploy.yml | 3 +-- .github/workflows/playwright-tests.yml | 8 ++------ .../package.json | 5 +---- .../support/app-settings.ts | 18 ++++++------------ .../support/test-config.ts | 19 +++++-------------- 5 files changed, 15 insertions(+), 38 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7fd8e447..5dde22ed 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -136,7 +136,6 @@ jobs: with: application: ${{ needs.set-env.outputs.application }} environment: ${{ needs.set-env.outputs.environment }} - branch-name: ${{ needs.set-env.outputs.branch }} secrets: - CYPRESS_TEST_SECRET: ${{ secrets.CYPRESS_TEST_SECRET }} + SERVICE_API_KEY: ${{ secrets.SERVICE_API_KEY }} TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }} diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml index 06ad5c89..32928528 100644 --- a/.github/workflows/playwright-tests.yml +++ b/.github/workflows/playwright-tests.yml @@ -1,5 +1,4 @@ name: Playwright UI Tests -run-name: Playwright tests for '${{ inputs.application }}' - `${{ inputs.environment }}` - `${{ inputs.branch-name }}` on: workflow_call: @@ -10,11 +9,8 @@ on: environment: required: true type: string - branch-name: - required: true - type: string secrets: - CYPRESS_TEST_SECRET: # temp replacement for SERVICE_API_KEY + SERVICE_API_KEY: required: false TEAMS_WEBHOOK_URL: required: true @@ -53,7 +49,7 @@ jobs: env: SERVICE: ${{ inputs.application }} ENVIRONMENT: ${{ inputs.environment }} - SERVICE_API_KEY: ${{ secrets.CYPRESS_TEST_SECRET }} # temp replacement for SERVICE_API_KEY + SERVICE_API_KEY: ${{ secrets.SERVICE_API_KEY }} run: npm run pl:run - name: Upload test results diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json index 72421af6..5c2ffdd7 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/package.json @@ -1,8 +1,7 @@ { "name": "dfe.externalapplications.playwrighttests", "version": "1.0.0", - "description": "", - "main": "index.js", + "description": "Playwright UI tests for DfE.ExternalApplications.Web", "scripts": { "pl:run": "playwright test", "pl:open:Transfers:dev": "cross-env SERVICE=Transfers playwright test --ui", @@ -18,8 +17,6 @@ "pl:run:Lsrp:test": "cross-env SERVICE=Lsrp ENVIRONMENT=Test playwright test", "pl:run:RGVisits:test": "cross-env SERVICE=RGVisits ENVIRONMENT=Test playwright test", "pl:test:report": "playwright show-report", - "zap:report": "node scripts/generate-zap-report.js", - "zap:report:teams": "node scripts/send-zap-teams-notification.js", "lint": "eslint .", "lint:fix": "eslint . --fix", "format": "prettier --write .", diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts index 679c7803..17faf8b5 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts @@ -10,7 +10,6 @@ interface JsonObject { interface InternalServiceAccount { Email?: string; - ApiKey?: string; } interface AppSettings { @@ -92,29 +91,24 @@ export function resolveTenantId(settings: AppSettings): string { return tenantId; } -export function resolvePlaywrightServiceAccount( - settings: AppSettings, - emailMarker: string, -): { email: string; apiKey: string; index: number } { +export function resolvePlaywrightServiceEmail(settings: AppSettings, emailMarker: string): string { const services = settings.InternalServiceAuth?.Services; if (!services?.length) { throw new Error('InternalServiceAuth:Services is not configured in appsettings'); } - const index = services.findIndex((service) => service.Email?.toLowerCase().includes(emailMarker.toLowerCase())); + const service = services.find((candidate) => candidate.Email?.toLowerCase().includes(emailMarker.toLowerCase())); - if (index < 0) { + if (!service) { throw new Error(`No InternalServiceAuth service account containing '${emailMarker}' was found in appsettings`); } - const service = services[index]; const email = service.Email?.trim(); - const apiKey = service.ApiKey?.trim(); - if (!email || !apiKey) { - throw new Error(`InternalServiceAuth service account at index ${index} is missing Email or ApiKey`); + if (!email) { + throw new Error(`InternalServiceAuth service account containing '${emailMarker}' is missing Email`); } - return { email, apiKey, index }; + return email; } diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts index cd3e2584..61034f77 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts @@ -1,39 +1,30 @@ import { playwrightServiceEmailMarker, requireService, resolveAspNetEnvironment } from './environment'; -import { - loadServiceAppSettings, - resolveBaseUrl, - resolvePlaywrightServiceAccount, - resolveTenantId, -} from './app-settings'; +import { loadServiceAppSettings, resolveBaseUrl, resolvePlaywrightServiceEmail, resolveTenantId } from './app-settings'; import type { ServiceConfig, ServiceName } from './types'; function normalizeUrl(url: string): string { return url.replace(/\/$/, ''); } -function requireApiKey(localApiKey: string): string { +function requireApiKey(): string { const explicitApiKey = process.env.SERVICE_API_KEY?.trim(); if (explicitApiKey) { return explicitApiKey; } - if (localApiKey !== 'secret') { - return localApiKey; - } - throw new Error('SERVICE_API_KEY is required. Set it in .env locally or as a GitHub environment secret in CI.'); } export function createServiceConfig(serviceName: ServiceName): ServiceConfig { const aspNetEnvironment = resolveAspNetEnvironment(); const settings = loadServiceAppSettings(serviceName, aspNetEnvironment); - const playwrightService = resolvePlaywrightServiceAccount(settings, playwrightServiceEmailMarker); + const serviceEmail = resolvePlaywrightServiceEmail(settings, playwrightServiceEmailMarker); return { name: serviceName, url: normalizeUrl(resolveBaseUrl(settings)), - username: playwrightService.email, - apiKey: requireApiKey(playwrightService.apiKey), + username: serviceEmail, + apiKey: requireApiKey(), tenantId: resolveTenantId(settings), }; } From 0b37550fa074c0cd67f15c416996b57f3bc74032 Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Wed, 8 Jul 2026 13:53:04 +0100 Subject: [PATCH 09/11] add smoke contributor test with page object model --- .../fixtures/test.ts | 25 ++++++++++++++++++- .../pages/BasePage.ts | 12 +++++++++ .../pages/ContributorsInvitePage.ts | 18 +++++++++++++ .../pages/ContributorsPage.ts | 19 ++++++++++++++ .../pages/DashboardPage.ts | 11 ++++++++ .../support/app-settings.ts | 19 +++++++++++++- .../support/login.ts | 8 ++++++ .../support/test-config.ts | 9 ++++++- .../support/types.ts | 6 +++++ .../tests/Lsrp/first_test.spec.ts | 11 -------- .../tests/Lsrp/smoke.spec.ts | 23 +++++++++++++++++ .../tests/RGVisits/first_test.spec.ts | 11 -------- .../tests/RGVisits/smoke.spec.ts | 23 +++++++++++++++++ .../tests/Transfers/first_test.spec.ts | 11 -------- .../tests/Transfers/smoke.spec.ts | 23 +++++++++++++++++ 15 files changed, 193 insertions(+), 36 deletions(-) create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/BasePage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsInvitePage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/DashboardPage.ts delete mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/first_test.spec.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/smoke.spec.ts delete mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/first_test.spec.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/smoke.spec.ts delete mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/first_test.spec.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/smoke.spec.ts diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts index 9daeba03..9fc85b02 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/fixtures/test.ts @@ -1,13 +1,36 @@ import { test as base } from '@playwright/test'; import { registerAuthentication } from '../support/authenticationInterceptor'; import { getServiceConfigFromEnv } from '../support/test-config'; +import type { Terminology } from '../support/types'; +import { DashboardPage } from '../pages/DashboardPage'; +import { ContributorsPage } from '../pages/ContributorsPage'; +import { ContributorsInvitePage } from '../pages/ContributorsInvitePage'; -export const test = base.extend({ +interface Fixtures { + terminology: Terminology; + dashboardPage: DashboardPage; + contributorsPage: ContributorsPage; + contributorsInvitePage: ContributorsInvitePage; +} + +export const test = base.extend({ context: async ({ context }, use) => { const serviceConfig = getServiceConfigFromEnv(); await registerAuthentication(context, serviceConfig); await use(context); }, + terminology: async ({}, use) => { + await use(getServiceConfigFromEnv().terminology); + }, + dashboardPage: async ({ page, terminology }, use) => { + await use(new DashboardPage(page, terminology)); + }, + contributorsPage: async ({ page, terminology }, use) => { + await use(new ContributorsPage(page, terminology)); + }, + contributorsInvitePage: async ({ page, terminology }, use) => { + await use(new ContributorsInvitePage(page, terminology)); + }, }); export { expect } from '@playwright/test'; diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/BasePage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/BasePage.ts new file mode 100644 index 00000000..b63c9f0a --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/BasePage.ts @@ -0,0 +1,12 @@ +import type { Page } from '@playwright/test'; +import type { Terminology } from '../support/types'; + +export abstract class BasePage { + protected readonly page: Page; + protected readonly terminology: Terminology; + + constructor(page: Page, terminology: Terminology) { + this.page = page; + this.terminology = terminology; + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsInvitePage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsInvitePage.ts new file mode 100644 index 00000000..66eec2cd --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsInvitePage.ts @@ -0,0 +1,18 @@ +import { BasePage } from './BasePage'; + +export class ContributorsInvitePage extends BasePage { + private static readonly selectors = { + name: '#Name', + emailAddress: '#EmailAddress', + sendInviteButton: '#send-email-invite', + } as const; + + async fillInvite(name: string, email: string): Promise { + await this.page.locator(ContributorsInvitePage.selectors.name).fill(name); + await this.page.locator(ContributorsInvitePage.selectors.emailAddress).fill(email); + } + + async sendInvite(): Promise { + await this.page.locator(ContributorsInvitePage.selectors.sendInviteButton).click(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsPage.ts new file mode 100644 index 00000000..600a557f --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsPage.ts @@ -0,0 +1,19 @@ +import { expect } from '@playwright/test'; +import { BasePage } from './BasePage'; + +export class ContributorsPage extends BasePage { + private static readonly selectors = { + addContributorButton: '#add-a-contributor', + contributorRow: (index: number) => `#contributor-${index}`, + } as const; + + async addContributor(): Promise { + await this.page.locator(ContributorsPage.selectors.addContributorButton).click(); + } + + async expectContributor(index: number, name: string, email: string): Promise { + const row = this.page.locator(ContributorsPage.selectors.contributorRow(index)); + await expect(row).toContainText(name); + await expect(row).toContainText(email); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/DashboardPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/DashboardPage.ts new file mode 100644 index 00000000..69353067 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/DashboardPage.ts @@ -0,0 +1,11 @@ +import { BasePage } from './BasePage'; + +export class DashboardPage extends BasePage { + private static readonly selectors = { + startNewApplicationButton: '#start-new-application-button', + } as const; + + async startNewApplication(): Promise { + await this.page.locator(DashboardPage.selectors.startNewApplicationButton).click(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts index 17faf8b5..aa1e0eee 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/app-settings.ts @@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { resolveAspNetEnvironment } from './environment'; -import type { ServiceName } from './types'; +import type { ServiceName, Terminology } from './types'; type JsonValue = string | number | boolean | null | JsonObject | JsonValue[]; interface JsonObject { @@ -22,6 +22,10 @@ interface AppSettings { InternalServiceAuth?: { Services?: InternalServiceAccount[]; }; + ApplicationTerminology?: { + Singular?: string; + Plural?: string; + }; } const webConfigurationsRoot = path.resolve(__dirname, '../../../DfE.ExternalApplications.Web/configurations'); @@ -91,6 +95,19 @@ export function resolveTenantId(settings: AppSettings): string { return tenantId; } +export function resolveTerminology(settings: AppSettings): Terminology { + const singular = settings.ApplicationTerminology?.Singular?.trim(); + const plural = settings.ApplicationTerminology?.Plural?.trim(); + + if (!singular || !plural) { + throw new Error( + 'ApplicationTerminology:Singular and ApplicationTerminology:Plural are not configured in appsettings', + ); + } + + return { singular, plural }; +} + export function resolvePlaywrightServiceEmail(settings: AppSettings, emailMarker: string): string { const services = settings.InternalServiceAuth?.Services; diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/login.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/login.ts index 7ecc7a6d..49fad9d8 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/login.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/login.ts @@ -1,8 +1,16 @@ import type { Page } from '@playwright/test'; +import { getServiceConfigFromEnv } from './test-config'; export async function login(page: Page): Promise { await page.context().clearCookies(); await page.context().clearPermissions(); + await page.context().addCookies([ + { + name: '.AspNet.Consent', + value: 'yes', + url: getServiceConfigFromEnv().url, + }, + ]); await page.goto('/'); await page.waitForURL(/\/applications\/dashboard/); } diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts index 61034f77..4ab9d0fb 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/test-config.ts @@ -1,5 +1,11 @@ import { playwrightServiceEmailMarker, requireService, resolveAspNetEnvironment } from './environment'; -import { loadServiceAppSettings, resolveBaseUrl, resolvePlaywrightServiceEmail, resolveTenantId } from './app-settings'; +import { + loadServiceAppSettings, + resolveBaseUrl, + resolvePlaywrightServiceEmail, + resolveTenantId, + resolveTerminology, +} from './app-settings'; import type { ServiceConfig, ServiceName } from './types'; function normalizeUrl(url: string): string { @@ -26,6 +32,7 @@ export function createServiceConfig(serviceName: ServiceName): ServiceConfig { username: serviceEmail, apiKey: requireApiKey(), tenantId: resolveTenantId(settings), + terminology: resolveTerminology(settings), }; } diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts index a263bbbe..0019a2aa 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/support/types.ts @@ -1,9 +1,15 @@ export type ServiceName = 'Transfers' | 'Lsrp' | 'RGVisits'; +export interface Terminology { + singular: string; + plural: string; +} + export interface ServiceConfig { name: ServiceName; url: string; username: string; apiKey: string; tenantId: string; + terminology: Terminology; } diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/first_test.spec.ts deleted file mode 100644 index 696276de..00000000 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/first_test.spec.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { test, expect } from '../../fixtures/test'; -import { login } from '../../support/login'; - -test.describe('LSRP initial test', () => { - test('should login and navigate to the dashboard', async ({ page }) => { - await login(page); - - await expect(page).toHaveURL(/\/applications\/dashboard/); - await expect(page.getByRole('heading', { level: 1, name: 'Your plans' })).toBeVisible(); - }); -}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/smoke.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/smoke.spec.ts new file mode 100644 index 00000000..b17e330f --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Lsrp/smoke.spec.ts @@ -0,0 +1,23 @@ +import { test } from '../../fixtures/test'; +import { login } from '../../support/login'; + +const contributor = { + name: 'Playwright Test', + email: 'playwright@test.com', +}; + +test.describe('LSRP smoke', () => { + test.beforeEach(async ({ page }) => { + await login(page); + }); + + test('should add a contributor', async ({ dashboardPage, contributorsPage, contributorsInvitePage }) => { + await dashboardPage.startNewApplication(); + await contributorsPage.addContributor(); + + await contributorsInvitePage.fillInvite(contributor.name, contributor.email); + await contributorsInvitePage.sendInvite(); + + await contributorsPage.expectContributor(2, contributor.name, contributor.email); + }); +}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/first_test.spec.ts deleted file mode 100644 index 766f4f5f..00000000 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/first_test.spec.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { expect, test } from '../../fixtures/test'; -import { login } from '../../support/login'; - -test.describe('Visits initial test', () => { - test('should login and navigate to the dashboard', async ({ page }) => { - await login(page); - - await expect(page).toHaveURL(/\/applications\/dashboard/); - await expect(page.getByRole('heading', { level: 1, name: 'Your visits' })).toBeVisible(); - }); -}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/smoke.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/smoke.spec.ts new file mode 100644 index 00000000..b472657a --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/RGVisits/smoke.spec.ts @@ -0,0 +1,23 @@ +import { test } from '../../fixtures/test'; +import { login } from '../../support/login'; + +const contributor = { + name: 'Playwright Test', + email: 'playwright@test.com', +}; + +test.describe('Visits smoke', () => { + test.beforeEach(async ({ page }) => { + await login(page); + }); + + test('should add a contributor', async ({ dashboardPage, contributorsPage, contributorsInvitePage }) => { + await dashboardPage.startNewApplication(); + await contributorsPage.addContributor(); + + await contributorsInvitePage.fillInvite(contributor.name, contributor.email); + await contributorsInvitePage.sendInvite(); + + await contributorsPage.expectContributor(2, contributor.name, contributor.email); + }); +}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/first_test.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/first_test.spec.ts deleted file mode 100644 index e09878c7..00000000 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/first_test.spec.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { test, expect } from '../../fixtures/test'; -import { login } from '../../support/login'; - -test.describe('Transfers initial test', () => { - test('should login and navigate to the dashboard', async ({ page }) => { - await login(page); - - await expect(page).toHaveURL(/\/applications\/dashboard/); - await expect(page.getByRole('heading', { level: 1, name: 'Your applications' })).toBeVisible(); - }); -}); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/smoke.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/smoke.spec.ts new file mode 100644 index 00000000..7f1ea6b9 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/smoke.spec.ts @@ -0,0 +1,23 @@ +import { test } from '../../fixtures/test'; +import { login } from '../../support/login'; + +const contributor = { + name: 'Playwright Test', + email: 'playwright@test.com', +}; + +test.describe('Transfers smoke', () => { + test.beforeEach(async ({ page }) => { + await login(page); + }); + + test('should add a contributor', async ({ dashboardPage, contributorsPage, contributorsInvitePage }) => { + await dashboardPage.startNewApplication(); + await contributorsPage.addContributor(); + + await contributorsInvitePage.fillInvite(contributor.name, contributor.email); + await contributorsInvitePage.sendInvite(); + + await contributorsPage.expectContributor(2, contributor.name, contributor.email); + }); +}); From e58f661cf3bcebd8a43c5da21b1d3fbd69c28fbc Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Wed, 8 Jul 2026 13:53:19 +0100 Subject: [PATCH 10/11] fix lint warning --- .../DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs b/src/Tests/DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs index 6c77fddd..2a033112 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/eslint.config.cjs @@ -13,6 +13,9 @@ module.exports = defineConfig( { files: ['tests/**/*.ts', 'fixtures/**/*.ts'], extends: [playwright.configs['flat/recommended']], + rules: { + 'playwright/expect-expect': ['warn', { assertFunctionPatterns: ['^expect'] }], + }, }, { files: ['scripts/**/*.js'], From 2e88d8ced7c41718c415c99f2703bb63a2aa965b Mon Sep 17 00:00:00 2001 From: paddy-clark Date: Thu, 9 Jul 2026 14:39:42 +0100 Subject: [PATCH 11/11] add transfers create-and-submit test using logic from cypress test --- .../assets/upload.pdf | Bin 0 -> 329 bytes .../fixtures/test.ts | 5 + .../pages/ApplicationPreviewPage.ts | 13 ++ .../pages/ContributorsPage.ts | 5 + .../pages/FormPage.ts | 62 +++++++++ .../pages/TaskListPage.ts | 12 ++ .../pages/TaskPage.ts | 19 +++ .../pages/transfers/DeclarationPage.ts | 23 ++++ .../pages/transfers/DetailsOfAcademiesPage.ts | 28 ++++ .../transfers/FinanceAndOperationsPage.ts | 34 +++++ .../transfers/GovernanceStructurePage.ts | 21 +++ .../HighQualityInclusiveEducationPage.ts | 22 +++ .../pages/transfers/IncomingTrustPage.ts | 58 ++++++++ .../pages/transfers/LeadershipPage.ts | 18 +++ .../pages/transfers/MembersPage.ts | 48 +++++++ .../pages/transfers/OutgoingTrustPage.ts | 34 +++++ .../ReasonsAndBenefitsIncomingPage.ts | 26 ++++ .../ReasonsAndBenefitsOutgoingPage.ts | 17 +++ .../pages/transfers/RisksPage.ts | 46 +++++++ .../pages/transfers/SchoolImprovementPage.ts | 12 ++ .../pages/transfers/TrusteesPage.ts | 52 +++++++ .../pages/transfers/index.ts | 14 ++ .../tests/Transfers/create-and-submit.spec.ts | 130 ++++++++++++++++++ 23 files changed, 699 insertions(+) create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/assets/upload.pdf create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ApplicationPreviewPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/FormPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/TaskListPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/TaskPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/DeclarationPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/DetailsOfAcademiesPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/FinanceAndOperationsPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/GovernanceStructurePage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/HighQualityInclusiveEducationPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/IncomingTrustPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/LeadershipPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/MembersPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/OutgoingTrustPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/ReasonsAndBenefitsIncomingPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/ReasonsAndBenefitsOutgoingPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/RisksPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/SchoolImprovementPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/TrusteesPage.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/index.ts create mode 100644 src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/create-and-submit.spec.ts diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/assets/upload.pdf b/src/Tests/DfE.ExternalApplications.PlaywrightTests/assets/upload.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5bd19816b6419c46e11bca6c2a198ba389d43a65 GIT binary patch literal 329 zcmZXQ%?iRW5QOh}in;WtNope&N)P^BM3m~Sc!)Ggq%@L7P@mqW6|1+g@U)p9&FZW{m&D`vSF-*0uROW+Vs}n({ + page: async ({ page }, use) => { + // Skip SignalR when running under Cypress to avoid WebSocket proxy issues + await page.addInitScript('window.Cypress = true'); + await use(page); + }, context: async ({ context }, use) => { const serviceConfig = getServiceConfigFromEnv(); await registerAuthentication(context, serviceConfig); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ApplicationPreviewPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ApplicationPreviewPage.ts new file mode 100644 index 00000000..10ca092a --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ApplicationPreviewPage.ts @@ -0,0 +1,13 @@ +import { expect } from '@playwright/test'; +import { FormPage } from './FormPage'; + +export class ApplicationPreviewPage extends FormPage { + async submit(): Promise { + await this.byId('submit-application-button').click(); + } + + async expectSubmitted(): Promise { + await expect(this.page).toHaveURL(/\/application-submitted\//); + await expect(this.page.locator('.govuk-panel__title')).toContainText('submitted'); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsPage.ts index 600a557f..d9d77b3e 100644 --- a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsPage.ts +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/ContributorsPage.ts @@ -4,6 +4,7 @@ import { BasePage } from './BasePage'; export class ContributorsPage extends BasePage { private static readonly selectors = { addContributorButton: '#add-a-contributor', + proceedToForm: '#proceed-to-application-form', contributorRow: (index: number) => `#contributor-${index}`, } as const; @@ -11,6 +12,10 @@ export class ContributorsPage extends BasePage { await this.page.locator(ContributorsPage.selectors.addContributorButton).click(); } + async proceedToForm(): Promise { + await this.page.locator(ContributorsPage.selectors.proceedToForm).click(); + } + async expectContributor(index: number, name: string, email: string): Promise { const row = this.page.locator(ContributorsPage.selectors.contributorRow(index)); await expect(row).toContainText(name); diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/FormPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/FormPage.ts new file mode 100644 index 00000000..ff573fcc --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/FormPage.ts @@ -0,0 +1,62 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { expect, Locator, Page } from '@playwright/test'; + +export const UPLOAD_FIXTURE = path.resolve(__dirname, '../assets/upload.pdf'); + +export abstract class FormPage { + constructor(protected readonly page: Page) {} + + protected byId(id: string): Locator { + return this.page.locator(`[id="${id}"]`); + } + + protected async saveAndContinue(): Promise { + await this.byId('save-and-continue-button').click(); + } + + protected async markCompleteAndSave(): Promise { + await this.byId('IsTaskCompleted').check(); + await this.byId('save-task-summary-button').click(); + await expect(this.page).toHaveURL(/\/applications\/[^/]+$/); + } + + protected async confirmContinue(): Promise { + await this.byId('confirmation-continue').click(); + } + + protected async confirmYesAndContinue(): Promise { + await this.byId('confirmed-yes').check(); + await this.confirmContinue(); + } + + protected async searchAutocomplete(inputId: string, searchText: string): Promise { + const input = this.byId(inputId); + await input.click(); + await input.pressSequentially(searchText, { delay: 50 }); + await this.byId(`${inputId}-container__option--0`).click(); + await this.byId('autocomplete-confirm-button').click(); + } + + protected async uploadFile(fieldId: string, filePath = UPLOAD_FIXTURE): Promise { + // each upload needs a unique name + const extension = path.extname(filePath); + const baseName = path.basename(filePath, extension); + const fileName = `${baseName}-${fieldId}${extension}`; + + await this.byId(`upload-file-${fieldId}`).setInputFiles({ + name: fileName, + mimeType: extension.toLowerCase() === '.pdf' ? 'application/pdf' : 'application/octet-stream', + buffer: fs.readFileSync(filePath), + }); + await this.byId(`submit-upload-file-${fieldId}`).click(); + await expect(this.byId(`download-${fileName}`)).toContainText(fileName, { timeout: 15_000 }); + await this.byId(`submit-${fieldId}`).click(); + } + + protected async enterDate(prefix: string, day: string, month: string, year: string): Promise { + await this.byId(`${prefix}.Day`).fill(day); + await this.byId(`${prefix}.Month`).fill(month); + await this.byId(`${prefix}.Year`).fill(year); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/TaskListPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/TaskListPage.ts new file mode 100644 index 00000000..433c9b3e --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/TaskListPage.ts @@ -0,0 +1,12 @@ +import { expect } from '@playwright/test'; +import { FormPage } from './FormPage'; + +export class TaskListPage extends FormPage { + async expectLoaded(): Promise { + await expect(this.page).toHaveURL(/\/applications\/[^/]+$/); + } + + async reviewApplication(): Promise { + await this.byId('review-application-button').click(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/TaskPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/TaskPage.ts new file mode 100644 index 00000000..5886bf07 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/TaskPage.ts @@ -0,0 +1,19 @@ +import { expect, Locator } from '@playwright/test'; +import { FormPage } from './FormPage'; + +export abstract class TaskPage extends FormPage { + protected abstract readonly taskItem: string; + + private taskItemLocator(): Locator { + return this.byId(this.taskItem); + } + + async open(): Promise { + await this.taskItemLocator().getByRole('link').first().click(); + } + + async expectCompleted(): Promise { + const status = this.taskItemLocator().locator('.govuk-task-list__status'); + await expect(status).toContainText('Completed'); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/DeclarationPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/DeclarationPage.ts new file mode 100644 index 00000000..2c4c1f3e --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/DeclarationPage.ts @@ -0,0 +1,23 @@ +import { TaskPage } from '../TaskPage'; + +export class DeclarationPage extends TaskPage { + protected readonly taskItem = 'group-declaration-task-declaration-from-all-chairs-of-trustees'; + + async complete(): Promise { + // Joining academy declaration + await this.page.locator('a[href*="trust-declarations-joining"]').first().click(); + await this.byId('Data_equalities-duties-decision_').check(); + await this.byId('Data_chairName-joining').fill('John Cena'); + await this.enterDate('Data_dateSigned-joining', '11', '11', '2025'); + await this.saveAndContinue(); + + // Leaving academy declaration + await this.page.locator('a[href*="trust-declarations-leaving"]').first().click(); + await this.byId('Data_equalities-duties-decision-leaving_-2').check(); + await this.byId('Data_chairName-leaving').fill('Michelle Loner'); + await this.enterDate('Data_dateSigned-leaving', '20', '01', '2026'); + await this.saveAndContinue(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/DetailsOfAcademiesPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/DetailsOfAcademiesPage.ts new file mode 100644 index 00000000..333a6794 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/DetailsOfAcademiesPage.ts @@ -0,0 +1,28 @@ +import { TaskPage } from '../TaskPage'; + +export class DetailsOfAcademiesPage extends TaskPage { + protected readonly taskItem = 'group-about-transferring-academies-task-details-of-academies'; + private static readonly searchInput = 'Data_academiesSearch-complex-field'; + + async complete(academyName: string): Promise { + await this.byId('detailsOfAcademies-add-item').click(); + + await this.searchAutocomplete(DetailsOfAcademiesPage.searchInput, academyName); + await this.confirmYesAndContinue(); + + await this.enterDate('Data_proposedTransferDate', '01', '12', '2024'); + await this.saveAndContinue(); + + // Does the academy receive additional funding? -> No + await this.byId('Data_academyFunding_-2').check(); + await this.saveAndContinue(); + await this.byId('Data_academyOperatingDifferently').fill('Academy will operate differently testing text'); + await this.saveAndContinue(); + + // Diocesan consent required? -> No + await this.byId('Data_detailsOfAcademiesDiocesanConsent_-2').check(); + await this.saveAndContinue(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/FinanceAndOperationsPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/FinanceAndOperationsPage.ts new file mode 100644 index 00000000..2734713a --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/FinanceAndOperationsPage.ts @@ -0,0 +1,34 @@ +import { TaskPage } from '../TaskPage'; + +export class FinanceAndOperationsPage extends TaskPage { + protected readonly taskItem = 'group-about-the-trust-that-academies-are-joining-task-finance-and-operations'; + private static readonly uploadField = 'financeAndOperationsUploadGrowthPlanNext3Years'; + + async complete(): Promise { + // Growth plan -> Yes, then upload + await this.byId('field-financeandoperationshavegrowthplannext3years-change-link').click(); + await this.byId('Data_financeAndOperationsHaveGrowthPlanNext3Years_').check(); + await this.saveAndContinue(); + await this.uploadFile(FinanceAndOperationsPage.uploadField); + + // Policy on charges made to academies -> Yes + text + await this.byId('field-financeandoperationspolicyonchargesmadetoitsacademies-change-link').click(); + await this.byId('Data_financeAndOperationsPolicyOnChargesMadeToItsAcademies_').check(); + await this.saveAndContinue(); + await this.byId('Data_financeAndOperationsHowWillPolicyOnChargesMadeToItsAcademies').fill( + 'Charge on academies testing text', + ); + await this.saveAndContinue(); + + // Service level agreements -> Yes / Yes + text + await this.byId('field-financeandoperationshavesapacademies-change-link').click(); + await this.byId('Data_financeAndOperationsHaveSAPAcademies_').check(); + await this.saveAndContinue(); + await this.byId('Data_financeAndOperationsLocalAuthorityAgreements_').check(); + await this.saveAndContinue(); + await this.byId('Data_financeAndOperationsSummariseTheAgreements').fill('Alternative agreements testing text'); + await this.saveAndContinue(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/GovernanceStructurePage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/GovernanceStructurePage.ts new file mode 100644 index 00000000..c985775d --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/GovernanceStructurePage.ts @@ -0,0 +1,21 @@ +import { TaskPage } from '../TaskPage'; + +export class GovernanceStructurePage extends TaskPage { + protected readonly taskItem = 'group-about-the-trust-that-academies-are-joining-task-governance-structure'; + private static readonly uploadField = 'governanceStructureAfterTheTransferPploadDocuments'; + + async complete(): Promise { + // Governance team confirmation -> No + explanation + await this.byId('field-governanceteamconfirmation-change-link').click(); + await this.byId('Data_governanceTeamConfirmation_-2').check(); + await this.saveAndContinue(); + await this.byId('Data_governanceTeamExplanation').fill('Governance structure testing text'); + await this.saveAndContinue(); + + // Proposed governance structure -> upload document + await this.byId('field-governancestructureafterthetransferpploaddocuments-change-link').click(); + await this.uploadFile(GovernanceStructurePage.uploadField); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/HighQualityInclusiveEducationPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/HighQualityInclusiveEducationPage.ts new file mode 100644 index 00000000..9c59c1cb --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/HighQualityInclusiveEducationPage.ts @@ -0,0 +1,22 @@ +import { TaskPage } from '../TaskPage'; + +export class HighQualityInclusiveEducationPage extends TaskPage { + protected readonly taskItem = + 'group-about-the-trust-that-academies-are-joining-task-high-quality-and-inclusive-education'; + + async complete(): Promise { + await this.byId('field-highqualityandinclusiveeducationquality-change-link').click(); + await this.byId('Data_highQualityAndInclusiveEducationQuality').fill( + 'High quality and inclusive education quality testing text', + ); + await this.saveAndContinue(); + + await this.byId('field-highqualityandinclusiveeducationimpact-change-link').click(); + await this.byId('Data_highQualityAndInclusiveEducationImpact').fill( + 'High quality and inclusive education impact testing text', + ); + await this.saveAndContinue(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/IncomingTrustPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/IncomingTrustPage.ts new file mode 100644 index 00000000..3c4ea095 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/IncomingTrustPage.ts @@ -0,0 +1,58 @@ +import { TaskPage } from '../TaskPage'; + +interface ContactDetails { + name: string; + phone: string; + email: string; +} + +export class IncomingTrustPage extends TaskPage { + protected readonly taskItem = 'group-about-the-trust-that-academies-are-joining-task-trust-details'; + private static readonly searchInput = 'Data_incomingTrustsSearch-field-flow-complex-field'; + private static readonly uploadField = 'incomingTrustUploadBoardResolution'; + + async complete(trustName: string): Promise { + await this.byId('detailsOfIncomingTrust-add-item').click(); + + await this.searchAutocomplete(IncomingTrustPage.searchInput, trustName); + await this.confirmYesAndContinue(); + + // What is the type of trust? -> Single academy trust (first option) + await this.byId('Data_incomingTrustTypeOfTrust_').check(); + await this.saveAndContinue(); + + await this.enterContact('incomingTrustAccountingOfficer', { + name: 'Test Officer', + phone: '0123456789', + email: 'officer@gov.uk', + }); + await this.enterContact('incomingTrustChiefFinancialOfficer', { + name: 'Finance Officer', + phone: '0987654321', + email: 'finance@gov.uk', + }); + await this.enterContact('incomingTrustChairOfTrustee', { + name: 'Chair Trustee', + phone: '0987654321', + email: 'chair@gov.uk', + }); + + // Main contact has an additional Role field + await this.byId('Data_incomingTrustMainContactFullName').fill('Main Contact'); + await this.byId('Data_incomingTrustMainContactRole').fill('Director'); + await this.byId('Data_incomingTrustMainContactPhoneNumber').fill('0123456789'); + await this.byId('Data_incomingTrustMainContactEmailAddress').fill('main@gov.uk'); + await this.saveAndContinue(); + + await this.uploadFile(IncomingTrustPage.uploadField); + + await this.markCompleteAndSave(); + } + + private async enterContact(fieldPrefix: string, contact: ContactDetails): Promise { + await this.byId(`Data_${fieldPrefix}FullName`).fill(contact.name); + await this.byId(`Data_${fieldPrefix}PhoneNumber`).fill(contact.phone); + await this.byId(`Data_${fieldPrefix}EmailAddress`).fill(contact.email); + await this.saveAndContinue(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/LeadershipPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/LeadershipPage.ts new file mode 100644 index 00000000..a10a6f9a --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/LeadershipPage.ts @@ -0,0 +1,18 @@ +import { TaskPage } from '../TaskPage'; + +export class LeadershipPage extends TaskPage { + protected readonly taskItem = 'group-about-the-trust-that-academies-are-joining-task-leadership-and-work-force'; + + async complete(): Promise { + // Will the leadership central team change? -> Yes + text + await this.byId('field-leadershipandworkforcewilltheleadershipcentralteamchange-change-link').click(); + await this.byId('Data_leadershipAndWorkForceWillTheLeadershipCentralTeamChange_').check(); + await this.saveAndContinue(); + await this.byId('Data_leadershipAndWorkForceHowWillTheLeadershipCentralTeamChange').fill( + 'Leadership and work force testing text', + ); + await this.saveAndContinue(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/MembersPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/MembersPage.ts new file mode 100644 index 00000000..a8c3d0a9 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/MembersPage.ts @@ -0,0 +1,48 @@ +import { expect } from '@playwright/test'; +import { TaskPage } from '../TaskPage'; + +export class MembersPage extends TaskPage { + protected readonly taskItem = 'group-about-the-trust-that-academies-are-joining-task-members'; + + private async expectSummary(): Promise { + await expect(this.page).toHaveURL(/\/members$/); + } + + async addExistingMember(name: string): Promise { + await this.expectSummary(); + await this.byId('membersAfterTransfer-add-item').click(); + await this.byId('Data_memberName').first().fill(name); + await this.saveAndContinue(); + await this.byId('Data_existingMember_').first().check(); + await this.saveAndContinue(); + await this.byId('Data_additionalRoles_').check(); + await this.saveAndContinue(); + await this.expectSummary(); + } + + async addNewMember(name: string, pastRoles: string): Promise { + await this.expectSummary(); + await this.byId('membersAfterTransfer-add-item').click(); + await this.byId('Data_memberName').first().fill(name); + await this.saveAndContinue(); + await this.byId('Data_existingMember_-2').first().check(); + await this.saveAndContinue(); + await this.byId('Data_pastRoles').first().fill(pastRoles); + await this.saveAndContinue(); + await this.byId('Data_additionalRoles_-2').check(); + await this.saveAndContinue(); + await this.expectSummary(); + } + + async addLeavingMember(name: string): Promise { + await this.expectSummary(); + await this.byId('membersLeaving-add-item').click(); + await this.byId('Data_memberLeavingName').first().fill(name); + await this.saveAndContinue(); + await this.expectSummary(); + } + + async complete(): Promise { + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/OutgoingTrustPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/OutgoingTrustPage.ts new file mode 100644 index 00000000..22711e3a --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/OutgoingTrustPage.ts @@ -0,0 +1,34 @@ +import { expect } from '@playwright/test'; +import { TaskPage } from '../TaskPage'; + +export class OutgoingTrustPage extends TaskPage { + protected readonly taskItem = 'group-about-the-trusts-that-academies-are-leaving-task-details-of-trusts'; + private static readonly searchInput = 'Data_trustsSearch-field-flow-complex-field'; + private static readonly uploadField = 'outgoingTrustUploadBoardResolution'; + + private async expectSummary(): Promise { + await expect(this.page).toHaveURL(/\/details-of-outgoing-trusts$/); + await expect(this.byId('IsTaskCompleted')).toBeVisible(); + } + + async complete(trustName: string): Promise { + await this.byId('detailsOfOutgoingTrusts-add-item').click(); + + await this.searchAutocomplete(OutgoingTrustPage.searchInput, trustName); + await this.confirmYesAndContinue(); + + await this.byId('Data_outgoingTrustContactDetailsFullName').fill('Michael Scott'); + await this.byId('Data_outgoingTrustContactDetailsRole').fill('Granting Officer'); + await this.byId('Data_outgoingTrustContactDetailsPhoneNumber').fill('07700 900 982'); + await this.byId('Data_outgoingTrustContactDetailsEmailAddress').fill('M.A@gov.uk'); + await this.saveAndContinue(); + + // Will the trust close? -> Yes + upload board resolution + await this.byId('Data_willTrustClose_').check(); + await this.saveAndContinue(); + await this.uploadFile(OutgoingTrustPage.uploadField); + await this.expectSummary(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/ReasonsAndBenefitsIncomingPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/ReasonsAndBenefitsIncomingPage.ts new file mode 100644 index 00000000..b200200c --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/ReasonsAndBenefitsIncomingPage.ts @@ -0,0 +1,26 @@ +import { TaskPage } from '../TaskPage'; + +export class ReasonsAndBenefitsIncomingPage extends TaskPage { + protected readonly taskItem = 'group-about-the-trust-that-academies-are-joining-task-reason-and-benefits'; + + async complete(): Promise { + await this.byId('field-reasonandbenefitstruststrategicneeds-change-link').click(); + await this.byId('Data_reasonAndBenefitsTrustStrategicNeeds').fill('Strategic needs testing text'); + await this.saveAndContinue(); + + await this.byId('field-reasonandbenefitstrustdevelopmentalneeds-change-link').click(); + await this.byId('Data_reasonAndBenefitsTrustDevelopmentalNeeds').fill('Maintain and improve testing text'); + await this.saveAndContinue(); + + await this.byId('field-reasonandbenefitstrustacademiestrustsworkedtogether-change-link').click(); + // Have the academies and trusts worked together in the past? -> Yes + await this.byId('Data_reasonAndBenefitsTrustAcademiesTrustsWorkedTogether_').check(); + await this.saveAndContinue(); + await this.byId('Data_reasonAndBenefitsTrustHowHaveAcademiesTrustsWorkedTogether').fill( + 'Worked together testing text', + ); + await this.saveAndContinue(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/ReasonsAndBenefitsOutgoingPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/ReasonsAndBenefitsOutgoingPage.ts new file mode 100644 index 00000000..a29cf50b --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/ReasonsAndBenefitsOutgoingPage.ts @@ -0,0 +1,17 @@ +import { TaskPage } from '../TaskPage'; + +export class ReasonsAndBenefitsOutgoingPage extends TaskPage { + protected readonly taskItem = 'group-about-transferring-academies-task-reason-and-benefits'; + + async complete(): Promise { + await this.byId('field-reasonandbenefitsacademiesstrategicneeds-change-link').click(); + await this.byId('Data_reasonAndBenefitsAcademiesStrategicNeeds').fill('Strategic needs testing text'); + await this.saveAndContinue(); + + await this.byId('field-reasonandbenefitsacademiesmaintainimprove-change-link').click(); + await this.byId('Data_reasonAndBenefitsAcademiesMaintainImprove').fill('Benefits testing text'); + await this.saveAndContinue(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/RisksPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/RisksPage.ts new file mode 100644 index 00000000..bee0b64e --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/RisksPage.ts @@ -0,0 +1,46 @@ +import { TaskPage } from '../TaskPage'; + +export class RisksPage extends TaskPage { + protected readonly taskItem = 'group-about-transferring-academies-task-risks'; + + async complete(): Promise { + // Due diligence + await this.byId('field-risksduediligence-change-link').click(); + await this.byId('Data_risksDueDiligence').fill('Due diligence testing text'); + await this.saveAndContinue(); + + // Pupil numbers -> Yes + upload + await this.byId('field-riskspupilnumbers-change-link').click(); + await this.byId('Data_risksPupilNumbers_').check(); + await this.saveAndContinue(); + await this.uploadFile('risksUploadPupilNumbers'); + + // Type of transfer -> first option, financial deficit -> Yes + forecast upload + await this.byId('field-riskstransfertype-change-link').click(); + await this.byId('Data_risksTransferType_').check(); + await this.saveAndContinue(); + await this.byId('Data_risksFinancialDeficit_').check(); + await this.saveAndContinue(); + await this.uploadFile('risksFinancialForecast'); + + // Other risks -> Yes + summary + await this.byId('Data_risksOtherRisks_').check(); + await this.saveAndContinue(); + await this.byId('Data_risksRiskManagement').fill('Other risks testing text'); + await this.saveAndContinue(); + + // Finances pooled -> GAG pooled (walks through the retained pages) + await this.byId('field-risksfinancespooled-change-link').click(); + await this.byId('Data_risksFinancesPooled_').check(); + await this.saveAndContinue(); + await this.saveAndContinue(); + await this.saveAndContinue(); + + // Surplus funds / reserves transfer + await this.byId('field-risksreservestransfer-change-link').click(); + await this.byId('Data_risksReservesTransfer').fill('Surplus funds testing text'); + await this.saveAndContinue(); + + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/SchoolImprovementPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/SchoolImprovementPage.ts new file mode 100644 index 00000000..fcae4c65 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/SchoolImprovementPage.ts @@ -0,0 +1,12 @@ +import { TaskPage } from '../TaskPage'; + +export class SchoolImprovementPage extends TaskPage { + protected readonly taskItem = 'group-about-the-trust-that-academies-are-joining-task-school-improvement'; + private static readonly uploadField = 'schoolImprovementModel'; + + async complete(): Promise { + await this.byId('field-schoolimprovementmodel-change-link').click(); + await this.uploadFile(SchoolImprovementPage.uploadField); + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/TrusteesPage.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/TrusteesPage.ts new file mode 100644 index 00000000..369bfc54 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/TrusteesPage.ts @@ -0,0 +1,52 @@ +import { TaskPage } from '../TaskPage'; + +export class TrusteesPage extends TaskPage { + protected readonly taskItem = 'group-about-the-trust-that-academies-are-joining-task-trustees'; + + async addExistingTrustee(name: string, futureRoles: string, localGoverningBody: boolean): Promise { + await this.byId('trusteesAfterTransfer-add-item').click(); + await this.saveAndContinue(); + await this.byId('Data_trusteeName').first().fill(name); + await this.saveAndContinue(); + await this.byId('Data_existingTrustee_').first().check(); + await this.saveAndContinue(); + await this.byId('Data_trusteeFutureRoles').fill(futureRoles); + await this.saveAndContinue(); + await this.byId( + localGoverningBody ? 'Data_trusteeLocalGoverningBody_' : 'Data_trusteeLocalGoverningBody_-2', + ).check(); + await this.saveAndContinue(); + } + + async addNewTrustee( + name: string, + pastRoles: string, + localGoverningBody: boolean, + futureRoles: string, + ): Promise { + await this.byId('trusteesAfterTransfer-add-item').click(); + await this.saveAndContinue(); + await this.byId('Data_trusteeName').first().fill(name); + await this.saveAndContinue(); + await this.byId('Data_existingTrustee_-2').first().check(); + await this.saveAndContinue(); + await this.byId('Data_trusteePastRoles').fill(pastRoles); + await this.saveAndContinue(); + await this.byId('Data_trusteeFutureRoles').fill(futureRoles); + await this.saveAndContinue(); + await this.byId( + localGoverningBody ? 'Data_trusteeLocalGoverningBody_' : 'Data_trusteeLocalGoverningBody_-2', + ).check(); + await this.saveAndContinue(); + } + + async addLeavingTrustee(name: string): Promise { + await this.byId('trusteesLeaving-add-item').click(); + await this.byId('Data_trusteeLeavingName').first().fill(name); + await this.saveAndContinue(); + } + + async complete(): Promise { + await this.markCompleteAndSave(); + } +} diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/index.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/index.ts new file mode 100644 index 00000000..aab09bb4 --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/pages/transfers/index.ts @@ -0,0 +1,14 @@ +export { IncomingTrustPage } from './IncomingTrustPage'; +export { ReasonsAndBenefitsIncomingPage } from './ReasonsAndBenefitsIncomingPage'; +export { HighQualityInclusiveEducationPage } from './HighQualityInclusiveEducationPage'; +export { SchoolImprovementPage } from './SchoolImprovementPage'; +export { FinanceAndOperationsPage } from './FinanceAndOperationsPage'; +export { LeadershipPage } from './LeadershipPage'; +export { MembersPage } from './MembersPage'; +export { TrusteesPage } from './TrusteesPage'; +export { GovernanceStructurePage } from './GovernanceStructurePage'; +export { DetailsOfAcademiesPage } from './DetailsOfAcademiesPage'; +export { ReasonsAndBenefitsOutgoingPage } from './ReasonsAndBenefitsOutgoingPage'; +export { RisksPage } from './RisksPage'; +export { OutgoingTrustPage } from './OutgoingTrustPage'; +export { DeclarationPage } from './DeclarationPage'; diff --git a/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/create-and-submit.spec.ts b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/create-and-submit.spec.ts new file mode 100644 index 00000000..c017eb7c --- /dev/null +++ b/src/Tests/DfE.ExternalApplications.PlaywrightTests/tests/Transfers/create-and-submit.spec.ts @@ -0,0 +1,130 @@ +import { test } from '../../fixtures/test'; +import { login } from '../../support/login'; +import { TaskListPage } from '../../pages/TaskListPage'; +import { ApplicationPreviewPage } from '../../pages/ApplicationPreviewPage'; +import { + IncomingTrustPage, + ReasonsAndBenefitsIncomingPage, + HighQualityInclusiveEducationPage, + SchoolImprovementPage, + FinanceAndOperationsPage, + LeadershipPage, + MembersPage, + TrusteesPage, + GovernanceStructurePage, + DetailsOfAcademiesPage, + ReasonsAndBenefitsOutgoingPage, + RisksPage, + OutgoingTrustPage, + DeclarationPage, +} from '../../pages/transfers'; + +const data = { + incomingTrust: 'CANONS HIGH SCHOOL', + academy: 'St Marys C of E Primary and Nursery, Academy, Handsworth', + outgoingTrust: 'CANONIUM LEARNING TRUST', +}; + +test.describe('Transfers create and submit', () => { + test.setTimeout(360000); + + test.beforeEach(async ({ page }) => { + await login(page); + }); + + test('create and submit an application', async ({ page, dashboardPage, contributorsPage }) => { + await dashboardPage.startNewApplication(); + await contributorsPage.proceedToForm(); + + const taskList = new TaskListPage(page); + await taskList.expectLoaded(); + + // About the trust that academies are joining + const incomingTrust = new IncomingTrustPage(page); + await incomingTrust.open(); + await incomingTrust.complete(data.incomingTrust); + await incomingTrust.expectCompleted(); + + const reasonsIncoming = new ReasonsAndBenefitsIncomingPage(page); + await reasonsIncoming.open(); + await reasonsIncoming.complete(); + await reasonsIncoming.expectCompleted(); + + const hqie = new HighQualityInclusiveEducationPage(page); + await hqie.open(); + await hqie.complete(); + await hqie.expectCompleted(); + + const schoolImprovement = new SchoolImprovementPage(page); + await schoolImprovement.open(); + await schoolImprovement.complete(); + await schoolImprovement.expectCompleted(); + + const finance = new FinanceAndOperationsPage(page); + await finance.open(); + await finance.complete(); + await finance.expectCompleted(); + + const leadership = new LeadershipPage(page); + await leadership.open(); + await leadership.complete(); + await leadership.expectCompleted(); + + const members = new MembersPage(page); + await members.open(); + await members.addExistingMember('John Smith'); + await members.addNewMember('Alice Johnson', 'Past role description testing text'); + await members.addNewMember('Bob Brown', 'Past role description for Bob Brown'); + await members.addLeavingMember('Sarah White'); + await members.complete(); + await members.expectCompleted(); + + const trustees = new TrusteesPage(page); + await trustees.open(); + await trustees.addExistingTrustee('Michael Scott', 'Granting Officer', true); + await trustees.addNewTrustee('Pam Beesly', 'Past role description', true, 'Future role description'); + await trustees.addNewTrustee('Jim Halpert', 'Past role description for Jim Halpert', false, 'Future role description for Jim Halpert'); + await trustees.addLeavingTrustee('Dwight Schrute'); + await trustees.complete(); + await trustees.expectCompleted(); + + const governance = new GovernanceStructurePage(page); + await governance.open(); + await governance.complete(); + await governance.expectCompleted(); + + // About transferring academies + const academies = new DetailsOfAcademiesPage(page); + await academies.open(); + await academies.complete(data.academy); + await academies.expectCompleted(); + + const reasonsOutgoing = new ReasonsAndBenefitsOutgoingPage(page); + await reasonsOutgoing.open(); + await reasonsOutgoing.complete(); + await reasonsOutgoing.expectCompleted(); + + const risks = new RisksPage(page); + await risks.open(); + await risks.complete(); + await risks.expectCompleted(); + + // About the trusts that academies are leaving + const outgoingTrust = new OutgoingTrustPage(page); + await outgoingTrust.open(); + await outgoingTrust.complete(data.outgoingTrust); + await outgoingTrust.expectCompleted(); + + // Declaration + const declaration = new DeclarationPage(page); + await declaration.open(); + await declaration.complete(); + await declaration.expectCompleted(); + + // Review and submit + const preview = new ApplicationPreviewPage(page); + await taskList.reviewApplication(); + await preview.submit(); + await preview.expectSubmitted(); + }); +});