diff --git a/package.json b/package.json index d33c6fe3ff..5df248f467 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "lint-staged": "^14.0.1", "minimist": "1.2.8", "mongodb-memory-server": "^9.0", - "next": "14.2.0-canary.22", + "next": "^14.2", "node-mocks-http": "^1.14.1", "nodemon": "3.0.3", "open": "^10.1.0", diff --git a/packages/next/package.json b/packages/next/package.json index cae7193813..b11117709b 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -77,7 +77,7 @@ }, "peerDependencies": { "http-status": "1.6.2", - "next": "14.2.0-canary.23", + "next": "^14.2", "payload": "workspace:*" }, "publishConfig": { diff --git a/packages/plugin-seo/src/index.tsx b/packages/plugin-seo/src/index.tsx index 16e5de9aab..c953ab21ff 100644 --- a/packages/plugin-seo/src/index.tsx +++ b/packages/plugin-seo/src/index.tsx @@ -45,7 +45,7 @@ const seo = Field: (props) => ( ), }, @@ -62,7 +62,7 @@ const seo = ), @@ -82,7 +82,7 @@ const seo = Field: (props) => ( ), }, @@ -105,7 +105,7 @@ const seo = Field: (props) => ( ), }, @@ -194,11 +194,12 @@ const seo = return collection }) || [], endpoints: [ + ...config.endpoints, { handler: async (req) => { const args: Parameters[0] = req.data as unknown as Parameters[0] - const result = await pluginConfig.generateTitle(args) + const result = pluginConfig.generateTitle ? await pluginConfig.generateTitle(args) : '' return new Response(JSON.stringify({ result }), { status: 200 }) }, method: 'post', @@ -208,7 +209,9 @@ const seo = handler: async (req) => { const args: Parameters[0] = req.data as unknown as Parameters[0] - const result = await pluginConfig.generateDescription(args) + const result = pluginConfig.generateDescription + ? await pluginConfig.generateDescription(args) + : '' return new Response(JSON.stringify({ result }), { status: 200 }) }, method: 'post', @@ -218,7 +221,7 @@ const seo = handler: async (req) => { const args: Parameters[0] = req.data as unknown as Parameters[0] - const result = await pluginConfig.generateURL(args) + const result = pluginConfig.generateURL ? await pluginConfig.generateURL(args) : '' return new Response(JSON.stringify({ result }), { status: 200 }) }, method: 'post', @@ -228,7 +231,7 @@ const seo = handler: async (req) => { const args: Parameters[0] = req.data as unknown as Parameters[0] - const result = await pluginConfig.generateImage(args) + const result = pluginConfig.generateImage ? await pluginConfig.generateImage(args) : '' return new Response(result, { status: 200 }) }, method: 'post', diff --git a/packages/ui/package.json b/packages/ui/package.json index 980914afa4..cbeed10dba 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -216,7 +216,7 @@ "uuid": "9.0.1" }, "peerDependencies": { - "next": "14.2.0-canary.23", + "next": "^14.2", "payload": "workspace:*", "react": "^18.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c72fe9817a..47b2c0c255 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -200,8 +200,8 @@ importers: specifier: ^9.0 version: 9.1.8 next: - specifier: 14.2.0-canary.22 - version: 14.2.0-canary.22(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0) + specifier: ^14.2 + version: 14.2.0(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1) node-mocks-http: specifier: ^1.14.1 version: 1.14.1 @@ -628,8 +628,8 @@ importers: specifier: 1.6.2 version: 1.6.2 next: - specifier: 14.2.0-canary.23 - version: 14.2.0-canary.23(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1) + specifier: ^14.2 + version: 14.2.0(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1) path-to-regexp: specifier: ^6.2.1 version: 6.2.2 @@ -1397,8 +1397,8 @@ importers: specifier: 2.3.0 version: 2.3.0 next: - specifier: 14.2.0-canary.23 - version: 14.2.0-canary.23(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1) + specifier: ^14.2 + version: 14.2.0(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1) object-to-formdata: specifier: 4.5.1 version: 4.5.1 @@ -4539,13 +4539,8 @@ packages: - utf-8-validate dev: true - /@next/env@14.2.0-canary.22: - resolution: {integrity: sha512-c72nBWQcgDwc711vtF0juZ81WPEHJbj22QzEkaqaS2cJty9IiyXTVTVzJHA1dueN9fDFCH3BeWDxoVn4y7MO8A==} - dev: true - - /@next/env@14.2.0-canary.23: - resolution: {integrity: sha512-cBlFB8Y/iE3K2NX/Km4tP4RZGLsv0D72KI9KxmZepKSkaQBSbtHM0YeHnZ51CFe9UQKzQ/1mPnCY89BjiyIQtQ==} - dev: false + /@next/env@14.2.0: + resolution: {integrity: sha512-4+70ELtSbRtYUuyRpAJmKC8NHBW2x1HMje9KO2Xd7IkoyucmV9SjgO+qeWMC0JWkRQXgydv1O7yKOK8nu/rITQ==} /@next/eslint-plugin-next@14.1.4: resolution: {integrity: sha512-n4zYNLSyCo0Ln5b7qxqQeQ34OZKXwgbdcx6kmkQbywr+0k6M3Vinft0T72R6CDAcDrne2IAgSud4uWCzFgc5HA==} @@ -4553,166 +4548,76 @@ packages: glob: 10.3.10 dev: true - /@next/swc-darwin-arm64@14.2.0-canary.22: - resolution: {integrity: sha512-aMU93w01wjqi5kfCS7Khot+lRvEtKxNrRv3KuQpXYrSaVCytMBqVwiyugo3IF5FPNuO0kMk90Wct4gxHE9jIGw==} + /@next/swc-darwin-arm64@14.2.0: + resolution: {integrity: sha512-kHktLlw0AceuDnkVljJ/4lTJagLzDiO3klR1Fzl2APDFZ8r+aTxNaNcPmpp0xLMkgRwwk6sggYeqq0Rz9K4zzA==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true - /@next/swc-darwin-arm64@14.2.0-canary.23: - resolution: {integrity: sha512-K1f7A/0ljZO7IX+M+phguFP8lxdqMgEv1x1+gC+UmyZ1c8Na1PgirGgUwdLKxuNjyxlRqY5lkQ/FDk2FOYBSLA==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: false - optional: true - - /@next/swc-darwin-x64@14.2.0-canary.22: - resolution: {integrity: sha512-188vbCauuryRk+ePTK6YJ5r+1tzDKVFeZmDK/1BHOeGqDUtzYqY0N+08iY4Nyg4rHb8OBO4CONfRSOTzGJw+Pg==} + /@next/swc-darwin-x64@14.2.0: + resolution: {integrity: sha512-HFSDu7lb1U3RDxXNeKH3NGRR5KyTPBSUTuIOr9jXoAso7i76gNYvnTjbuzGVWt2X5izpH908gmOYWtI7un+JrA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true - /@next/swc-darwin-x64@14.2.0-canary.23: - resolution: {integrity: sha512-3Zg0aZZV9Z0+4QCVNMH/LLW1dRD2mVNtuFBoTI6/7rWUiGrm/9+58sKyjjg+cE9S/zAKvJoFZP7Ask9vnrk4tg==} - engines: {node: '>= 10'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: false - optional: true - - /@next/swc-linux-arm64-gnu@14.2.0-canary.22: - resolution: {integrity: sha512-RzKik7qYGzW2+UIw0SALjfsVqTF4iO5m8otBBz0Rst5poBtjPtY7Wkp362Y69g2BoNM03tG/QhsM3HGyoGKwQQ==} + /@next/swc-linux-arm64-gnu@14.2.0: + resolution: {integrity: sha512-iQsoWziO5ZMxDWZ4ZTCAc7hbJ1C9UDj/gATSqTaMjW2bJFwAsvf9UM79AKnljBl73uPZ+V0kH4rvnHTco4Ps2w==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true - /@next/swc-linux-arm64-gnu@14.2.0-canary.23: - resolution: {integrity: sha512-OMt5uTXtEZNKaeSvviJQVXzARr3Jyk1BKUQVD10hKUa4edWBcmnrpdqiDVoDCGt9kMOdKdGqJHOJUk/jV/G15w==} + /@next/swc-linux-arm64-musl@14.2.0: + resolution: {integrity: sha512-0JOk2uzLUt8fJK5LpsKKZa74zAch7bJjjgJzR9aOMs231AlE4gPYzsSm430ckZitjPGKeH5bgDZjqwqJQKIS2w==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] requiresBuild: true - dev: false optional: true - /@next/swc-linux-arm64-musl@14.2.0-canary.22: - resolution: {integrity: sha512-u7egrTZPX+xHMc07bpICwb79omVC8oEjClOJrf2zsqExXaem2AzkGOeK6P+vPKwXOQ1dbTsdbEoYI02BCpUvmQ==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@next/swc-linux-arm64-musl@14.2.0-canary.23: - resolution: {integrity: sha512-vllciUQ4U99LCOBnsFt9QGf9AyE8yhBtNdNxbij5QsdQ/F53SamxrbYOgG7RisvRqFmWSQMfHdpGZOE0EUUsvQ==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: false - optional: true - - /@next/swc-linux-x64-gnu@14.2.0-canary.22: - resolution: {integrity: sha512-9cHF5tVln5yGGZJIbbRtKj0dCRB+ySnQa6/xS6e6Obe//+M8hpIuzYUJFbb7LIyAs5TL0pVs1wiFLilyZGWqtA==} + /@next/swc-linux-x64-gnu@14.2.0: + resolution: {integrity: sha512-uYHkuTzX0NM6biKNp7hdKTf+BF0iMV254SxO0B8PgrQkxUBKGmk5ysHKB+FYBfdf9xei/t8OIKlXJs9ckD943A==} engines: {node: '>= 10'} cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true - /@next/swc-linux-x64-gnu@14.2.0-canary.23: - resolution: {integrity: sha512-soKCxTCi0m0hOBSEchH2YTluvQzAEb8HIoQXxligU8C1fmFDX25pwQ4iSWmdvA6xDJn96PG2R64NyytTTMg9TQ==} + /@next/swc-linux-x64-musl@14.2.0: + resolution: {integrity: sha512-paN89nLs2dTBDtfXWty1/NVPit+q6ldwdktixYSVwiiAz647QDCd+EIYqoiS+/rPG3oXs/A7rWcJK9HVqfnMVg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] requiresBuild: true - dev: false optional: true - /@next/swc-linux-x64-musl@14.2.0-canary.22: - resolution: {integrity: sha512-tr/on4bRNu5uua86CnBVAoz7sYyoPn4n5k04hwlcHDVg08pi/DhmqPp1d7oJCSb7rY6imH3nSMqNqoAVROT2VQ==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@next/swc-linux-x64-musl@14.2.0-canary.23: - resolution: {integrity: sha512-Qr+4ySSYEh1hSSmUJ50oHtKopkqwo3RFb2CXpzcMqp+6U8WOMYBX+JTSCFdA3lSlUJqScIgoRoMDk9I3TZM71g==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: false - optional: true - - /@next/swc-win32-arm64-msvc@14.2.0-canary.22: - resolution: {integrity: sha512-H8cvi02H8uk9a1ZvtTpsaC8yxfKRFCgi8G/dMMknzHbepOMcYLa0tUJmGqDWklWZY8RnuupNqJIt/MhLmSdoTA==} + /@next/swc-win32-arm64-msvc@14.2.0: + resolution: {integrity: sha512-j1oiidZisnymYjawFqEfeGNcE22ZQ7lGUaa4pGOCVWrWeIDkPSj8zYgS9TzMNlg17Q3wSWCQC/F5uJAhSh7qcA==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true - /@next/swc-win32-arm64-msvc@14.2.0-canary.23: - resolution: {integrity: sha512-94HGrBqz9s7z6d6hlukbkF4LiU4Bw+a+C3i+J7pBA+3BHtIyffuqmnrP3HY92trP3M328GBN01H7/zqahcvwPQ==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: false - optional: true - - /@next/swc-win32-ia32-msvc@14.2.0-canary.22: - resolution: {integrity: sha512-s8Jdg0CUp3OL5ccAMliIBzhKwSlwWDDSypjqkKcEVINnzJexgl7ymrCMzZWeNO0IOhJxMWaPdMf5xuEsSxBbKg==} + /@next/swc-win32-ia32-msvc@14.2.0: + resolution: {integrity: sha512-6ff6F4xb+QGD1jhx/dOT9Ot7PQ/GAYekV9ykwEh2EFS/cLTyU4Y3cXkX5cNtNIhpctS5NvyjW9gIksRNErYE0A==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true - /@next/swc-win32-ia32-msvc@14.2.0-canary.23: - resolution: {integrity: sha512-lrvn6ekxPyrBidQxA0kE3xyys8fCLlbhi1tl2FA0QUPHvgPbu2127Q7+UFnl/NGC9veZfCbw6b7TVFyvPseRsQ==} - engines: {node: '>= 10'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: false - optional: true - - /@next/swc-win32-x64-msvc@14.2.0-canary.22: - resolution: {integrity: sha512-6MrHjj76CeuYTJnVXyd43OF9fOkBSmDRbkLp+kwa+O1GZmkFZyqRNORdtMWNKbmiFPxfhd+FOgHG9fl1l05gUQ==} + /@next/swc-win32-x64-msvc@14.2.0: + resolution: {integrity: sha512-09DbG5vXAxz0eTFSf1uebWD36GF3D5toynRkgo2AlSrxwGZkWtJ1RhmrczRYQ17eD5bdo4FZ0ibiffdq5kc4vg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] requiresBuild: true - dev: true - optional: true - - /@next/swc-win32-x64-msvc@14.2.0-canary.23: - resolution: {integrity: sha512-T8zZcK8M5GYWzIKOlxcothb0sixdFSowUztZTNb/kmUK8Vz1Z+TFBxU00WvBDx9ymrGP2f4EKL9YQqu2d+BmcA==} - engines: {node: '>= 10'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: false optional: true /@nodelib/fs.scandir@2.1.5: @@ -4818,7 +4723,6 @@ packages: hasBin: true dependencies: playwright: 1.43.0(patch_hash=smjs6qro5qsqddamrqipwrbi5i) - dev: true /@polka/url@1.0.0-next.25: resolution: {integrity: sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==} @@ -9963,7 +9867,6 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true - dev: true optional: true /fsevents@2.3.3: @@ -12364,61 +12267,26 @@ packages: /next-tick@1.1.0: resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} - /next@14.2.0-canary.22(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-nCqEuJLHRFDWpMfcql3D8V88GAGoEeZobxSCgi6ablFWMkzBGgrwZmsJi41OgtJnWwfF/c56MPXAgkFqbBcwyw==} + /next@14.2.0(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1): + resolution: {integrity: sha512-2T41HqJdKPqheR27ll7MFZ3gtTYvGew7cUc0PwPSyK9Ao5vvwpf9bYfP4V5YBGLckHF2kEGvrLte5BqLSv0s8g==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: '@opentelemetry/api': ^1.1.0 + '@playwright/test': ^1.41.2 react: ^18.2.0 react-dom: ^18.2.0 sass: ^1.3.0 peerDependenciesMeta: '@opentelemetry/api': optional: true - sass: - optional: true - dependencies: - '@next/env': 14.2.0-canary.22 - '@swc/helpers': 0.5.5 - busboy: 1.6.0 - caniuse-lite: 1.0.30001607 - graceful-fs: 4.2.11 - postcss: 8.4.31 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - styled-jsx: 5.1.1(@babel/core@7.24.4)(react@18.2.0) - optionalDependencies: - '@next/swc-darwin-arm64': 14.2.0-canary.22 - '@next/swc-darwin-x64': 14.2.0-canary.22 - '@next/swc-linux-arm64-gnu': 14.2.0-canary.22 - '@next/swc-linux-arm64-musl': 14.2.0-canary.22 - '@next/swc-linux-x64-gnu': 14.2.0-canary.22 - '@next/swc-linux-x64-musl': 14.2.0-canary.22 - '@next/swc-win32-arm64-msvc': 14.2.0-canary.22 - '@next/swc-win32-ia32-msvc': 14.2.0-canary.22 - '@next/swc-win32-x64-msvc': 14.2.0-canary.22 - transitivePeerDependencies: - - '@babel/core' - - babel-plugin-macros - dev: true - - /next@14.2.0-canary.23(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1): - resolution: {integrity: sha512-HuQYIeSlmBmTueVIxn0Zjxx5I4MD6vG3p6AsFySTF7/hMSF5qFUCHGIj3YJRWsDcUw/LQhuGPNLaGUg119YegQ==} - engines: {node: '>=18.17.0'} - hasBin: true - peerDependencies: - '@opentelemetry/api': ^1.1.0 - react: ^18.2.0 - react-dom: ^18.2.0 - sass: ^1.3.0 - peerDependenciesMeta: - '@opentelemetry/api': + '@playwright/test': optional: true sass: optional: true dependencies: - '@next/env': 14.2.0-canary.23 + '@next/env': 14.2.0 + '@playwright/test': 1.43.0 '@swc/helpers': 0.5.5 busboy: 1.6.0 caniuse-lite: 1.0.30001607 @@ -12429,19 +12297,18 @@ packages: sass: 1.74.1 styled-jsx: 5.1.1(@babel/core@7.24.4)(react@18.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 14.2.0-canary.23 - '@next/swc-darwin-x64': 14.2.0-canary.23 - '@next/swc-linux-arm64-gnu': 14.2.0-canary.23 - '@next/swc-linux-arm64-musl': 14.2.0-canary.23 - '@next/swc-linux-x64-gnu': 14.2.0-canary.23 - '@next/swc-linux-x64-musl': 14.2.0-canary.23 - '@next/swc-win32-arm64-msvc': 14.2.0-canary.23 - '@next/swc-win32-ia32-msvc': 14.2.0-canary.23 - '@next/swc-win32-x64-msvc': 14.2.0-canary.23 + '@next/swc-darwin-arm64': 14.2.0 + '@next/swc-darwin-x64': 14.2.0 + '@next/swc-linux-arm64-gnu': 14.2.0 + '@next/swc-linux-arm64-musl': 14.2.0 + '@next/swc-linux-x64-gnu': 14.2.0 + '@next/swc-linux-x64-musl': 14.2.0 + '@next/swc-win32-arm64-msvc': 14.2.0 + '@next/swc-win32-ia32-msvc': 14.2.0 + '@next/swc-win32-x64-msvc': 14.2.0 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros - dev: false /node-abi@3.57.0: resolution: {integrity: sha512-Dp+A9JWxRaKuHP35H77I4kCKesDy5HUDEmScia2FyncMTOXASMyg251F5PhFoDA5uqBrDDffiLpbqnrZmNXW+g==} @@ -13111,7 +12978,6 @@ packages: resolution: {integrity: sha512-iWFjyBUH97+pUFiyTqSLd8cDMMOS0r2ZYz2qEsPjH8/bX++sbIJT35MSwKnp1r/OQBAqC5XO99xFbJ9XClhf4w==} engines: {node: '>=16'} hasBin: true - dev: true /playwright@1.43.0(patch_hash=smjs6qro5qsqddamrqipwrbi5i): resolution: {integrity: sha512-SiOKHbVjTSf6wHuGCbqrEyzlm6qvXcv7mENP+OZon1I07brfZLGdfWV0l/efAzVx7TF3Z45ov1gPEkku9q25YQ==} @@ -13121,7 +12987,6 @@ packages: playwright-core: 1.43.0 optionalDependencies: fsevents: 2.3.2 - dev: true patched: true /pluralize@8.0.0: diff --git a/test/access-control/e2e.spec.ts b/test/access-control/e2e.spec.ts index f5a94e91da..e14431dcd1 100644 --- a/test/access-control/e2e.spec.ts +++ b/test/access-control/e2e.spec.ts @@ -5,7 +5,8 @@ import { expect, test } from '@playwright/test' import path from 'path' import { fileURLToPath } from 'url' -import type { ReadOnlyCollection, RestrictedVersion } from './payload-types.js' +import type { PayloadTestSDK } from '../helpers/sdk/index.js' +import type { Config, ReadOnlyCollection, RestrictedVersion } from './payload-types.js' import { closeNav, @@ -17,7 +18,7 @@ import { saveDocAndAssert, } from '../helpers.js' import { AdminUrlUtil } from '../helpers/adminUrlUtil.js' -import { initPayloadE2E } from '../helpers/initPayloadE2E.js' +import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js' import { POLL_TOPASS_TIMEOUT } from '../playwright.config.js' import { docLevelAccessSlug, @@ -40,7 +41,7 @@ const dirname = path.dirname(filename) */ const { beforeAll, describe } = test -let payload: Payload +let payload: PayloadTestSDK describe('access control', () => { let page: Page let url: AdminUrlUtil @@ -50,7 +51,7 @@ describe('access control', () => { let serverURL: string beforeAll(async ({ browser }) => { - ;({ payload, serverURL } = await initPayloadE2E({ dirname })) + ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) url = new AdminUrlUtil(serverURL, slug) restrictedUrl = new AdminUrlUtil(serverURL, restrictedSlug) diff --git a/test/fields-relationship/e2e.spec.ts b/test/fields-relationship/e2e.spec.ts index 7d01c16a8c..922a64ba04 100644 --- a/test/fields-relationship/e2e.spec.ts +++ b/test/fields-relationship/e2e.spec.ts @@ -6,8 +6,10 @@ import path from 'path' import { wait } from 'payload/utilities' import { fileURLToPath } from 'url' +import type { PayloadTestSDK } from '../helpers/sdk/index.js' import type { FieldsRelationship as CollectionWithRelationships, + Config, RelationOne, RelationRestricted, RelationTwo, @@ -23,7 +25,7 @@ import { saveDocAndAssert, } from '../helpers.js' import { AdminUrlUtil } from '../helpers/adminUrlUtil.js' -import { initPayloadE2E } from '../helpers/initPayloadE2E.js' +import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js' import { relationFalseFilterOptionSlug, relationOneSlug, @@ -34,12 +36,13 @@ import { relationWithTitleSlug, slug, } from './collectionSlugs.js' + const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) const { beforeAll, beforeEach, describe } = test -let payload: Payload +let payload: PayloadTestSDK describe('fields - relationship', () => { let url: AdminUrlUtil @@ -54,7 +57,7 @@ describe('fields - relationship', () => { let serverURL: string beforeAll(async ({ browser }) => { - ;({ payload, serverURL } = await initPayloadE2E({ dirname })) + ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) url = new AdminUrlUtil(serverURL, slug) diff --git a/test/fields/collections/Lexical/e2e.spec.ts b/test/fields/collections/Lexical/e2e.spec.ts index b056a8fa26..ff08b17e6b 100644 --- a/test/fields/collections/Lexical/e2e.spec.ts +++ b/test/fields/collections/Lexical/e2e.spec.ts @@ -1,29 +1,30 @@ import type { SerializedBlockNode, SerializedLinkNode } from '@payloadcms/richtext-lexical' import type { Page } from '@playwright/test' +import type { PayloadTestSDK } from 'helpers/sdk/index.js' import type { SerializedEditorState, SerializedParagraphNode, SerializedTextNode } from 'lexical' -import type { Payload } from 'payload' import { expect, test } from '@playwright/test' +import { initPayloadE2ENoConfig } from 'helpers/initPayloadE2ENoConfig.js' +import { reInitializeDB } from 'helpers/reInit.js' import path from 'path' import { fileURLToPath } from 'url' -import type { LexicalField } from '../../payload-types.js' +import type { Config, LexicalField } from '../../payload-types.js' import { initPageConsoleErrorCatch, saveDocAndAssert } from '../../../helpers.js' import { AdminUrlUtil } from '../../../helpers/adminUrlUtil.js' -import { initPayloadE2E } from '../../../helpers/initPayloadE2E.js' import { RESTClient } from '../../../helpers/rest.js' import { POLL_TOPASS_TIMEOUT } from '../../../playwright.config.js' -import { clearAndSeedEverything } from '../../seed.js' import { lexicalFieldsSlug } from '../../slugs.js' import { lexicalDocData } from './data.js' + const filename = fileURLToPath(import.meta.url) const currentFolder = path.dirname(filename) const dirname = path.resolve(currentFolder, '../../') const { beforeAll, beforeEach, describe } = test -let payload: Payload +let payload: PayloadTestSDK let client: RESTClient let page: Page let serverURL: string @@ -49,7 +50,7 @@ async function navigateToLexicalFields(navigateToListView: boolean = true) { describe('lexical', () => { beforeAll(async ({ browser }) => { process.env.SEED_IN_CONFIG_ONINIT = 'false' // Makes it so the payload config onInit seed is not run. Otherwise, the seed would be run unnecessarily twice for the initial test run - once for beforeEach and once for onInit - ;({ payload, serverURL } = await initPayloadE2E({ dirname })) + ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) const context = await browser.newContext() page = await context.newPage() @@ -57,7 +58,12 @@ describe('lexical', () => { initPageConsoleErrorCatch(page) }) beforeEach(async () => { - await clearAndSeedEverything(payload) + await reInitializeDB({ + serverURL, + snapshotKey: 'fieldsLexicalTest', + uploadsDir: path.resolve(dirname, '../Upload/uploads'), + }) + if (client) { await client.logout() } diff --git a/test/plugin-nested-docs/e2e.spec.ts b/test/plugin-nested-docs/e2e.spec.ts index 433bd1c2a5..7fe9a70c56 100644 --- a/test/plugin-nested-docs/e2e.spec.ts +++ b/test/plugin-nested-docs/e2e.spec.ts @@ -4,12 +4,11 @@ import { expect, test } from '@playwright/test' import path from 'path' import { fileURLToPath } from 'url' -import type { Page as PayloadPage } from './payload-types.js' +import type { Config, Page as PayloadPage } from './payload-types.js' import { ensureAutoLoginAndCompilationIsDone, initPageConsoleErrorCatch } from '../helpers.js' import { AdminUrlUtil } from '../helpers/adminUrlUtil.js' -import { initPayloadE2E } from '../helpers/initPayloadE2E.js' - +import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) @@ -23,7 +22,7 @@ let childId: string describe('Nested Docs Plugin', () => { beforeAll(async ({ browser }) => { - const { serverURL, payload } = await initPayloadE2E({ dirname }) + const { serverURL, payload } = await initPayloadE2ENoConfig({ dirname }) url = new AdminUrlUtil(serverURL, 'pages') const context = await browser.newContext() page = await context.newPage() diff --git a/test/plugin-nested-docs/payload-types.ts b/test/plugin-nested-docs/payload-types.ts index 4380c19f35..68fdad6ce9 100644 --- a/test/plugin-nested-docs/payload-types.ts +++ b/test/plugin-nested-docs/payload-types.ts @@ -1,9 +1,115 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * This file was automatically generated by Payload. + * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, + * and re-run `payload generate:types` to regenerate this file. + */ + +export interface Config { + collections: { + pages: Page + categories: Category + users: User + 'payload-preferences': PayloadPreference + 'payload-migrations': PayloadMigration + } + globals: {} + locale: 'en' | 'es' | 'de' + user: User & { + collection: 'users' + } +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "pages". + */ export interface Page { id: string - parent?: string + title: string slug: string - _status?: 'draft' | 'published' - title?: string + fullTitle?: string | null + parent?: (string | null) | Page + breadcrumbs?: + | { + doc?: (string | null) | Page + url?: string | null + label?: string | null + id?: string | null + }[] + | null + updatedAt: string + createdAt: string + _status?: ('draft' | 'published') | null +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "categories". + */ +export interface Category { + id: string + name: string + categorization?: + | { + doc?: (string | null) | Category + url?: string | null + label?: string | null + test?: string | null + id?: string | null + }[] + | null + owner?: (string | null) | Category + updatedAt: string + createdAt: string +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string + updatedAt: string + createdAt: string + email: string + resetPasswordToken?: string | null + resetPasswordExpiration?: string | null + salt?: string | null + hash?: string | null + loginAttempts?: number | null + lockUntil?: string | null + password?: string | null +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string + user: { + relationTo: 'users' + value: string | User + } + key?: string | null + value?: + | { + [k: string]: unknown + } + | unknown[] + | string + | number + | boolean + | null + updatedAt: string + createdAt: string +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ +export interface PayloadMigration { + id: string + name?: string | null + batch?: number | null updatedAt: string createdAt: string } diff --git a/test/plugin-seo/config.ts b/test/plugin-seo/config.ts index 27f3720572..e59558a3a1 100644 --- a/test/plugin-seo/config.ts +++ b/test/plugin-seo/config.ts @@ -41,10 +41,6 @@ export default buildConfigWithDefaults({ await seed(payload) }, plugins: [ - seo({ - collections: ['users'], - tabbedUI: true, - }), seo({ collections: ['pages'], fieldOverrides: { diff --git a/test/plugin-seo/e2e.spec.ts b/test/plugin-seo/e2e.spec.ts index 0dcda420df..553235d492 100644 --- a/test/plugin-seo/e2e.spec.ts +++ b/test/plugin-seo/e2e.spec.ts @@ -5,11 +5,11 @@ import path from 'path' import { getFileByPath } from 'payload/uploads' import { fileURLToPath } from 'url' -import type { Page as PayloadPage } from './payload-types.js' +import type { Config, Page as PayloadPage } from './payload-types.js' import { ensureAutoLoginAndCompilationIsDone, initPageConsoleErrorCatch } from '../helpers.js' import { AdminUrlUtil } from '../helpers/adminUrlUtil.js' -import { initPayloadE2E } from '../helpers/initPayloadE2E.js' +import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js' import { mediaSlug } from './shared.js' const filename = fileURLToPath(import.meta.url) @@ -23,7 +23,7 @@ let id: string describe('SEO Plugin', () => { beforeAll(async ({ browser }) => { - const { serverURL, payload } = await initPayloadE2E({ dirname }) + const { serverURL, payload } = await initPayloadE2ENoConfig({ dirname }) url = new AdminUrlUtil(serverURL, 'pages') const context = await browser.newContext() diff --git a/test/uploads/e2e.spec.ts b/test/uploads/e2e.spec.ts index 2e937195d4..c392d8f97e 100644 --- a/test/uploads/e2e.spec.ts +++ b/test/uploads/e2e.spec.ts @@ -6,7 +6,8 @@ import path from 'path' import { wait } from 'payload/utilities' import { fileURLToPath } from 'url' -import type { Media } from './payload-types.js' +import type { PayloadTestSDK } from '../helpers/sdk/index.js' +import type { Config, Media } from './payload-types.js' import { ensureAutoLoginAndCompilationIsDone, @@ -15,7 +16,7 @@ import { saveDocAndAssert, } from '../helpers.js' import { AdminUrlUtil } from '../helpers/adminUrlUtil.js' -import { initPayloadE2E } from '../helpers/initPayloadE2E.js' +import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js' import { RESTClient } from '../helpers/rest.js' import { adminThumbnailFunctionSlug, @@ -29,7 +30,7 @@ const dirname = path.dirname(filename) const { beforeAll, describe } = test -let payload: Payload +let payload: PayloadTestSDK let client: RESTClient let serverURL: string let mediaURL: AdminUrlUtil @@ -44,7 +45,7 @@ describe('uploads', () => { let audioDoc: Media beforeAll(async ({ browser }) => { - ;({ payload, serverURL } = await initPayloadE2E({ dirname })) + ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) client = new RESTClient(null, { defaultSlug: 'users', serverURL }) await client.login()