From 2a9ef91810e40fd6123bd9ad2b204366795f87ce Mon Sep 17 00:00:00 2001 From: Alex Tkachev Date: Mon, 16 Dec 2024 16:01:39 +0400 Subject: [PATCH] feat: basic e2e test for projects --- pnpm-lock.yaml | 166 ++++++++++++++++++------ tests/e2e-basic/.gitignore | 2 + tests/e2e-basic/README.md | 13 ++ tests/e2e-basic/eslint.config.mjs | 8 ++ tests/e2e-basic/package.json | 22 ++++ tests/e2e-basic/playwright.config.ts | 43 ++++++ tests/e2e-basic/specs/cms.spec.ts | 6 + tests/e2e-basic/specs/decap.spec.ts | 9 ++ tests/e2e-basic/specs/preview.spec.ts | 17 +++ tests/e2e-basic/specs/publisher.spec.ts | 5 + tests/e2e-basic/specs/setup.ts | 35 +++++ tests/e2e-basic/specs/website.spec.ts | 7 + tests/e2e-basic/tsconfig.json | 6 + tests/e2e-basic/turbo.json | 12 ++ tests/e2e/README.md | 4 + tests/e2e/specs/decap/admin.spec.ts | 8 -- 16 files changed, 318 insertions(+), 45 deletions(-) create mode 100644 tests/e2e-basic/.gitignore create mode 100644 tests/e2e-basic/README.md create mode 100644 tests/e2e-basic/eslint.config.mjs create mode 100644 tests/e2e-basic/package.json create mode 100644 tests/e2e-basic/playwright.config.ts create mode 100644 tests/e2e-basic/specs/cms.spec.ts create mode 100644 tests/e2e-basic/specs/decap.spec.ts create mode 100644 tests/e2e-basic/specs/preview.spec.ts create mode 100644 tests/e2e-basic/specs/publisher.spec.ts create mode 100644 tests/e2e-basic/specs/setup.ts create mode 100644 tests/e2e-basic/specs/website.spec.ts create mode 100644 tests/e2e-basic/tsconfig.json create mode 100644 tests/e2e-basic/turbo.json create mode 100644 tests/e2e/README.md delete mode 100644 tests/e2e/specs/decap/admin.spec.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2e5160ebb..f9a8b987f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -821,6 +821,36 @@ importers: specifier: ^5.3.3 version: 5.6.3 + tests/e2e-basic: + devDependencies: + '@custom/cms': + specifier: workspace:* + version: link:../../apps/cms + '@custom/decap': + specifier: workspace:* + version: link:../../apps/decap + '@custom/eslint-config': + specifier: workspace:* + version: link:../../packages/eslint-config + '@custom/preview': + specifier: workspace:* + version: link:../../apps/preview + '@custom/publisher': + specifier: workspace:* + version: link:../../apps/publisher + '@custom/website': + specifier: workspace:* + version: link:../../apps/website + '@playwright/test': + specifier: ^1.44.1 + version: 1.44.1 + '@types/node': + specifier: ^18 + version: 18.15.13 + typescript: + specifier: ^5.3.3 + version: 5.6.3 + tests/schema: devDependencies: '@custom/eslint-config': @@ -3200,6 +3230,7 @@ packages: cpu: [ppc64] os: [aix] requiresBuild: true + dev: true optional: true /@esbuild/aix-ppc64@0.20.0: @@ -3234,6 +3265,7 @@ packages: cpu: [arm64] os: [android] requiresBuild: true + dev: true optional: true /@esbuild/android-arm64@0.20.0: @@ -3268,6 +3300,7 @@ packages: cpu: [arm] os: [android] requiresBuild: true + dev: true optional: true /@esbuild/android-arm@0.20.0: @@ -3302,6 +3335,7 @@ packages: cpu: [x64] os: [android] requiresBuild: true + dev: true optional: true /@esbuild/android-x64@0.20.0: @@ -3336,6 +3370,7 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true + dev: true optional: true /@esbuild/darwin-arm64@0.20.0: @@ -3370,6 +3405,7 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true + dev: true optional: true /@esbuild/darwin-x64@0.20.0: @@ -3404,6 +3440,7 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true + dev: true optional: true /@esbuild/freebsd-arm64@0.20.0: @@ -3438,6 +3475,7 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true + dev: true optional: true /@esbuild/freebsd-x64@0.20.0: @@ -3472,6 +3510,7 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-arm64@0.20.0: @@ -3506,6 +3545,7 @@ packages: cpu: [arm] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-arm@0.20.0: @@ -3540,6 +3580,7 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-ia32@0.20.0: @@ -3574,6 +3615,7 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-loong64@0.20.0: @@ -3608,6 +3650,7 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-mips64el@0.20.0: @@ -3642,6 +3685,7 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-ppc64@0.20.0: @@ -3676,6 +3720,7 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-riscv64@0.20.0: @@ -3710,6 +3755,7 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-s390x@0.20.0: @@ -3744,6 +3790,7 @@ packages: cpu: [x64] os: [linux] requiresBuild: true + dev: true optional: true /@esbuild/linux-x64@0.20.0: @@ -3778,6 +3825,7 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true + dev: true optional: true /@esbuild/netbsd-x64@0.20.0: @@ -3812,6 +3860,7 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true + dev: true optional: true /@esbuild/openbsd-x64@0.20.0: @@ -3846,6 +3895,7 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true + dev: true optional: true /@esbuild/sunos-x64@0.20.0: @@ -3880,6 +3930,7 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true + dev: true optional: true /@esbuild/win32-arm64@0.20.0: @@ -3914,6 +3965,7 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true + dev: true optional: true /@esbuild/win32-ia32@0.20.0: @@ -3948,6 +4000,7 @@ packages: cpu: [x64] os: [win32] requiresBuild: true + dev: true optional: true /@esbuild/win32-x64@0.20.0: @@ -4300,7 +4353,7 @@ packages: dependencies: '@formatjs/icu-messageformat-parser': 2.9.4 '@types/json-stable-stringify': 1.1.0 - '@types/node': 22.9.0 + '@types/node': 18.15.13 chalk: 4.1.2 json-stable-stringify: 1.1.1 tslib: 2.8.1 @@ -7319,7 +7372,7 @@ packages: react-refresh: 0.14.0 schema-utils: 3.3.0 source-map: 0.7.4 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /@pnpm/config.env-replace@1.1.0: resolution: {integrity: sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w==} @@ -9206,12 +9259,6 @@ packages: undici-types: 6.19.8 dev: true - /@types/node@22.9.0: - resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==} - dependencies: - undici-types: 6.19.8 - dev: true - /@types/node@8.10.66: resolution: {integrity: sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==} @@ -9612,6 +9659,7 @@ packages: typescript: 5.3.3 transitivePeerDependencies: - supports-color + dev: true /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.1)(typescript@5.6.3): resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} @@ -9640,7 +9688,6 @@ packages: transitivePeerDependencies: - supports-color dev: false - optional: true /@typescript-eslint/eslint-plugin@8.15.0(@typescript-eslint/parser@8.15.0)(eslint@9.14.0)(typescript@5.6.3): resolution: {integrity: sha512-+zkm9AR1Ds9uLWN3fkoeXgFppaQ+uEVtfOV62dDmsy9QCNqlRHWNEck4yarvRNrvRcHQLGfqBNui3cimoz8XAg==} @@ -9808,6 +9855,7 @@ packages: typescript: 5.3.3 transitivePeerDependencies: - supports-color + dev: true /@typescript-eslint/type-utils@5.62.0(eslint@8.57.1)(typescript@5.6.3): resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==} @@ -9985,6 +10033,7 @@ packages: transitivePeerDependencies: - supports-color - typescript + dev: true /@typescript-eslint/utils@5.62.0(eslint@8.57.1)(typescript@5.6.3): resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} @@ -11977,7 +12026,7 @@ packages: loader-utils: 2.0.4 make-dir: 3.1.0 schema-utils: 2.7.1 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /babel-plugin-add-module-exports@1.0.4: resolution: {integrity: sha512-g+8yxHUZ60RcyaUpfNzy56OtWW+x9cyEe9j+CranqLiqbju2yf/Cy6ZtYK40EZxtrdHllzlVZgLmcOUCTlJ7Jg==} @@ -12083,7 +12132,7 @@ packages: '@babel/core': 7.24.4 '@babel/runtime': 7.24.4 '@babel/types': 7.24.0 - gatsby: 5.13.3(babel-eslint@10.1.0)(esbuild@0.19.12)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3) + gatsby: 5.13.3(babel-eslint@10.1.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.6.3) gatsby-core-utils: 4.13.1 dev: false @@ -13855,7 +13904,7 @@ packages: postcss-value-parser: 4.2.0 schema-utils: 3.3.0 semver: 7.6.3 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /css-minimizer-webpack-plugin@2.0.0(webpack@5.91.0): resolution: {integrity: sha512-cG/uc94727tx5pBNtb1Sd7gvUPzwmcQi1lkpfqTpdkuNq75hJCw7bIVsCNijLm4dhDcr1atvuysl2rZqOG8Txw==} @@ -13877,7 +13926,7 @@ packages: schema-utils: 3.3.0 serialize-javascript: 5.0.1 source-map: 0.6.1 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /css-select@4.3.0: resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==} @@ -16040,6 +16089,7 @@ packages: '@esbuild/win32-arm64': 0.19.12 '@esbuild/win32-ia32': 0.19.12 '@esbuild/win32-x64': 0.19.12 + dev: true /esbuild@0.20.0: resolution: {integrity: sha512-6iwE3Y2RVYCME1jLpBqq7LQWK3MW6vjV2bZy6gt/WrqkY+WE74Spyc0ThAOYpMtITvnjX09CrC6ym7A/m9mebA==} @@ -16232,6 +16282,44 @@ packages: eslint-plugin-react: 7.37.2(eslint@8.57.1) eslint-plugin-react-hooks: 4.6.0(eslint@8.57.1) typescript: 5.3.3 + dev: true + + /eslint-config-react-app@6.0.0(@typescript-eslint/eslint-plugin@5.62.0)(@typescript-eslint/parser@5.62.0)(babel-eslint@10.1.0)(eslint-plugin-flowtype@5.10.0)(eslint-plugin-import@2.31.0)(eslint-plugin-jsx-a11y@6.8.0)(eslint-plugin-react-hooks@4.6.0)(eslint-plugin-react@7.37.2)(eslint@7.32.0)(typescript@5.6.3): + resolution: {integrity: sha512-bpoAAC+YRfzq0dsTk+6v9aHm/uqnDwayNAXleMypGl6CpxI9oXXscVHo4fk3eJPIn+rsbtNetB4r/ZIidFIE8A==} + engines: {node: ^10.12.0 || >=12.0.0} + peerDependencies: + '@typescript-eslint/eslint-plugin': ^4.0.0 + '@typescript-eslint/parser': ^4.0.0 + babel-eslint: ^10.0.0 + eslint: ^7.5.0 + eslint-plugin-flowtype: ^5.2.0 + eslint-plugin-import: ^2.22.0 + eslint-plugin-jest: ^24.0.0 + eslint-plugin-jsx-a11y: ^6.3.1 + eslint-plugin-react: ^7.20.3 + eslint-plugin-react-hooks: ^4.0.8 + eslint-plugin-testing-library: ^3.9.0 + typescript: '*' + peerDependenciesMeta: + eslint-plugin-jest: + optional: true + eslint-plugin-testing-library: + optional: true + typescript: + optional: true + dependencies: + '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.1)(typescript@5.6.3) + '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.6.3) + babel-eslint: 10.1.0(eslint@8.57.1) + confusing-browser-globals: 1.0.11 + eslint: 7.32.0 + eslint-plugin-flowtype: 5.10.0(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.1) + eslint-plugin-jsx-a11y: 6.8.0(eslint@8.57.1) + eslint-plugin-react: 7.37.2(eslint@8.57.1) + eslint-plugin-react-hooks: 4.6.0(eslint@8.57.1) + typescript: 5.6.3 + dev: false /eslint-define-config@2.1.0: resolution: {integrity: sha512-QUp6pM9pjKEVannNAbSJNeRuYwW3LshejfyBBpjeMGaJjaDUpVps4C6KVR8R7dWZnD3i0synmrE36znjTkJvdQ==} @@ -16268,7 +16356,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.3.3) + '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.6.3) debug: 3.2.7 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 @@ -16419,7 +16507,7 @@ packages: optional: true dependencies: '@rtsao/scc': 1.1.0 - '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.3.3) + '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.6.3) array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 array.prototype.flat: 1.3.2 @@ -16775,7 +16863,7 @@ packages: micromatch: 4.0.5 normalize-path: 3.0.0 schema-utils: 3.3.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /eslint@7.32.0: resolution: {integrity: sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==} @@ -17592,7 +17680,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /file-system-cache@2.3.0: resolution: {integrity: sha512-l4DMNdsIPsVnKrgEXbJwDJsA5mB8rGwHYERMgqQx/xAUtChPJMre1bXBzDEqqVbWv9AIbFezXMxeEkZDSrXUOQ==} @@ -17939,6 +18027,7 @@ packages: tapable: 1.1.3 typescript: 5.3.3 webpack: 5.91.0(esbuild@0.19.12) + dev: true /fork-ts-checker-webpack-plugin@6.5.3(eslint@7.32.0)(typescript@5.6.3)(webpack@5.91.0): resolution: {integrity: sha512-SbH/l9ikmMWycd5puHJKTkZJKddF4iRLyW3DeZ08HTI7NGyLS38MXd/KGgeWumQO7YNQbW2u/NtPT2YowbPaGQ==} @@ -18246,7 +18335,7 @@ packages: dependencies: '@types/node-fetch': 2.6.11 fs-extra: 9.1.0 - gatsby: 5.13.3(babel-eslint@10.1.0)(esbuild@0.19.12)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3) + gatsby: 5.13.3(babel-eslint@10.1.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.6.3) lodash: 4.17.21 node-fetch: 2.7.0 p-queue: 6.6.2 @@ -18423,7 +18512,7 @@ packages: chokidar: 3.6.0 fs-exists-cached: 1.0.0 fs-extra: 11.2.0 - gatsby: 5.13.3(babel-eslint@10.1.0)(esbuild@0.19.12)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3) + gatsby: 5.13.3(babel-eslint@10.1.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.6.3) gatsby-core-utils: 4.13.1 gatsby-page-utils: 3.13.1 gatsby-plugin-utils: 4.13.1(gatsby@5.13.3)(graphql@16.8.1) @@ -18492,7 +18581,7 @@ packages: debug: 4.3.4 filenamify: 4.3.0 fs-extra: 11.2.0 - gatsby: 5.13.3(babel-eslint@10.1.0)(esbuild@0.19.12)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3) + gatsby: 5.13.3(babel-eslint@10.1.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.6.3) gatsby-core-utils: 4.13.1 gatsby-plugin-utils: 4.13.1(gatsby@5.13.3)(graphql@16.8.1) lodash: 4.17.21 @@ -18551,7 +18640,7 @@ packages: '@babel/preset-typescript': 7.24.1(@babel/core@7.24.4) '@babel/runtime': 7.24.4 babel-plugin-remove-graphql-queries: 5.13.1(@babel/core@7.24.4)(gatsby@5.13.3) - gatsby: 5.13.3(babel-eslint@10.1.0)(esbuild@0.19.12)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3) + gatsby: 5.13.3(babel-eslint@10.1.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.6.3) transitivePeerDependencies: - supports-color dev: false @@ -18589,7 +18678,7 @@ packages: '@babel/runtime': 7.24.4 fastq: 1.17.1 fs-extra: 11.2.0 - gatsby: 5.13.3(babel-eslint@10.1.0)(esbuild@0.19.12)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3) + gatsby: 5.13.3(babel-eslint@10.1.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.6.3) gatsby-core-utils: 4.13.1 gatsby-sharp: 1.13.0 graphql: 16.8.1 @@ -19116,7 +19205,7 @@ packages: - webpack-hot-middleware - webpack-plugin-serve - /gatsby@5.13.3(babel-eslint@10.1.0)(esbuild@0.19.12)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3): + /gatsby@5.13.3(babel-eslint@10.1.0)(react-dom@18.2.0)(react@18.2.0)(typescript@5.6.3): resolution: {integrity: sha512-SSnGpjswK20BQORcvTbtK8eI+W4QUG+u8rdVswB4suva6BfvTakW2wiktj7E2MdO4NjRvlgJjF5dUUncU5nldA==} engines: {node: '>=18.0.0'} hasBin: true @@ -19150,8 +19239,8 @@ packages: '@pmmmwh/react-refresh-webpack-plugin': 0.5.11(react-refresh@0.14.0)(webpack@5.91.0) '@sigmacomputing/babel-plugin-lodash': 3.3.5 '@types/http-proxy': 1.17.14 - '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.1)(typescript@5.3.3) - '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.3.3) + '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.1)(typescript@5.6.3) + '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.6.3) '@vercel/webpack-asset-relocator-loader': 1.7.3 acorn-loose: 8.4.0 acorn-walk: 8.3.2 @@ -19189,7 +19278,7 @@ packages: enhanced-resolve: 5.16.0 error-stack-parser: 2.1.4 eslint: 7.32.0 - eslint-config-react-app: 6.0.0(@typescript-eslint/eslint-plugin@5.62.0)(@typescript-eslint/parser@5.62.0)(babel-eslint@10.1.0)(eslint-plugin-flowtype@5.10.0)(eslint-plugin-import@2.31.0)(eslint-plugin-jsx-a11y@6.8.0)(eslint-plugin-react-hooks@4.6.0)(eslint-plugin-react@7.37.2)(eslint@7.32.0)(typescript@5.3.3) + eslint-config-react-app: 6.0.0(@typescript-eslint/eslint-plugin@5.62.0)(@typescript-eslint/parser@5.62.0)(babel-eslint@10.1.0)(eslint-plugin-flowtype@5.10.0)(eslint-plugin-import@2.31.0)(eslint-plugin-jsx-a11y@6.8.0)(eslint-plugin-react-hooks@4.6.0)(eslint-plugin-react@7.37.2)(eslint@7.32.0)(typescript@5.6.3) eslint-plugin-flowtype: 5.10.0(eslint@8.57.1) eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.1) eslint-plugin-jsx-a11y: 6.8.0(eslint@8.57.1) @@ -19263,7 +19352,7 @@ packages: query-string: 6.14.1 raw-loader: 4.0.2(webpack@5.91.0) react: 18.2.0 - react-dev-utils: 12.0.1(eslint@7.32.0)(typescript@5.3.3)(webpack@5.91.0) + react-dev-utils: 12.0.1(eslint@7.32.0)(typescript@5.6.3)(webpack@5.91.0) react-dom: 18.2.0(react@18.2.0) react-refresh: 0.14.0 react-server-dom-webpack: 0.0.0-experimental-c8b778b7f-20220825(react@18.2.0)(webpack@5.91.0) @@ -19281,13 +19370,13 @@ packages: strip-ansi: 6.0.1 style-loader: 2.0.0(webpack@5.91.0) style-to-object: 0.4.4 - terser-webpack-plugin: 5.3.10(esbuild@0.19.12)(webpack@5.91.0) + terser-webpack-plugin: 5.3.10(webpack@5.91.0) tmp: 0.2.3 true-case-path: 2.2.1 type-of: 2.0.1 url-loader: 4.1.1(file-loader@6.2.0)(webpack@5.91.0) uuid: 8.3.2 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 webpack-dev-middleware: 4.3.0(webpack@5.91.0) webpack-merge: 5.10.0 webpack-stats-plugin: 1.1.3 @@ -24303,7 +24392,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 webpack-sources: 1.4.3 /mini-svg-data-uri@1.4.4: @@ -25167,7 +25256,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /nullthrows@1.1.1: resolution: {integrity: sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==} @@ -26420,7 +26509,7 @@ packages: klona: 2.0.6 postcss: 8.4.49 semver: 7.6.3 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 dev: false /postcss-merge-longhand@5.1.7(postcss@8.4.38): @@ -27397,7 +27486,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /rbush@3.0.1: resolution: {integrity: sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==} @@ -27522,6 +27611,7 @@ packages: - eslint - supports-color - vue-template-compiler + dev: true /react-dev-utils@12.0.1(eslint@7.32.0)(typescript@5.6.3)(webpack@5.91.0): resolution: {integrity: sha512-84Ivxmr17KjUupyqzFode6xKhjwuEJDROWKJy/BthkL7Wn6NJ8h4WE6k/exAv6ImS+0oZLRRW5j/aINMHyeGeQ==} @@ -27927,7 +28017,7 @@ packages: loose-envify: 1.4.0 neo-async: 2.6.2 react: 18.2.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /react-server-dom-webpack@19.0.0-rc.0(react-dom@18.2.0)(react@18.2.0)(webpack@5.91.0): resolution: {integrity: sha512-nnSBQnXKEgfgSx6veKJg3TdRmRyn+tyOuKwKdHCI1SuR+WL2JLDM+NfZrP5DFie7w5ZCNTjS/LdACV4YuRuxDg==} @@ -30331,7 +30421,7 @@ packages: dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /style-to-object@0.3.0: resolution: {integrity: sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==} @@ -30733,6 +30823,7 @@ packages: serialize-javascript: 6.0.2 terser: 5.30.3 webpack: 5.91.0(esbuild@0.19.12) + dev: true /terser-webpack-plugin@5.3.10(webpack@5.91.0): resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==} @@ -31975,7 +32066,7 @@ packages: loader-utils: 2.0.4 mime-types: 2.1.35 schema-utils: 3.3.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /url@0.11.3: resolution: {integrity: sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==} @@ -33042,7 +33133,7 @@ packages: mime-types: 2.1.35 range-parser: 1.2.1 schema-utils: 3.3.0 - webpack: 5.91.0(esbuild@0.19.12) + webpack: 5.91.0 /webpack-merge@5.10.0: resolution: {integrity: sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==} @@ -33228,6 +33319,7 @@ packages: - '@swc/core' - esbuild - uglify-js + dev: true /website-scraper@5.3.1: resolution: {integrity: sha512-gogqPXD2gVsxoyd2yRiympw3rA5GuEpD1CaDEJ/J8zzanx7hkbTtneoO1SGs436PpLbWVcUge+6APGLhzsuZPA==} diff --git a/tests/e2e-basic/.gitignore b/tests/e2e-basic/.gitignore new file mode 100644 index 000000000..967ffade7 --- /dev/null +++ b/tests/e2e-basic/.gitignore @@ -0,0 +1,2 @@ +/test-results +/playwright-report diff --git a/tests/e2e-basic/README.md b/tests/e2e-basic/README.md new file mode 100644 index 000000000..92ba1a660 --- /dev/null +++ b/tests/e2e-basic/README.md @@ -0,0 +1,13 @@ +# Basic end-to-end tests + +This package is preserved in the cloned projects. It performs very basic e2e +tests ensuring that all apps work. + +It is recommended to + +- Have just one test per app +- Keep tests minimal +- Make tests project-agnostic +- Not add new tests unless + - It's needed for a new app + - It's a test for a critical feature diff --git a/tests/e2e-basic/eslint.config.mjs b/tests/e2e-basic/eslint.config.mjs new file mode 100644 index 000000000..fba5a4b5b --- /dev/null +++ b/tests/e2e-basic/eslint.config.mjs @@ -0,0 +1,8 @@ +import { base, defineConfig } from '@custom/eslint-config'; + +export default defineConfig([ + ...base, + { + ignores: ['playwright-report/**', 'test-results/**'], + }, +]); diff --git a/tests/e2e-basic/package.json b/tests/e2e-basic/package.json new file mode 100644 index 000000000..2ea1c8d66 --- /dev/null +++ b/tests/e2e-basic/package.json @@ -0,0 +1,22 @@ +{ + "name": "@custom-tests/e2e-basic", + "version": "1.0.0", + "description": "A very basic e2e test suite.", + "type": "module", + "scripts": { + "test:static": "tsc --noEmit && eslint . --quiet", + "test:integration": "playwright install chromium && playwright test", + "test:headed": "playwright install chromium && playwright test --headed" + }, + "devDependencies": { + "@custom/cms": "workspace:*", + "@custom/decap": "workspace:*", + "@custom/eslint-config": "workspace:*", + "@custom/preview": "workspace:*", + "@custom/publisher": "workspace:*", + "@custom/website": "workspace:*", + "@playwright/test": "^1.44.1", + "@types/node": "^18", + "typescript": "^5.3.3" + } +} diff --git a/tests/e2e-basic/playwright.config.ts b/tests/e2e-basic/playwright.config.ts new file mode 100644 index 000000000..0b68a4ee7 --- /dev/null +++ b/tests/e2e-basic/playwright.config.ts @@ -0,0 +1,43 @@ +import { defineConfig, devices } from '@playwright/test'; + +export default defineConfig({ + retries: process.env.CI ? 2 : 0, + workers: 1, + reporter: 'html', + use: { + trace: process.env.CI ? 'retain-on-failure' : 'on', + actionTimeout: 10_000, + }, + webServer: [ + { + command: 'pnpm run --filter "@custom/cms" dev >> /tmp/cms.log 2>&1', + port: 8888, + reuseExistingServer: !process.env.CI, + }, + { + command: + 'pnpm run --filter "@custom/publisher" dev >> /tmp/website.log 2>&1', + port: 8000, + reuseExistingServer: !process.env.CI, + }, + { + command: + 'pnpm run --filter "@custom/preview" start >> /tmp/preview.log 2>&1', + port: 8001, + reuseExistingServer: !process.env.CI, + }, + ], + testDir: './specs', + projects: [ + { + name: 'setup', + testMatch: /setup\.ts/, + }, + { + name: 'chromium', + testMatch: /\.*.spec\.ts/, + use: { ...devices['Desktop Chrome'] }, + dependencies: ['setup'], + }, + ], +}); diff --git a/tests/e2e-basic/specs/cms.spec.ts b/tests/e2e-basic/specs/cms.spec.ts new file mode 100644 index 000000000..89a93206a --- /dev/null +++ b/tests/e2e-basic/specs/cms.spec.ts @@ -0,0 +1,6 @@ +import { expect, test } from '@playwright/test'; + +test('cms', async ({ page }) => { + await page.goto('http://127.0.0.1:8888'); + await expect(page.getByRole('button', { name: 'Log in' })).toBeVisible(); +}); diff --git a/tests/e2e-basic/specs/decap.spec.ts b/tests/e2e-basic/specs/decap.spec.ts new file mode 100644 index 000000000..7bb176742 --- /dev/null +++ b/tests/e2e-basic/specs/decap.spec.ts @@ -0,0 +1,9 @@ +import { expect, test } from '@playwright/test'; + +test('decap', async ({ page }) => { + await page.goto('http://127.0.0.1:8000/admin'); + await page.getByRole('button', { name: 'Login' }).click(); + await expect( + page.getByRole('heading', { name: 'Collections' }), + ).toBeVisible(); +}); diff --git a/tests/e2e-basic/specs/preview.spec.ts b/tests/e2e-basic/specs/preview.spec.ts new file mode 100644 index 000000000..466694257 --- /dev/null +++ b/tests/e2e-basic/specs/preview.spec.ts @@ -0,0 +1,17 @@ +import { expect, test } from '@playwright/test'; + +test('preview', async ({ page }) => { + // Login. + await page.goto('http://127.0.0.1:8888'); + await page.getByLabel('Username').fill('admin'); + await page.getByLabel('Password').fill('admin'); + await page.getByRole('button', { name: 'Log in' }).click(); + // Check the Imprint page preview. + await page.goto('http://127.0.0.1:8888/imprint'); + await expect( + page + .frameLocator('iframe') + .first() + .getByRole('heading', { name: 'Imprint', exact: true }), + ).toBeVisible(); +}); diff --git a/tests/e2e-basic/specs/publisher.spec.ts b/tests/e2e-basic/specs/publisher.spec.ts new file mode 100644 index 000000000..ebffa943f --- /dev/null +++ b/tests/e2e-basic/specs/publisher.spec.ts @@ -0,0 +1,5 @@ +import { test } from '@playwright/test'; + +test('publisher', async () => { + // Publisher is checked in the setup.ts. +}); diff --git a/tests/e2e-basic/specs/setup.ts b/tests/e2e-basic/specs/setup.ts new file mode 100644 index 000000000..1a59b5438 --- /dev/null +++ b/tests/e2e-basic/specs/setup.ts @@ -0,0 +1,35 @@ +import { expect, test } from '@playwright/test'; + +const attemptDelay = 1000 * 5; +const netlifyBootTimeout = 1000 * 60 * 2; +const websiteBuildTimeout = 1000 * 60 * 2; + +test.setTimeout(websiteBuildTimeout + netlifyBootTimeout + 10_000); + +test('setup', async ({ page }) => { + // Wait for Publisher to build the website. + await page.goto('http://127.0.0.1:8000/___status'); + await expect(page.getByText('Status: Ready')).toBeVisible({ + timeout: websiteBuildTimeout, + }); + + // Wait for Netlify to boot. + // When "netlify dev" starts, the port check reports it's working, yet the + // first page load takes a long time - Netlify downloads Deno and packages + // (sometimes at a very slow speed). Nothing really works until this is done. + // This might fail tests. So we try to load the website frontpage first. + let success = false; + const timeoutId = setTimeout(() => { + throw new Error( + `"netlify dev" failed to start in ${netlifyBootTimeout}ms. Check /tmp/website.log for details.`, + ); + }, netlifyBootTimeout); + while (!success) { + try { + await page.goto('http://127.0.0.1:8000', { timeout: attemptDelay }); + clearTimeout(timeoutId); + success = true; + // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-empty + } catch (e) {} + } +}); diff --git a/tests/e2e-basic/specs/website.spec.ts b/tests/e2e-basic/specs/website.spec.ts new file mode 100644 index 000000000..707a5d600 --- /dev/null +++ b/tests/e2e-basic/specs/website.spec.ts @@ -0,0 +1,7 @@ +import { expect, test } from '@playwright/test'; + +test('website', async ({ page }) => { + await page.goto('http://127.0.0.1:8000'); + await expect(page.locator('h1')).toBeVisible(); + await expect(page.getByText(/error/i)).not.toBeVisible(); +}); diff --git a/tests/e2e-basic/tsconfig.json b/tests/e2e-basic/tsconfig.json new file mode 100644 index 000000000..c13ef64e3 --- /dev/null +++ b/tests/e2e-basic/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "strict": true, + "skipLibCheck": true + } +} diff --git a/tests/e2e-basic/turbo.json b/tests/e2e-basic/turbo.json new file mode 100644 index 000000000..d70f91ee2 --- /dev/null +++ b/tests/e2e-basic/turbo.json @@ -0,0 +1,12 @@ +{ + "extends": ["//"], + "tasks": { + "test:static": { + "inputs": ["specs/**", "playwright.config.ts"] + }, + "test:integration": { + "dependsOn": ["^prep"], + "inputs": ["specs/**", "playwright.config.ts"] + } + } +} diff --git a/tests/e2e/README.md b/tests/e2e/README.md new file mode 100644 index 000000000..3b2411feb --- /dev/null +++ b/tests/e2e/README.md @@ -0,0 +1,4 @@ +# End-to-end tests for the template + +This package is deleted in the cloned projects. It is used to test the template +itself, not the cloned projects. diff --git a/tests/e2e/specs/decap/admin.spec.ts b/tests/e2e/specs/decap/admin.spec.ts deleted file mode 100644 index df5118eef..000000000 --- a/tests/e2e/specs/decap/admin.spec.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { expect, test } from '@playwright/test'; - -import { websiteUrl } from '../../helpers/url'; - -test('decap admin is available', async ({ page }) => { - const response = await page.goto(websiteUrl('/admin')); - expect(response?.status()).toBe(200); -});