From 475efd9ba01658b866637786132d56556ab12468 Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 14:43:02 -0400 Subject: [PATCH 01/16] test(auth): run auth e2e suite against tanstack start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enables the `auth` e2e suite for the TanStack Start adapter and fixes the tests that only passed on Next.js. Adds `waitForElementHydration` and `clickWhenHydrated` e2e helpers. The existing `installTanStackHydrationGotoWait` only waits for the admin root's hydration marker, but client components streamed inside a view hydrate a few hundred ms later while their SSR'd markup is in the DOM from the first byte. Interactions landing in that window are silently dropped: a click focuses the element without running `onClick`, and a `fill` sets the DOM value without React seeing the change. `toBeVisible()` is no protection, since the markup is already there. The document-lock test now polls the database instead of waiting on the framework's server-function request, which had to branch on Next.js server actions vs `/_serverFn/`. Its two `expect.poll` calls closed over an already-resolved `find`, so neither was ever retrying — the network wait was doing all the work. --- .github/workflows/e2e.config.ts | 1 + test/__helpers/e2e/helpers.ts | 42 ++++++++++++++++++++++ test/auth/e2e.spec.ts | 62 +++++++++++++-------------------- 3 files changed, 67 insertions(+), 38 deletions(-) diff --git a/.github/workflows/e2e.config.ts b/.github/workflows/e2e.config.ts index d637ce6b70c..d7478820402 100644 --- a/.github/workflows/e2e.config.ts +++ b/.github/workflows/e2e.config.ts @@ -118,6 +118,7 @@ const nextSuites: TestConfig[] = [ */ const tanstackSuites: TestConfig[] = [ { file: '_community', framework: 'tanstack-start', optional: false, shards: 1 }, + { file: 'auth', framework: 'tanstack-start', optional: false, shards: 1 }, ] export default createE2EConfig([...nextSuites, ...tanstackSuites]) diff --git a/test/__helpers/e2e/helpers.ts b/test/__helpers/e2e/helpers.ts index bc681061d31..165bcea611c 100644 --- a/test/__helpers/e2e/helpers.ts +++ b/test/__helpers/e2e/helpers.ts @@ -521,6 +521,48 @@ export function installTanStackHydrationGotoWait(page: Page) { }) as Page['reload'] } +/** + * Resolves once React has attached its internal props to `locator`'s DOM node, which is + * the point at which its event handlers actually fire. + * + * `installTanStackHydrationGotoWait` waits for the admin root marker, but client + * components streamed inside a view hydrate a few hundred ms later while their SSR'd + * markup is in the DOM from the first byte. Interactions landing in that window are + * silently dropped: a click focuses the element without running `onClick`, and a `fill` + * sets the DOM value without React ever seeing the change. `toBeVisible()` is no + * protection — the markup is already there. + * + * Use this for the first interaction after a navigation, in preference to a bare + * `wait()`. + */ +export async function waitForElementHydration(locator: Locator): Promise { + await expect + .poll( + () => + locator.evaluate((el) => + Object.keys(el).some( + (key) => key.startsWith('__reactProps$') || key.startsWith('__reactFiber$'), + ), + ), + { timeout: POLL_TOPASS_TIMEOUT }, + ) + .toBe(true) +} + +/** + * Clicks `locator` once it has hydrated. Preferred over retrying the click until it + * takes effect, which would double-submit forms. + * + * @see {@link waitForElementHydration} + */ +export async function clickWhenHydrated( + locator: Locator, + options?: Parameters[0], +): Promise { + await waitForElementHydration(locator) + await locator.click(options) +} + export function initPageConsoleErrorCatch(page: Page, options?: { ignoreCORS?: boolean }) { const { ignoreCORS = false } = options || {} // Default to not ignoring CORS errors const consoleErrors: string[] = [] diff --git a/test/auth/e2e.spec.ts b/test/auth/e2e.spec.ts index 0edadd55765..0ea23db015e 100644 --- a/test/auth/e2e.spec.ts +++ b/test/auth/e2e.spec.ts @@ -2,7 +2,7 @@ import type { BrowserContext, Page } from '@playwright/test' import { expect, test } from '@playwright/test' import path from 'path' -import { formatAdminURL, wait } from 'payload/shared' +import { formatAdminURL } from 'payload/shared' import { fileURLToPath } from 'url' import { v4 as uuid } from 'uuid' @@ -12,10 +12,12 @@ import type { Config } from './payload-types.js' import { login } from '../__helpers/e2e/auth/login.js' import { logout } from '../__helpers/e2e/auth/logout.js' import { + clickWhenHydrated, ensureCompilationIsDone, getRoutes, initPageConsoleErrorCatch, saveDocAndAssert, + waitForElementHydration, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' @@ -185,7 +187,7 @@ describe('Auth', () => { afterAll(async () => { // reset password to original password await page.goto(url.account) - await page.locator('#change-password').click() + await clickWhenHydrated(page.locator('#change-password')) await page.locator('#field-password').fill(devUser.password) await page.locator('#field-confirm-password').fill(devUser.password) await saveDocAndAssert(page, '#action-save') @@ -243,7 +245,7 @@ describe('Auth', () => { const emailBeforeSave = await page.locator('#field-email').inputValue() await expect(page.locator('#force-unlock')).toBeVisible() - await page.locator('#change-password').click() + await clickWhenHydrated(page.locator('#change-password')) await page.locator('#field-password').fill('password') await expect(page.locator('#change-password')).toBeHidden() @@ -273,6 +275,11 @@ describe('Auth', () => { test('should prevent new user creation without confirm password', async () => { await page.goto(url.list) await page.goto(url.create) + + // A `fill` before hydration sets the DOM value without React seeing the change, + // so the field would submit empty. + await waitForElementHydration(page.locator('#field-email')) + await page.locator('#field-email').fill('dev2@payloadcms.com') await page.locator('#field-password').fill('password') // should fail to save without confirm password @@ -322,40 +329,25 @@ describe('Auth', () => { test('should unlock document on logout after editing without saving', async () => { await page.goto(url.list) - // Wait for hydration - await wait(1000) - await page.locator('.table .row-1 .cell-custom a').click() + await clickWhenHydrated(page.locator('.table .row-1 .cell-custom a')) await page.waitForURL(/\/admin\/collections\/users\/[a-zA-Z0-9]+/) const textInput = page.locator('#field-namedSaveToJWT') await expect(textInput).toBeVisible() - const docID = (await page.locator('.render-title').getAttribute('data-doc-id')) as string - - const isTanStack = process.env.PAYLOAD_FRAMEWORK === 'tanstack-start' - const lockDocRequest = page.waitForResponse((response) => { - const method = response.request().method() - const reqUrl = response.request().url() - if (method !== 'POST') { - return false - } - // Next.js server actions POST to the admin page URL; - // TanStack Start server functions POST through `createServerFn`'s - // `/_serverFn/` RPC (legacy `/api/server-function` - // accepted for backward compatibility with older snapshots). - return isTanStack - ? reqUrl.includes('/_serverFn/') || reqUrl.includes('/api/server-function') - : reqUrl === url.edit(docID) - }) - await textInput.fill('some text') - await lockDocRequest - const lockedDocs = await payload.find({ - collection: 'payload-locked-documents', - limit: 1, - pagination: false, - }) + const countLockedDocs = async () => { + const lockedDocs = await payload.find({ + collection: 'payload-locked-documents', + limit: 1, + pagination: false, + }) - await expect.poll(() => lockedDocs.docs.length).toBe(1) + return lockedDocs.docs.length + } + + await textInput.fill('some text') + + await expect.poll(countLockedDocs, { timeout: POLL_TOPASS_TIMEOUT }).toBe(1) await page.locator('.user-menu__trigger').click() await page.locator('a[href$="/logout"]').click() @@ -369,13 +361,7 @@ describe('Auth', () => { await expect(page.locator('.login')).toBeVisible() - const unlockedDocs = await payload.find({ - collection: 'payload-locked-documents', - limit: 1, - pagination: false, - }) - - await expect.poll(() => unlockedDocs.docs.length).toBe(0) + await expect.poll(countLockedDocs, { timeout: POLL_TOPASS_TIMEOUT }).toBe(0) // added so tests after this do not need to re-login await login({ page, serverURL }) From 628648ca49c280df1d0d22e64ffb7bfccf1fdc78 Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 16:56:53 -0400 Subject: [PATCH 02/16] chore: wait for react commit before returning from goto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A full document load on the TanStack Start adapter does not hydrate the SSR'd admin view in place. `AdminPage` renders an RSC payload fetched by the route loader, so the server markup is torn down and re-mounted as different DOM nodes a few hundred ms later. An interaction landing in that window is lost outright — the element it targeted no longer exists — and unlike Next.js there is no dehydrated boundary for React to replay the event into. `toBeVisible()` is no protection, since the doomed markup is on screen from the first byte. `page.goto` / `page.reload` now wait on two signals, because neither alone is sufficient. The hydration marker tracks router state rather than latching on first shell mount, so it reports the loader settling and stays honest across later navigations. React ownership of the admin template then covers the commit that follows router-idle by a measured 60-135ms, and lands in the same commit as every interactive element inside the view. Tests no longer need per-call hydration helpers before the first interaction after a navigation. Consolidates the three duplicated `HydrationMarker` copies into one shared implementation and moves the `goto` patch out of `helpers.ts` into `goTo.ts`. --- .../components/HydrationMarker/index.tsx | 35 +++++ test/__helpers/e2e/goTo.ts | 124 ++++++++++++++++++ test/__helpers/e2e/helpers.ts | 124 +----------------- .../components/HydrationMarker/index.tsx | 21 +-- .../components/HydrationMarker/index.tsx | 21 +-- test/auth/e2e.spec.ts | 13 +- test/lexical/collections/utils.ts | 4 +- .../components/HydrationMarker/index.tsx | 21 +-- 8 files changed, 170 insertions(+), 193 deletions(-) create mode 100644 test/__helpers/components/HydrationMarker/index.tsx create mode 100644 test/__helpers/e2e/goTo.ts diff --git a/test/__helpers/components/HydrationMarker/index.tsx b/test/__helpers/components/HydrationMarker/index.tsx new file mode 100644 index 00000000000..7d3caecd4d8 --- /dev/null +++ b/test/__helpers/components/HydrationMarker/index.tsx @@ -0,0 +1,35 @@ +'use client' + +import { useRouterState } from '@tanstack/react-router' +import { useEffect } from 'react' + +/** + * Publishes admin-route readiness on `window.__TANSTACK_HYDRATED__`, which the Playwright + * `goto`/`reload` wrapper installed by `initPageConsoleErrorCatch` waits for. + * + * Shell hydration is not a sufficient signal. `AdminPage` renders an RSC payload fetched by + * the route loader, so on a full document load the SSR'd view is torn down ~30ms in and + * re-mounted ~300ms later as different DOM nodes. An interaction landing in that window is + * lost outright — the element it targeted no longer exists — and unlike Next.js there is no + * dehydrated boundary for React to replay the event into. + * + * `status === 'idle'` with no in-flight load means loaders resolved and matches committed, + * i.e. the payload is mounted and owned by React. Tracking router state rather than latching + * on first mount also keeps the flag honest across subsequent navigations. + * + * Production users never see this marker; tests opt in via the Playwright wrapper and read + * the global directly. + */ +export function HydrationMarker() { + // `select` must return a primitive. `useRouterState` re-renders on every reference + // change, so returning an object here loops. + const isReady = useRouterState({ + select: (state) => state.status === 'idle' && !state.isLoading && !state.isTransitioning, + }) + + useEffect(() => { + ;(window as unknown as { __TANSTACK_HYDRATED__?: boolean }).__TANSTACK_HYDRATED__ = isReady + }, [isReady]) + + return null +} diff --git a/test/__helpers/e2e/goTo.ts b/test/__helpers/e2e/goTo.ts new file mode 100644 index 00000000000..640fc84b853 --- /dev/null +++ b/test/__helpers/e2e/goTo.ts @@ -0,0 +1,124 @@ +import type { Page } from '@playwright/test' + +/** + * Wrapper element every admin view renders inside, and the shallowest node whose React + * ownership proves the view has been committed. + */ +const ADMIN_TEMPLATE_SELECTOR = '.template-default, .template-minimal' + +/** + * Makes `page.goto()` / `page.reload()` return only once the admin view is interactive. + * + * On the TanStack Start adapter a full document load does not hydrate the SSR'd view in + * place. `AdminPage` renders an RSC payload fetched by the route loader, so the server + * markup is torn down and re-mounted as different DOM nodes a few hundred ms later. An + * interaction landing in that window is lost outright — the element it targeted no longer + * exists — and unlike Next.js there is no dehydrated boundary for React to replay the + * event into. `toBeVisible()` is no protection, since the doomed markup is on screen from + * the first byte. + * + * Waits on two signals, because neither alone is sufficient: the router marker (see + * `test/__helpers/components/HydrationMarker`) for the loader settling, then React + * ownership of the view for the commit that follows it 60-135ms later. + * + * No-op for Next.js, where the marker is never set, so tests don't branch on framework. + * + * Idempotent: calling this more than once on the same page is safe. + */ +export function patchPageGoToWithHydrationMarker(page: Page) { + if (process.env.PAYLOAD_FRAMEWORK !== 'tanstack-start') { + return + } + + const patchedPage = page as unknown as { + __payloadGotoPatched?: boolean + __payloadSkipHydrationWait?: boolean + } + + if (patchedPage.__payloadGotoPatched) { + return + } + + patchedPage.__payloadGotoPatched = true + + const waitForHydration = async () => { + if (patchedPage.__payloadSkipHydrationWait) { + return + } + + try { + await page.waitForFunction( + () => (window as unknown as { __TANSTACK_HYDRATED__?: boolean }).__TANSTACK_HYDRATED__, + undefined, + { timeout: 15000 }, + ) + + // Router-idle lands 60-135ms BEFORE React commits the view. In that gap the SSR'd + // markup is still on screen but doomed: it gets torn down and replaced by nodes React + // owns, so a click there targets an element that ceases to exist. Wait for the admin + // template to carry React's internal keys, which happens in the same commit as every + // interactive element inside it. + if (await page.locator(ADMIN_TEMPLATE_SELECTOR).count()) { + await page.waitForFunction( + (selector) => { + const el = document.querySelector(selector) + + return ( + !!el && + Object.keys(el).some( + (key) => key.startsWith('__reactProps$') || key.startsWith('__reactFiber$'), + ) + ) + }, + ADMIN_TEMPLATE_SELECTOR, + { timeout: 15000 }, + ) + } + } catch { + // Best-effort. Don't fail navigation if the marker never shows up; + // the underlying assertion in the test will still surface the real + // failure. + } + } + + // Non-admin URLs (e.g. `/api/` JSON endpoints used by tests that + // assert on the raw REST response) never mount the TanStack admin app, so + // `__TANSTACK_HYDRATED__` will never be set. Skip the hydration wait for + // those, otherwise each such navigation pays the full 15s timeout. + const requiresHydrationWait = (url: string | undefined): boolean => { + if (!url) { + return true + } + + try { + const path = new URL(url, 'http://localhost').pathname + return !path.startsWith('/api/') && path !== '/api' + } catch { + return true + } + } + + const originalGoto = page.goto.bind(page) + + page.goto = (async (...args: Parameters) => { + const response = await originalGoto(...args) + + if (requiresHydrationWait(args[0])) { + await waitForHydration() + } + + return response + }) as Page['goto'] + + const originalReload = page.reload.bind(page) + + page.reload = (async (...args: Parameters) => { + const response = await originalReload(...args) + + if (requiresHydrationWait(page.url())) { + await waitForHydration() + } + + return response + }) as Page['reload'] +} diff --git a/test/__helpers/e2e/helpers.ts b/test/__helpers/e2e/helpers.ts index 165bcea611c..7cfdf2ff9c8 100644 --- a/test/__helpers/e2e/helpers.ts +++ b/test/__helpers/e2e/helpers.ts @@ -13,6 +13,7 @@ import { formatAdminURL, wait } from 'payload/shared' import { setTimeout } from 'timers/promises' import { POLL_TOPASS_TIMEOUT } from '../../playwright.config.js' +import { patchPageGoToWithHydrationMarker } from './goTo.js' import { hideNextDevTools } from './hideNextDevTools.js' export type AdminRoutes = NonNullable['routes']> @@ -442,134 +443,13 @@ export const openColumnControls = async (page: Page) => { * @param page * @param options */ -/** - * Each `page.goto()` triggers a fresh SSR + hydration cycle, and on the - * TanStack Start adapter (which serves a Vite dev server) hydration can lag - * a click by 0.5-2s in CI. When that happens the click reaches the SSR'd - * button and focuses it, but React's `onClick` handler is not attached yet - * so the underlying state never updates and any follow-up `toBeVisible` - * assertion times out. We patch `goto` here to wait for the hydration - * marker that the TanStack root component installs (see - * `app-tanstack/app/__root.tsx`). The patch is a no-op for the Next.js - * adapter, where the marker is never set, so individual tests don't need to - * branch on the framework. - * - * Idempotent: calling this more than once on the same page is safe. - */ -export function installTanStackHydrationGotoWait(page: Page) { - if (process.env.PAYLOAD_FRAMEWORK !== 'tanstack-start') { - return - } - const patchedPage = page as unknown as { - __payloadGotoPatched?: boolean - __payloadSkipHydrationWait?: boolean - } - if (patchedPage.__payloadGotoPatched) { - return - } - patchedPage.__payloadGotoPatched = true - - const waitForHydration = async () => { - if (patchedPage.__payloadSkipHydrationWait) { - return - } - try { - await page.waitForFunction( - () => (window as unknown as { __TANSTACK_HYDRATED__?: boolean }).__TANSTACK_HYDRATED__, - undefined, - { timeout: 15000 }, - ) - } catch { - // Best-effort. Don't fail navigation if the marker never shows up; - // the underlying assertion in the test will still surface the real - // failure. - } - } - - // Non-admin URLs (e.g. `/api/` JSON endpoints used by tests that - // assert on the raw REST response) never mount the TanStack admin app, so - // `__TANSTACK_HYDRATED__` will never be set. Skip the hydration wait for - // those, otherwise each such navigation pays the full 15s timeout. - const requiresHydrationWait = (url: string | undefined): boolean => { - if (!url) { - return true - } - try { - const path = new URL(url, 'http://localhost').pathname - return !path.startsWith('/api/') && path !== '/api' - } catch { - return true - } - } - - const originalGoto = page.goto.bind(page) - page.goto = (async (...args: Parameters) => { - const response = await originalGoto(...args) - if (requiresHydrationWait(args[0])) { - await waitForHydration() - } - return response - }) as Page['goto'] - - const originalReload = page.reload.bind(page) - page.reload = (async (...args: Parameters) => { - const response = await originalReload(...args) - if (requiresHydrationWait(page.url())) { - await waitForHydration() - } - return response - }) as Page['reload'] -} - -/** - * Resolves once React has attached its internal props to `locator`'s DOM node, which is - * the point at which its event handlers actually fire. - * - * `installTanStackHydrationGotoWait` waits for the admin root marker, but client - * components streamed inside a view hydrate a few hundred ms later while their SSR'd - * markup is in the DOM from the first byte. Interactions landing in that window are - * silently dropped: a click focuses the element without running `onClick`, and a `fill` - * sets the DOM value without React ever seeing the change. `toBeVisible()` is no - * protection — the markup is already there. - * - * Use this for the first interaction after a navigation, in preference to a bare - * `wait()`. - */ -export async function waitForElementHydration(locator: Locator): Promise { - await expect - .poll( - () => - locator.evaluate((el) => - Object.keys(el).some( - (key) => key.startsWith('__reactProps$') || key.startsWith('__reactFiber$'), - ), - ), - { timeout: POLL_TOPASS_TIMEOUT }, - ) - .toBe(true) -} - -/** - * Clicks `locator` once it has hydrated. Preferred over retrying the click until it - * takes effect, which would double-submit forms. - * - * @see {@link waitForElementHydration} - */ -export async function clickWhenHydrated( - locator: Locator, - options?: Parameters[0], -): Promise { - await waitForElementHydration(locator) - await locator.click(options) -} - export function initPageConsoleErrorCatch(page: Page, options?: { ignoreCORS?: boolean }) { const { ignoreCORS = false } = options || {} // Default to not ignoring CORS errors const consoleErrors: string[] = [] let shouldCollectErrors = false - installTanStackHydrationGotoWait(page) + patchPageGoToWithHydrationMarker(page) page.on('console', (msg) => { if ( diff --git a/test/admin-bar/app-tanstack/components/HydrationMarker/index.tsx b/test/admin-bar/app-tanstack/components/HydrationMarker/index.tsx index fc834528089..a7e79c8992a 100644 --- a/test/admin-bar/app-tanstack/components/HydrationMarker/index.tsx +++ b/test/admin-bar/app-tanstack/components/HydrationMarker/index.tsx @@ -1,20 +1 @@ -import { useEffect } from 'react' - -/** - * Sets `window.__TANSTACK_HYDRATED__ = true` after the first effect runs, - * which is the earliest point at which React's event handlers are guaranteed - * to be attached. The Playwright `goto` wrapper in `initPageConsoleErrorCatch` - * waits for this flag before returning, which prevents the very common race - * where a Playwright click lands on the SSR'd DOM before React finishes - * hydrating (the click focuses the button but the React `onClick` handler - * never fires). - * - * Production users do not see this marker because the bundle hash differs; - * tests opt-in via the Playwright wrapper and consult the global directly. - */ -export function HydrationMarker() { - useEffect(() => { - ;(window as unknown as { __TANSTACK_HYDRATED__?: boolean }).__TANSTACK_HYDRATED__ = true - }, []) - return null -} +export { HydrationMarker } from '../../../../__helpers/components/HydrationMarker/index.js' diff --git a/test/app-tanstack/components/HydrationMarker/index.tsx b/test/app-tanstack/components/HydrationMarker/index.tsx index fc834528089..b3d0080f8b8 100644 --- a/test/app-tanstack/components/HydrationMarker/index.tsx +++ b/test/app-tanstack/components/HydrationMarker/index.tsx @@ -1,20 +1 @@ -import { useEffect } from 'react' - -/** - * Sets `window.__TANSTACK_HYDRATED__ = true` after the first effect runs, - * which is the earliest point at which React's event handlers are guaranteed - * to be attached. The Playwright `goto` wrapper in `initPageConsoleErrorCatch` - * waits for this flag before returning, which prevents the very common race - * where a Playwright click lands on the SSR'd DOM before React finishes - * hydrating (the click focuses the button but the React `onClick` handler - * never fires). - * - * Production users do not see this marker because the bundle hash differs; - * tests opt-in via the Playwright wrapper and consult the global directly. - */ -export function HydrationMarker() { - useEffect(() => { - ;(window as unknown as { __TANSTACK_HYDRATED__?: boolean }).__TANSTACK_HYDRATED__ = true - }, []) - return null -} +export { HydrationMarker } from '../../../__helpers/components/HydrationMarker/index.js' diff --git a/test/auth/e2e.spec.ts b/test/auth/e2e.spec.ts index 0ea23db015e..0535c94576b 100644 --- a/test/auth/e2e.spec.ts +++ b/test/auth/e2e.spec.ts @@ -12,12 +12,10 @@ import type { Config } from './payload-types.js' import { login } from '../__helpers/e2e/auth/login.js' import { logout } from '../__helpers/e2e/auth/logout.js' import { - clickWhenHydrated, ensureCompilationIsDone, getRoutes, initPageConsoleErrorCatch, saveDocAndAssert, - waitForElementHydration, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' @@ -187,7 +185,7 @@ describe('Auth', () => { afterAll(async () => { // reset password to original password await page.goto(url.account) - await clickWhenHydrated(page.locator('#change-password')) + await page.locator('#change-password').click() await page.locator('#field-password').fill(devUser.password) await page.locator('#field-confirm-password').fill(devUser.password) await saveDocAndAssert(page, '#action-save') @@ -245,7 +243,7 @@ describe('Auth', () => { const emailBeforeSave = await page.locator('#field-email').inputValue() await expect(page.locator('#force-unlock')).toBeVisible() - await clickWhenHydrated(page.locator('#change-password')) + await page.locator('#change-password').click() await page.locator('#field-password').fill('password') await expect(page.locator('#change-password')).toBeHidden() @@ -276,9 +274,7 @@ describe('Auth', () => { await page.goto(url.list) await page.goto(url.create) - // A `fill` before hydration sets the DOM value without React seeing the change, - // so the field would submit empty. - await waitForElementHydration(page.locator('#field-email')) + await page.locator('#field-email').click() await page.locator('#field-email').fill('dev2@payloadcms.com') await page.locator('#field-password').fill('password') @@ -329,7 +325,7 @@ describe('Auth', () => { test('should unlock document on logout after editing without saving', async () => { await page.goto(url.list) - await clickWhenHydrated(page.locator('.table .row-1 .cell-custom a')) + await page.locator('.table .row-1 .cell-custom a').click() await page.waitForURL(/\/admin\/collections\/users\/[a-zA-Z0-9]+/) const textInput = page.locator('#field-namedSaveToJWT') @@ -386,7 +382,6 @@ describe('Auth', () => { test('should enable api key', async () => { await page.goto(url.create) - // click enable api key checkbox await page.locator('#field-enableAPIKey').click() // assert that the value is set diff --git a/test/lexical/collections/utils.ts b/test/lexical/collections/utils.ts index f53e57d1e5d..95ffddf9879 100644 --- a/test/lexical/collections/utils.ts +++ b/test/lexical/collections/utils.ts @@ -5,7 +5,7 @@ import fs from 'fs' import path from 'path' import { wait } from 'payload/shared' -import { installTanStackHydrationGotoWait } from '../../__helpers/e2e/helpers.js' +import { patchPageGoToWithHydrationMarker } from '../../__helpers/e2e/goTo.js' export type PasteMode = 'blob' | 'html' @@ -36,7 +36,7 @@ export class LexicalHelpers { page: Page constructor(page: Page) { this.page = page - installTanStackHydrationGotoWait(page) + patchPageGoToWithHydrationMarker(page) } async addLine( diff --git a/test/live-preview/app-tanstack/components/HydrationMarker/index.tsx b/test/live-preview/app-tanstack/components/HydrationMarker/index.tsx index fc834528089..a7e79c8992a 100644 --- a/test/live-preview/app-tanstack/components/HydrationMarker/index.tsx +++ b/test/live-preview/app-tanstack/components/HydrationMarker/index.tsx @@ -1,20 +1 @@ -import { useEffect } from 'react' - -/** - * Sets `window.__TANSTACK_HYDRATED__ = true` after the first effect runs, - * which is the earliest point at which React's event handlers are guaranteed - * to be attached. The Playwright `goto` wrapper in `initPageConsoleErrorCatch` - * waits for this flag before returning, which prevents the very common race - * where a Playwright click lands on the SSR'd DOM before React finishes - * hydrating (the click focuses the button but the React `onClick` handler - * never fires). - * - * Production users do not see this marker because the bundle hash differs; - * tests opt-in via the Playwright wrapper and consult the global directly. - */ -export function HydrationMarker() { - useEffect(() => { - ;(window as unknown as { __TANSTACK_HYDRATED__?: boolean }).__TANSTACK_HYDRATED__ = true - }, []) - return null -} +export { HydrationMarker } from '../../../../__helpers/components/HydrationMarker/index.js' From d4785069fd4a9df328a8c88f5336be619d3a3e0c Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 17:30:33 -0400 Subject: [PATCH 03/16] better abstracts for page setup --- .../components/HydrationMarker/index.tsx | 2 +- test/__helpers/e2e/helpers.ts | 126 +-------- test/__setup/catchConsoleErrors.ts | 113 ++++++++ test/__setup/initPage.ts | 40 +++ .../goTo.ts => __setup/patchPageMethods.ts} | 4 +- test/_community/e2e.spec.ts | 6 +- test/a11y/e2e.spec.ts | 42 +-- test/a11y/focus-indicators.e2e.spec.ts | 57 ++-- test/access-control/e2e.spec.ts | 83 +++--- test/admin-bar/e2e.spec.ts | 6 +- test/admin-root/e2e.spec.ts | 5 +- test/admin/e2e/command-palette/e2e.spec.ts | 5 +- test/admin/e2e/document-view/e2e.spec.ts | 9 +- test/admin/e2e/general/e2e.spec.ts | 5 +- test/admin/e2e/list-view/e2e.spec.ts | 111 ++++---- test/admin/e2e/sidebar-tabs/e2e.spec.ts | 14 +- test/admin/e2e/tooltip/e2e.spec.ts | 5 +- test/auth-basic/e2e.spec.ts | 13 +- test/auth/e2e.spec.ts | 17 +- test/auth/payload-types.ts | 52 ++++ test/base-path/e2e.spec.ts | 5 +- test/bulk-edit/e2e.spec.ts | 99 ++++--- test/embed/e2e.spec.ts | 8 +- test/field-error-states/e2e.spec.ts | 8 +- test/field-paths/e2e.spec.ts | 5 +- test/fields-relationship/e2e.spec.ts | 79 +++--- test/fields/collections/Array/e2e.spec.ts | 61 +++-- test/fields/collections/Blocks/e2e.spec.ts | 115 ++++---- test/fields/collections/Checkbox/e2e.spec.ts | 5 +- test/fields/collections/Code/e2e.spec.ts | 5 +- .../collections/Collapsible/e2e.spec.ts | 11 +- .../collections/ConditionalLogic/e2e.spec.ts | 9 +- test/fields/collections/CustomID/e2e.spec.ts | 9 +- test/fields/collections/Date/e2e.spec.ts | 76 +++--- test/fields/collections/Email/e2e.spec.ts | 11 +- test/fields/collections/Group/e2e.spec.ts | 7 +- test/fields/collections/Indexed/e2e.spec.ts | 5 +- test/fields/collections/JSON/e2e.spec.ts | 11 +- test/fields/collections/Number/e2e.spec.ts | 23 +- test/fields/collections/Point/e2e.spec.ts | 9 +- test/fields/collections/Radio/e2e.spec.ts | 5 +- .../collections/Relationship/e2e.spec.ts | 75 +++--- test/fields/collections/Row/e2e.spec.ts | 7 +- test/fields/collections/Select/e2e.spec.ts | 15 +- test/fields/collections/SlugField/e2e.spec.ts | 11 +- test/fields/collections/Tabs/e2e.spec.ts | 11 +- test/fields/collections/Tabs2/e2e.spec.ts | 9 +- test/fields/collections/Text/e2e.spec.ts | 25 +- test/fields/collections/Textarea/e2e.spec.ts | 15 +- test/fields/collections/UI/e2e.spec.ts | 5 +- test/fields/collections/Upload/e2e.spec.ts | 5 +- .../collections/UploadMulti/e2e.spec.ts | 5 +- .../collections/UploadMultiPoly/e2e.spec.ts | 4 +- .../fields/collections/UploadPoly/e2e.spec.ts | 5 +- .../collections/UploadRestricted/e2e.spec.ts | 9 +- test/form-state/e2e.spec.ts | 5 +- test/group-by/e2e.spec.ts | 5 +- test/hierarchy/e2e.spec.ts | 10 +- test/hooks/e2e.spec.ts | 13 +- test/i18n/e2e.spec.ts | 6 +- test/joins/e2e.spec.ts | 27 +- .../Lexical/e2e/blocks/e2e.spec.ts | 33 ++- .../collections/Lexical/e2e/main/e2e.spec.ts | 5 +- test/lexical/collections/utils.ts | 12 +- test/live-preview/e2e.spec.ts | 27 +- test/localization/e2e.spec.ts | 43 ++- test/locked-documents/e2e.spec.ts | 245 +++++++++--------- test/plugin-ecommerce/e2e.spec.ts | 19 +- test/plugin-form-builder/e2e.spec.ts | 7 +- test/plugin-import-export/e2e.spec.ts | 5 +- test/plugin-mcp/e2e.spec.ts | 6 +- test/plugin-multi-tenant/e2e.spec.ts | 25 +- test/plugin-nested-docs/e2e.spec.ts | 20 +- test/plugin-redirects/e2e.spec.ts | 5 +- test/plugin-seo/e2e.spec.ts | 7 +- test/query-presets/e2e.spec.ts | 30 +-- test/queues/e2e.spec.ts | 6 +- test/server-functions/e2e.spec.ts | 9 +- test/server-url/e2e.spec.ts | 6 +- test/sort/e2e.spec.ts | 13 +- test/tags/e2e.spec.ts | 6 +- test/trash/e2e.spec.ts | 78 +++--- test/uploads/e2e.spec.ts | 15 +- test/versions/e2e.spec.ts | 145 +++++------ tsconfig.base.json | 2 +- 85 files changed, 1180 insertions(+), 1137 deletions(-) create mode 100644 test/__setup/catchConsoleErrors.ts create mode 100644 test/__setup/initPage.ts rename test/{__helpers/e2e/goTo.ts => __setup/patchPageMethods.ts} (96%) diff --git a/test/__helpers/components/HydrationMarker/index.tsx b/test/__helpers/components/HydrationMarker/index.tsx index 7d3caecd4d8..9ce3cb019ff 100644 --- a/test/__helpers/components/HydrationMarker/index.tsx +++ b/test/__helpers/components/HydrationMarker/index.tsx @@ -5,7 +5,7 @@ import { useEffect } from 'react' /** * Publishes admin-route readiness on `window.__TANSTACK_HYDRATED__`, which the Playwright - * `goto`/`reload` wrapper installed by `initPageConsoleErrorCatch` waits for. + * `goto`/`reload` wrapper installed by `initPage` waits for. * * Shell hydration is not a sufficient signal. `AdminPage` renders an RSC payload fetched by * the route loader, so on a full document load the SSR'd view is torn down ~30ms in and diff --git a/test/__helpers/e2e/helpers.ts b/test/__helpers/e2e/helpers.ts index 7cfdf2ff9c8..176088b5465 100644 --- a/test/__helpers/e2e/helpers.ts +++ b/test/__helpers/e2e/helpers.ts @@ -13,7 +13,6 @@ import { formatAdminURL, wait } from 'payload/shared' import { setTimeout } from 'timers/promises' import { POLL_TOPASS_TIMEOUT } from '../../playwright.config.js' -import { patchPageGoToWithHydrationMarker } from './goTo.js' import { hideNextDevTools } from './hideNextDevTools.js' export type AdminRoutes = NonNullable['routes']> @@ -26,16 +25,6 @@ const networkConditions = { latency: 1000, upload: ((750 * 1000) / 8) * 0.9, }, - 'Slow 3G': { - download: ((500 * 1000) / 8) * 0.8, - latency: 2500, - upload: ((500 * 1000) / 8) * 0.8, - }, - 'Slow 4G': { - download: ((4 * 1000 * 1000) / 8) * 0.8, - latency: 1000, - upload: ((3 * 1000 * 1000) / 8) * 0.8, - }, 'Fast 4G': { download: ((20 * 1000 * 1000) / 8) * 0.8, latency: 1000, @@ -46,6 +35,16 @@ const networkConditions = { latency: -1, upload: -1, }, + 'Slow 3G': { + download: ((500 * 1000) / 8) * 0.8, + latency: 2500, + upload: ((500 * 1000) / 8) * 0.8, + }, + 'Slow 4G': { + download: ((4 * 1000 * 1000) / 8) * 0.8, + latency: 1000, + upload: ((3 * 1000 * 1000) / 8) * 0.8, + }, } /** @@ -54,13 +53,13 @@ const networkConditions = { * @param serverURL */ export async function ensureCompilationIsDone({ + browser, customAdminRoutes, customRoutes, - page: pageFromArgs, - serverURL, noAutoLogin, - browser, + page: pageFromArgs, readyURL, + serverURL, }: { /** * Provide a browser if you need this utility to create and close a temporary page for you. @@ -435,103 +434,6 @@ export const openColumnControls = async (page: Page) => { }).toPass({ timeout: 18000 }) } -/** - * Throws an error when browser console error messages (with some exceptions) are thrown, thus resulting - * in the e2e test failing. - * - * Useful to prevent the e2e test from passing when, for example, there are react missing key prop errors - * @param page - * @param options - */ -export function initPageConsoleErrorCatch(page: Page, options?: { ignoreCORS?: boolean }) { - const { ignoreCORS = false } = options || {} // Default to not ignoring CORS errors - const consoleErrors: string[] = [] - - let shouldCollectErrors = false - - patchPageGoToWithHydrationMarker(page) - - page.on('console', (msg) => { - if ( - msg.type() === 'error' && - // Playwright is seemingly loading CJS files from React Select, but Next loads ESM. - // This leads to classnames not matching. Ignore these God-awful errors - // https://github.com/JedWatson/react-select/issues/3590 - !msg.text().includes('did not match. Server:') && - !msg.text().includes('Hydration failed because the server rendered HTML') && - !msg.text().includes('the server responded with a status of') && - !msg.text().includes('Failed to fetch RSC payload for') && - !msg.text().includes('Error loading language') && - !msg.text().includes('Error: NEXT_NOT_FOUND') && - !msg.text().includes('Error: NEXT_REDIRECT') && - // TanStack Start adapter nav control-flow contract (analogous to the - // NEXT_NOT_FOUND / NEXT_REDIRECT signals above). `req.server.notFound()` / - // `redirect()` thrown deep inside a streamed RSC view surface as these. - !msg.text().includes('Error: not-found') && - !msg.text().includes('Error: redirect:') && - !msg.text().includes('Error getting document data') && - !msg.text().includes('Failed trying to load default language strings') && - !msg.text().includes('TypeError: Failed to fetch') && // This happens when server actions are aborted - !msg.text().includes('TypeError: network error') && // Transient network errors during chunk loading - !msg.text().includes('der-radius: 2px Server Error: Error getting do') && // This is a weird error that happens in the console - // Expected lexical-converter warning for blocks/inline-blocks intentionally - // configured without an HTML converter (e.g. the `diff` test collection's - // `myBlock`). Logged server-side via `console.error`; harmless in Next, but - // the TanStack/vite-rsc adapter forwards server `console.error` to the - // browser console, so it would otherwise fail every diff-view test. - !msg.text().includes('no converter is provided') && - // Conditionally ignore CORS errors based on the `ignoreCORS` option - !( - ignoreCORS && - msg.text().includes('Access to fetch at') && - msg.text().includes("No 'Access-Control-Allow-Origin' header is present") - ) && - // Conditionally ignore network-related errors - !msg.text().includes('Failed to load resource: net::ERR_FAILED') - ) { - // "Failed to fetch RSC payload for" happens seemingly randomly. There are lots of issues in the next.js repository for this. Causes e2e tests to fail and flake. Will ignore for now - // the the server responded with a status of error happens frequently. Will ignore it for now. - // Most importantly, this should catch react errors. - const { url, lineNumber, columnNumber } = msg.location() || {} - const locationSuffix = url ? `\n at ${url}:${lineNumber ?? 0}:${columnNumber ?? 0}` : '' - throw new Error(`Browser console error: ${msg.text()}${locationSuffix}`) - } - - // Log ignored CORS-related errors for visibility - if (msg.type() === 'error' && msg.text().includes('Access to fetch at') && ignoreCORS) { - console.log(`Ignoring expected CORS-related error: ${msg.text()}`) - } - - // Log ignored network-related errors for visibility - if (msg.type() === 'error' && msg.text().includes('Failed to load resource: net::ERR_FAILED')) { - console.log(`Ignoring expected network error: ${msg.text()}`) - } - }) - - // Capture uncaught errors that do not appear in the console - page.on('pageerror', (error) => { - const message = error?.message ?? String(error) - - if (message.includes('Hydration failed because the server rendered HTML')) { - return - } - - if (shouldCollectErrors) { - const stack = error?.stack - consoleErrors.push(`Page error: ${message}${stack ? `\n${stack}` : ''}`) - } else { - // Rethrow the original error to preserve stack, name, and other metadata - throw error - } - }) - - return { - consoleErrors, - collectErrors: () => (shouldCollectErrors = true), // Enable collection of errors for specific tests - stopCollectingErrors: () => (shouldCollectErrors = false), // Disable collection of errors after the test - } -} - export function getRoutes({ customAdminRoutes, customRoutes, @@ -583,7 +485,7 @@ export async function runJobsQueue(args: RunJobsQueueArgs) { const queue = args?.queue ?? 'default' return await fetch(`${serverURL}/api/payload-jobs/run?queue=${queue}`, { - method: 'get', credentials: 'include', + method: 'get', }) } diff --git a/test/__setup/catchConsoleErrors.ts b/test/__setup/catchConsoleErrors.ts new file mode 100644 index 00000000000..72c7291a8ce --- /dev/null +++ b/test/__setup/catchConsoleErrors.ts @@ -0,0 +1,113 @@ +import type { Page } from '@playwright/test' + +/** + * Throws an error when browser console error messages (with some exceptions) are thrown, thus resulting + * in the e2e test failing. + * + * Useful to prevent the e2e test from passing when, for example, there are react missing key prop errors + * @param page + * @param options + */ +export function catchConsoleErrors(page: Page, options?: { ignoreCORS?: boolean }) { + const { ignoreCORS = false } = options || {} // Default to not ignoring CORS errors + const consoleErrors: string[] = [] + + let shouldCollectErrors = false + + page.on('console', (msg) => { + if ( + msg.type() === 'error' && + // Playwright is seemingly loading CJS files from React Select, but Next loads ESM. + // This leads to classnames not matching. Ignore these God-awful errors + // https://github.com/JedWatson/react-select/issues/3590 + !msg.text().includes('did not match. Server:') && + !msg.text().includes('Hydration failed because the server rendered HTML') && + !msg.text().includes('the server responded with a status of') && + !msg.text().includes('Failed to fetch RSC payload for') && + !msg.text().includes('Error loading language') && + !msg.text().includes('Error: NEXT_NOT_FOUND') && + !msg.text().includes('Error: NEXT_REDIRECT') && + // TanStack Start adapter nav control-flow contract (analogous to the + // NEXT_NOT_FOUND / NEXT_REDIRECT signals above). `req.server.notFound()` / + // `redirect()` thrown deep inside a streamed RSC view surface as these. + !msg.text().includes('Error: not-found') && + !msg.text().includes('Error: redirect:') && + !msg.text().includes('Error getting document data') && + !msg.text().includes('Failed trying to load default language strings') && + !msg.text().includes('TypeError: Failed to fetch') && // This happens when server actions are aborted + !msg.text().includes('TypeError: network error') && // Transient network errors during chunk loading + !msg.text().includes('der-radius: 2px Server Error: Error getting do') && // This is a weird error that happens in the console + // Expected lexical-converter warning for blocks/inline-blocks intentionally + // configured without an HTML converter (e.g. the `diff` test collection's + // `myBlock`). Logged server-side via `console.error`; harmless in Next, but + // the TanStack/vite-rsc adapter forwards server `console.error` to the + // browser console, so it would otherwise fail every diff-view test. + !msg.text().includes('no converter is provided') && + // Conditionally ignore CORS errors based on the `ignoreCORS` option + !( + ignoreCORS && + msg.text().includes('Access to fetch at') && + msg.text().includes("No 'Access-Control-Allow-Origin' header is present") + ) && + // Conditionally ignore network-related errors + !msg.text().includes('Failed to load resource: net::ERR_FAILED') + ) { + // "Failed to fetch RSC payload for" happens seemingly randomly. There are lots of issues in the next.js repository for this. Causes e2e tests to fail and flake. Will ignore for now + // the the server responded with a status of error happens frequently. Will ignore it for now. + // Most importantly, this should catch react errors. + const { url, lineNumber, columnNumber } = msg.location() || {} + const locationSuffix = url ? `\n at ${url}:${lineNumber ?? 0}:${columnNumber ?? 0}` : '' + throw new Error(`Browser console error: ${msg.text()}${locationSuffix}`) + } + + // Log ignored CORS-related errors for visibility + if (msg.type() === 'error' && msg.text().includes('Access to fetch at') && ignoreCORS) { + console.log(`Ignoring expected CORS-related error: ${msg.text()}`) + } + + // Log ignored network-related errors for visibility + if (msg.type() === 'error' && msg.text().includes('Failed to load resource: net::ERR_FAILED')) { + console.log(`Ignoring expected network error: ${msg.text()}`) + } + }) + + // Capture uncaught errors that do not appear in the console + page.on('pageerror', (error) => { + const message = error?.message ?? String(error) + + if (message.includes('Hydration failed because the server rendered HTML')) { + return + } + + if (shouldCollectErrors) { + const stack = error?.stack + consoleErrors.push(`Page error: ${message}${stack ? `\n${stack}` : ''}`) + } else { + // Rethrow the original error to preserve stack, name, and other metadata + throw error + } + }) + + // Capture uncaught errors that do not appear in the console + page.on('pageerror', (error) => { + const message = error?.message ?? String(error) + + if (message.includes('Hydration failed because the server rendered HTML')) { + return + } + + if (shouldCollectErrors) { + const stack = error?.stack + consoleErrors.push(`Page error: ${message}${stack ? `\n${stack}` : ''}`) + } else { + // Rethrow the original error to preserve stack, name, and other metadata + throw error + } + }) + + return { + consoleErrors, + collectErrors: () => (shouldCollectErrors = true), // Enable collection of errors for specific tests + stopCollectingErrors: () => (shouldCollectErrors = false), // Disable collection of errors after the test + } +} diff --git a/test/__setup/initPage.ts b/test/__setup/initPage.ts new file mode 100644 index 00000000000..0ffe4209474 --- /dev/null +++ b/test/__setup/initPage.ts @@ -0,0 +1,40 @@ +import type { BrowserContext, Page } from '@playwright/test' + +import { catchConsoleErrors } from './catchConsoleErrors.js' +import { patchPageMethods } from './patchPageMethods.js' + +type InitPageArgs = { + /** Creates the page. Ignored when `page` is supplied. */ + context?: BrowserContext + /** Whether to ignore CORS errors in the console. */ + ignoreCORS?: boolean + /** An existing page to wire up, i.e. Playwright's `{ page }` fixture. */ + page?: Page +} + +/** + * Returns a page wired up for e2e use: navigation waits for the admin view to be + * interactive, and browser console errors fail the test. + * + * Pass `context` to have the page created for you, so there is no way to end up with a + * page that skipped this setup. Pass `page` when it comes from somewhere you don't + * control, i.e. Playwright's `{ page }` fixture. + * + * @see {@link patchPageMethods} + * @see {@link catchConsoleErrors} + */ +export async function initPage({ context, ignoreCORS = false, page: incomingPage }: InitPageArgs) { + if (!context && !incomingPage) { + throw new Error('initPage requires either a `context` to create a page from, or a `page`.') + } + + const page = incomingPage ?? (await context!.newPage()) + + patchPageMethods(page) + + const { collectErrors, consoleErrors, stopCollectingErrors } = catchConsoleErrors(page, { + ignoreCORS, + }) + + return { collectErrors, consoleErrors, page, stopCollectingErrors } +} diff --git a/test/__helpers/e2e/goTo.ts b/test/__setup/patchPageMethods.ts similarity index 96% rename from test/__helpers/e2e/goTo.ts rename to test/__setup/patchPageMethods.ts index 640fc84b853..b23a42bafb0 100644 --- a/test/__helpers/e2e/goTo.ts +++ b/test/__setup/patchPageMethods.ts @@ -7,7 +7,7 @@ import type { Page } from '@playwright/test' const ADMIN_TEMPLATE_SELECTOR = '.template-default, .template-minimal' /** - * Makes `page.goto()` / `page.reload()` return only once the admin view is interactive. + * Patches `page.goto()` / `page.reload()` so it only returns once the admin view is interactive. * * On the TanStack Start adapter a full document load does not hydrate the SSR'd view in * place. `AdminPage` renders an RSC payload fetched by the route loader, so the server @@ -25,7 +25,7 @@ const ADMIN_TEMPLATE_SELECTOR = '.template-default, .template-minimal' * * Idempotent: calling this more than once on the same page is safe. */ -export function patchPageGoToWithHydrationMarker(page: Page) { +export function patchPageMethods(page: Page) { if (process.env.PAYLOAD_FRAMEWORK !== 'tanstack-start') { return } diff --git a/test/_community/e2e.spec.ts b/test/_community/e2e.spec.ts index 1f062bf2bd8..7ff0c3072ea 100644 --- a/test/_community/e2e.spec.ts +++ b/test/_community/e2e.spec.ts @@ -4,9 +4,10 @@ import { expect, test } from '@playwright/test' import * as path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -23,8 +24,7 @@ test.describe('Community', () => { url = new AdminUrlUtil(serverURL, 'posts') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/a11y/e2e.spec.ts b/test/a11y/e2e.spec.ts index ae759241a6d..2b942e5f420 100644 --- a/test/a11y/e2e.spec.ts +++ b/test/a11y/e2e.spec.ts @@ -12,11 +12,12 @@ import { assertNoHorizontalOverflow, checkHorizontalOverflow, } from '../__helpers/e2e/checkHorizontalOverflow.js' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { runAxeScan } from '../__helpers/e2e/runAxeScan.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -29,7 +30,7 @@ test.describe.skip('A11y', () => { let serverURL: string let payload: PayloadTestSDK - const DEFAULT_VIEWPORT = { width: 1280, height: 720 } + const DEFAULT_VIEWPORT = { height: 720, width: 1280 } test.beforeAll(async ({ browser }, testInfo) => { testInfo.setTimeout(TEST_TIMEOUT_LONG) @@ -38,8 +39,7 @@ test.describe.skip('A11y', () => { mediaUrl = new AdminUrlUtil(serverURL, 'media') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -56,9 +56,9 @@ test.describe.skip('A11y', () => { // @TODO: Icon-only buttons are 16px (1rem) which fails target-size (needs 24px). // Revisit as part of the v4 redesign size token pass. const accessibilityScanResults = await runAxeScan({ + exclude: ['.btn--icon-only'], page, testInfo, - exclude: ['.btn--icon-only'], }) expect.soft(accessibilityScanResults.violations.length).toEqual(0) @@ -82,9 +82,9 @@ test.describe.skip('A11y', () => { await expect(page.locator('.auth-fields')).toBeVisible() const accessibilityScanResults = await runAxeScan({ + exclude: ['.react-select'], page, testInfo, - exclude: ['.react-select'], }) expect.soft(accessibilityScanResults.violations.length).toBe(0) @@ -133,9 +133,9 @@ test.describe.skip('A11y', () => { // Revisit as part of the v4 redesign color token pass. // @TODO: noListResults fails because of the font color used, exclude for now, revisit as part of accessibility considerations. const accessibilityScanResults = await runAxeScan({ + exclude: ['.btn--style-primary', '.no-results__description'], page, testInfo, - exclude: ['.btn--style-primary', '.no-results__description'], }) expect.soft(accessibilityScanResults.violations.length).toBe(0) @@ -160,9 +160,9 @@ test.describe.skip('A11y', () => { await assertAllElementsHaveFocusIndicators({ page, + selector: '.dashboard', testInfo, verbose: false, - selector: '.dashboard', }) }) @@ -225,7 +225,7 @@ test.describe.skip('A11y', () => { test.describe('WCAG 2.1 - Reflow (320px width)', () => { test('Dashboard - should not have horizontal overflow at 320px', async ({}, testInfo) => { - await page.setViewportSize({ width: 320, height: 568 }) + await page.setViewportSize({ height: 568, width: 320 }) await page.goto(postsUrl.admin) await expect(page.locator('.dashboard')).toBeVisible() @@ -233,7 +233,7 @@ test.describe.skip('A11y', () => { }) test('Account page - should not have horizontal overflow at 320px', async ({}, testInfo) => { - await page.setViewportSize({ width: 320, height: 568 }) + await page.setViewportSize({ height: 568, width: 320 }) await page.goto(postsUrl.account) await expect(page.locator('.auth-fields')).toBeVisible() @@ -241,7 +241,7 @@ test.describe.skip('A11y', () => { }) test('Posts list view - should not have horizontal overflow at 320px', async ({}, testInfo) => { - await page.setViewportSize({ width: 320, height: 568 }) + await page.setViewportSize({ height: 568, width: 320 }) await page.goto(postsUrl.list) await expect(page.locator('.collection-list')).toBeVisible() @@ -249,7 +249,7 @@ test.describe.skip('A11y', () => { }) test('Posts create view - should not have horizontal overflow at 320px', async ({}, testInfo) => { - await page.setViewportSize({ width: 320, height: 568 }) + await page.setViewportSize({ height: 568, width: 320 }) await page.goto(postsUrl.create) await expect(page.locator('#field-title')).toBeVisible() @@ -264,7 +264,7 @@ test.describe.skip('A11y', () => { }, }) - await page.setViewportSize({ width: 320, height: 568 }) + await page.setViewportSize({ height: 568, width: 320 }) await page.goto(postsUrl.edit(newDoc.id)) await expect(page.locator('#field-title')).toBeVisible() @@ -272,7 +272,7 @@ test.describe.skip('A11y', () => { }) test('Media list view - should not have horizontal overflow at 320px', async ({}, testInfo) => { - await page.setViewportSize({ width: 320, height: 568 }) + await page.setViewportSize({ height: 568, width: 320 }) await page.goto(mediaUrl.list) await expect(page.locator('.list-controls')).toBeVisible() @@ -280,7 +280,7 @@ test.describe.skip('A11y', () => { }) test('Media create view - should not have horizontal overflow at 320px', async ({}, testInfo) => { - await page.setViewportSize({ width: 320, height: 568 }) + await page.setViewportSize({ height: 568, width: 320 }) await page.goto(mediaUrl.create) await expect(page.locator('.file-field').first()).toBeVisible() @@ -288,7 +288,7 @@ test.describe.skip('A11y', () => { }) test('Navigation sidebar - should not have horizontal overflow at 320px', async ({}, testInfo) => { - await page.setViewportSize({ width: 320, height: 568 }) + await page.setViewportSize({ height: 568, width: 320 }) await page.goto(postsUrl.admin) await expect(page.locator('.nav')).toBeVisible() @@ -328,7 +328,7 @@ test.describe.skip('A11y', () => { // @TODO: Icon-only buttons are 16px (1rem) which fails target-size (needs 24px). // Revisit as part of the v4 redesign size token pass. - const axeResults = await runAxeScan({ page, testInfo, exclude: ['.btn--icon-only'] }) + const axeResults = await runAxeScan({ exclude: ['.btn--icon-only'], page, testInfo }) expect(axeResults.violations.length).toBe(0) }) } @@ -355,7 +355,7 @@ test.describe.skip('A11y', () => { await expect(titleField).toBeVisible() // @TODO: Excluding field descriptions due to known issue - const axeResults = await runAxeScan({ page, testInfo, exclude: ['.field-description'] }) + const axeResults = await runAxeScan({ exclude: ['.field-description'], page, testInfo }) expect(axeResults.violations.length).toBe(0) }) } @@ -383,9 +383,9 @@ test.describe.skip('A11y', () => { // @TODO: Excluding checkbox-input and list-controls__create-new due to known issue color contrast const axeResults = await runAxeScan({ + exclude: ['.checkbox-input', '.list-controls__create-new'], page, testInfo, - exclude: ['.checkbox-input', '.list-controls__create-new'], }) expect(axeResults.violations.length).toBe(0) }) @@ -434,9 +434,9 @@ test.describe.skip('A11y', () => { // Revisit as part of the v4 redesign color token pass. // @TODO: .no-results__description uses --color-text-secondary (3.94:1 contrast) which fails at small font size. const axeResults = await runAxeScan({ + exclude: ['.btn--style-primary', '.no-results__description'], page, testInfo, - exclude: ['.btn--style-primary', '.no-results__description'], }) expect(axeResults.violations.length).toBe(0) }) @@ -465,7 +465,7 @@ test.describe.skip('A11y', () => { // @TODO: Icon-only buttons are 16px (1rem) which fails target-size (needs 24px). // Revisit as part of the v4 redesign size token pass. - const axeResults = await runAxeScan({ page, testInfo, exclude: ['.btn--icon-only'] }) + const axeResults = await runAxeScan({ exclude: ['.btn--icon-only'], page, testInfo }) expect(axeResults.violations.length).toBe(0) }) } diff --git a/test/a11y/focus-indicators.e2e.spec.ts b/test/a11y/focus-indicators.e2e.spec.ts index e191c713732..ecef4c796d5 100644 --- a/test/a11y/focus-indicators.e2e.spec.ts +++ b/test/a11y/focus-indicators.e2e.spec.ts @@ -5,13 +5,13 @@ import * as path from 'path' import { formatAdminURL } from 'payload/shared' import { fileURLToPath } from 'url' +import { checkFocusIndicators } from '../__helpers/e2e/checkFocusIndicators.js' import { ensureCompilationIsDone, getRoutes, - initPageConsoleErrorCatch, } from '../__helpers/e2e/helpers.js' -import { checkFocusIndicators } from '../__helpers/e2e/checkFocusIndicators.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' /** * This test suite validates the checkFocusIndicators utility against @@ -38,9 +38,8 @@ describe('Focus Indicators Test Page', () => { adminRoute = adminRouteFromConfig const context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) @@ -73,8 +72,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-good-payload"]', + testInfo, verbose: false, }) @@ -92,8 +91,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-good-html"]', + testInfo, verbose: false, }) @@ -110,8 +109,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-good-html"]', + testInfo, verbose: false, }) @@ -133,8 +132,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-pseudo"]', + testInfo, verbose: false, }) @@ -160,8 +159,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-bad"]', + testInfo, verbose: false, }) @@ -178,8 +177,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-bad"]', + testInfo, verbose: false, }) @@ -199,8 +198,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-bad"]', + testInfo, verbose: false, }) @@ -224,8 +223,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-mixed"]', + testInfo, verbose: false, }) @@ -242,8 +241,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-mixed"]', + testInfo, verbose: false, }) @@ -266,8 +265,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-edge-cases"]', + testInfo, verbose: false, }) @@ -284,8 +283,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-edge-cases"]', + testInfo, verbose: false, }) @@ -298,8 +297,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-edge-cases"]', + testInfo, verbose: false, }) @@ -312,8 +311,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-edge-cases"]', + testInfo, verbose: false, }) @@ -326,8 +325,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-edge-cases"]', + testInfo, verbose: false, }) @@ -342,12 +341,12 @@ describe('Focus Indicators Test Page', () => { await page.locator('[data-testid="section-disabled"]').waitFor() const result = await checkFocusIndicators({ + maxFocusableElements: 0, + minFocusableElements: 0, page, - testInfo, selector: '[data-testid="section-disabled"]', + testInfo, verbose: false, - minFocusableElements: 0, - maxFocusableElements: 0, }) // Disabled elements should not be in the focusable elements count @@ -362,10 +361,10 @@ describe('Focus Indicators Test Page', () => { await page.goto(formatAdminURL({ adminRoute, path: '/focus-indicators', serverURL })) const result = await checkFocusIndicators({ + maxFocusableElements: 10, page, - testInfo, selector: '[data-testid="section-good-html"]', - maxFocusableElements: 10, + testInfo, verbose: false, }) @@ -378,9 +377,9 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, - selector: '[data-testid="section-good-html"]', runAxeOnElements: true, + selector: '[data-testid="section-good-html"]', + testInfo, verbose: false, }) @@ -408,9 +407,9 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, - selector: '[data-testid="section-bad"]', runAxeOnElements: true, + selector: '[data-testid="section-bad"]', + testInfo, verbose: false, }) @@ -432,8 +431,8 @@ describe('Focus Indicators Test Page', () => { const result = await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-bad"]', + testInfo, verbose: false, }) @@ -459,8 +458,8 @@ describe('Focus Indicators Test Page', () => { await checkFocusIndicators({ page, - testInfo, selector: '[data-testid="section-bad"]', + testInfo, verbose: false, }) diff --git a/test/access-control/e2e.spec.ts b/test/access-control/e2e.spec.ts index 3fe68b6989c..a4cf717f0cb 100644 --- a/test/access-control/e2e.spec.ts +++ b/test/access-control/e2e.spec.ts @@ -17,7 +17,6 @@ import { openGroupBy } from '../__helpers/e2e/groupBy/index.js' import { ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { openDocControls } from '../__helpers/e2e/openDocControls.js' @@ -26,6 +25,7 @@ import { closeNav, openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' +import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { readRestrictedSlug } from './collections/ReadRestricted/index.js' @@ -64,7 +64,7 @@ const dirname = path.dirname(filename) * Repeat all above for globals */ -const { beforeAll, beforeEach, describe, afterEach, afterAll } = test +const { afterAll, afterEach, beforeAll, beforeEach, describe } = test let payload: PayloadTestSDK describe('Access Control', () => { @@ -110,8 +110,7 @@ describe('Access Control', () => { restrictedTrashUrl = new AdminUrlUtil(serverURL, restrictedTrashSlug) context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) @@ -901,11 +900,11 @@ describe('Access Control', () => { beforeAll(async () => { const existing = await payload.find({ collection: authSlug, - where: { email: { equals: 'test@payloadcms.com' } }, limit: 1, + where: { email: { equals: 'test@payloadcms.com' } }, }) for (const doc of existing.docs) { - await payload.delete({ collection: authSlug, id: doc.id }) + await payload.delete({ id: doc.id, collection: authSlug }) } existingDoc = await payload.create({ @@ -919,7 +918,7 @@ describe('Access Control', () => { afterAll(async () => { if (existingDoc?.id) { - await payload.delete({ collection: authSlug, id: existingDoc.id }) + await payload.delete({ id: existingDoc.id, collection: authSlug }) } }) test('should show email as readonly when user does not have update permission', async () => { @@ -1845,8 +1844,8 @@ describe('Access Control', () => { afterEach(async () => { for (const id of createdDocIds) { await payload.delete({ - collection: differentiatedTrashSlug, id, + collection: differentiatedTrashSlug, trash: true, }) } @@ -1868,7 +1867,7 @@ describe('Access Control', () => { test('should show delete button in doc controls dropdown', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Test Doc', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc' }, }) createdDocIds.push(doc.id) @@ -1884,7 +1883,7 @@ describe('Access Control', () => { test('should show delete forever checkbox in delete modal', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Test Doc', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc' }, }) createdDocIds.push(doc.id) @@ -1901,7 +1900,7 @@ describe('Access Control', () => { test('should allow permanently deleting a doc', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Test Doc For Perma Delete', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc For Perma Delete' }, }) // Don't add to createdDocIds since we're permanently deleting it @@ -1925,9 +1924,9 @@ describe('Access Control', () => { const doc = await payload.create({ collection: differentiatedTrashSlug, data: { - title: 'Admin Trashed Doc View Test', _status: 'published', deletedAt: new Date().toISOString(), + title: 'Admin Trashed Doc View Test', }, }) // Don't add to createdDocIds since we're permanently deleting it @@ -1961,12 +1960,12 @@ describe('Access Control', () => { describe('as regular user', () => { beforeAll(async () => { await login({ - page, - serverURL, data: { email: regularUserEmail, password: 'test', }, + page, + serverURL, }) }) @@ -1978,7 +1977,7 @@ describe('Access Control', () => { test('should show delete button in doc controls dropdown', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Test Doc', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc' }, }) createdDocIds.push(doc.id) @@ -1994,7 +1993,7 @@ describe('Access Control', () => { test('should hide delete forever checkbox in delete modal since user cannot permanently delete', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Test Doc', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc' }, }) createdDocIds.push(doc.id) @@ -2013,7 +2012,7 @@ describe('Access Control', () => { test('should allow trashing a doc', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Test Doc For Trash', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc For Trash' }, }) createdDocIds.push(doc.id) @@ -2036,9 +2035,9 @@ describe('Access Control', () => { const doc = await payload.create({ collection: differentiatedTrashSlug, data: { - title: 'Trashed Doc View Test', _status: 'published', deletedAt: new Date().toISOString(), + title: 'Trashed Doc View Test', }, }) createdDocIds.push(doc.id) @@ -2076,8 +2075,8 @@ describe('Access Control', () => { afterEach(async () => { for (const id of createdDocIds) { await payload.delete({ - collection: restrictedTrashSlug, id, + collection: restrictedTrashSlug, trash: true, }) } @@ -2092,7 +2091,7 @@ describe('Access Control', () => { test('should show delete button in doc controls dropdown', async () => { const doc = await payload.create({ collection: restrictedTrashSlug, - data: { title: 'Test Doc', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc' }, }) createdDocIds.push(doc.id) @@ -2108,7 +2107,7 @@ describe('Access Control', () => { test('should show delete forever checkbox in delete modal', async () => { const doc = await payload.create({ collection: restrictedTrashSlug, - data: { title: 'Test Doc', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc' }, }) createdDocIds.push(doc.id) @@ -2125,7 +2124,7 @@ describe('Access Control', () => { test('should allow trashing a doc', async () => { const doc = await payload.create({ collection: restrictedTrashSlug, - data: { title: 'Test Doc For Trash', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc For Trash' }, }) createdDocIds.push(doc.id) @@ -2146,7 +2145,7 @@ describe('Access Control', () => { test('should allow permanently deleting a doc', async () => { const doc = await payload.create({ collection: restrictedTrashSlug, - data: { title: 'Test Doc For Perma Delete', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc For Perma Delete' }, }) // Don't add to createdDocIds since we're permanently deleting it @@ -2169,12 +2168,12 @@ describe('Access Control', () => { describe('as regular user', () => { beforeAll(async () => { await login({ - page, - serverURL, data: { email: regularUserEmail, password: 'test', }, + page, + serverURL, }) }) @@ -2186,7 +2185,7 @@ describe('Access Control', () => { test('should not show doc controls popup when user has no delete access', async () => { const doc = await payload.create({ collection: restrictedTrashSlug, - data: { title: 'Test Doc', _status: 'published' }, + data: { _status: 'published', title: 'Test Doc' }, }) createdDocIds.push(doc.id) @@ -2209,8 +2208,8 @@ describe('Access Control', () => { afterEach(async () => { for (const id of createdDocIds) { await payload.delete({ - collection: differentiatedTrashSlug, id, + collection: differentiatedTrashSlug, trash: true, }) } @@ -2225,7 +2224,7 @@ describe('Access Control', () => { test('should show delete button when selecting docs in list view', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Bulk Test Doc 1', _status: 'published' }, + data: { _status: 'published', title: 'Bulk Test Doc 1' }, }) createdDocIds.push(doc.id) @@ -2252,12 +2251,12 @@ describe('Access Control', () => { describe('as regular user', () => { beforeAll(async () => { await login({ - page, - serverURL, data: { email: regularUserEmail, password: 'test', }, + page, + serverURL, }) }) @@ -2268,7 +2267,7 @@ describe('Access Control', () => { test('should show delete button when selecting docs in list view (user can trash)', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Bulk Test Doc Regular User', _status: 'published' }, + data: { _status: 'published', title: 'Bulk Test Doc Regular User' }, }) createdDocIds.push(doc.id) @@ -2294,7 +2293,7 @@ describe('Access Control', () => { test('should hide delete permanently checkbox in bulk delete modal', async () => { const doc = await payload.create({ collection: differentiatedTrashSlug, - data: { title: 'Bulk Test Doc Regular User 2', _status: 'published' }, + data: { _status: 'published', title: 'Bulk Test Doc Regular User 2' }, }) createdDocIds.push(doc.id) @@ -2328,8 +2327,8 @@ describe('Access Control', () => { afterEach(async () => { for (const id of createdDocIds) { await payload.delete({ - collection: restrictedTrashSlug, id, + collection: restrictedTrashSlug, trash: true, }) } @@ -2344,7 +2343,7 @@ describe('Access Control', () => { test('should show delete button when selecting docs in list view', async () => { const doc = await payload.create({ collection: restrictedTrashSlug, - data: { title: 'Restricted Bulk Test Doc', _status: 'published' }, + data: { _status: 'published', title: 'Restricted Bulk Test Doc' }, }) createdDocIds.push(doc.id) @@ -2371,12 +2370,12 @@ describe('Access Control', () => { describe('as regular user', () => { beforeAll(async () => { await login({ - page, - serverURL, data: { email: regularUserEmail, password: 'test', }, + page, + serverURL, }) }) @@ -2387,7 +2386,7 @@ describe('Access Control', () => { test('should not show delete button when selecting docs in list view (user cannot trash or delete)', async () => { const doc = await payload.create({ collection: restrictedTrashSlug, - data: { title: 'Restricted Bulk Test Doc Regular User', _status: 'published' }, + data: { _status: 'published', title: 'Restricted Bulk Test Doc Regular User' }, }) createdDocIds.push(doc.id) @@ -2421,8 +2420,8 @@ describe('Access Control', () => { for (const id of createdDocIds) { try { await payload.delete({ - collection: differentiatedTrashSlug, id, + collection: differentiatedTrashSlug, trash: true, }) } catch (_e) { @@ -2442,9 +2441,9 @@ describe('Access Control', () => { const doc = await payload.create({ collection: differentiatedTrashSlug, data: { - title: 'Trash View Bulk Test Admin', _status: 'published', deletedAt: new Date().toISOString(), + title: 'Trash View Bulk Test Admin', }, }) createdDocIds.push(doc.id) @@ -2472,12 +2471,12 @@ describe('Access Control', () => { describe('as regular user', () => { beforeAll(async () => { await login({ - page, - serverURL, data: { email: regularUserEmail, password: 'test', }, + page, + serverURL, }) }) @@ -2490,9 +2489,9 @@ describe('Access Control', () => { const doc = await payload.create({ collection: differentiatedTrashSlug, data: { - title: 'Trash View Bulk Test Regular', _status: 'published', deletedAt: new Date().toISOString(), + title: 'Trash View Bulk Test Regular', }, }) createdDocIds.push(doc.id) diff --git a/test/admin-bar/e2e.spec.ts b/test/admin-bar/e2e.spec.ts index 1681015dcf9..12513286aff 100644 --- a/test/admin-bar/e2e.spec.ts +++ b/test/admin-bar/e2e.spec.ts @@ -5,9 +5,10 @@ import * as path from 'path' import { formatAdminURL } from 'payload/shared' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -26,8 +27,7 @@ test.describe('Admin Bar', () => { serverURL = incomingServerURL const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL: incomingServerURL }) }) diff --git a/test/admin-root/e2e.spec.ts b/test/admin-root/e2e.spec.ts index 8fbcc946c49..06a09d778ec 100644 --- a/test/admin-root/e2e.spec.ts +++ b/test/admin-root/e2e.spec.ts @@ -7,12 +7,12 @@ import { fileURLToPath } from 'url' import { login } from '../__helpers/e2e/auth/login.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, // throttleTest, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { adminRoute } from './shared.js' @@ -43,8 +43,7 @@ test.describe('Admin Panel (Root)', () => { }) context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ customRoutes: { diff --git a/test/admin/e2e/command-palette/e2e.spec.ts b/test/admin/e2e/command-palette/e2e.spec.ts index 8a67aebc4d1..447d6931794 100644 --- a/test/admin/e2e/command-palette/e2e.spec.ts +++ b/test/admin/e2e/command-palette/e2e.spec.ts @@ -9,10 +9,10 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, getRoutes, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { BASE_PATH, customAdminRoutes } from '../../shared.js' import { globalSlug, postsCollectionSlug } from '../../slugs.js' @@ -54,8 +54,7 @@ test.describe('Command Palette', () => { })) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ customAdminRoutes, page, serverURL }) diff --git a/test/admin/e2e/document-view/e2e.spec.ts b/test/admin/e2e/document-view/e2e.spec.ts index f0a8349f3a9..fab854a7c31 100644 --- a/test/admin/e2e/document-view/e2e.spec.ts +++ b/test/admin/e2e/document-view/e2e.spec.ts @@ -10,12 +10,12 @@ import { checkPageTitle, ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { test } from '../../../__helpers/e2e/playwright.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { BASE_PATH, customAdminRoutes, @@ -103,8 +103,7 @@ describe('Document View', () => { localizedURL = new AdminUrlUtil(serverURL, localizedCollectionSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ customAdminRoutes, page, serverURL }) }) @@ -923,10 +922,10 @@ describe('Document View', () => { await page.goto(postsUrl.create) await page.locator('#field-title').fill('heros') await selectInput({ - page, + filter: 'sean', multiSelect: false, option: 'sean', - filter: 'sean', + page, selectLocator: page.locator('#field-relationship'), selectType: 'relationship', }) diff --git a/test/admin/e2e/general/e2e.spec.ts b/test/admin/e2e/general/e2e.spec.ts index 694a6179c5f..162f1652a70 100644 --- a/test/admin/e2e/general/e2e.spec.ts +++ b/test/admin/e2e/general/e2e.spec.ts @@ -8,7 +8,6 @@ import type { Config, Geo, Post } from '../../payload-types.js' import { ensureCompilationIsDone, getRoutes, - initPageConsoleErrorCatch, openLocaleSelector, saveDocAndAssert, saveDocHotkeyAndAssert, @@ -17,6 +16,7 @@ import { import { test } from '../../../__helpers/e2e/playwright.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { BASE_PATH, customAdminRoutes, @@ -104,8 +104,7 @@ describe('General', () => { uploadsTwo = new AdminUrlUtil(serverURL, uploadTwoCollectionSlug) context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ customAdminRoutes, page, serverURL }) diff --git a/test/admin/e2e/list-view/e2e.spec.ts b/test/admin/e2e/list-view/e2e.spec.ts index 716a20ccb10..7d25479d039 100644 --- a/test/admin/e2e/list-view/e2e.spec.ts +++ b/test/admin/e2e/list-view/e2e.spec.ts @@ -10,11 +10,11 @@ import { ensureCompilationIsDone, exactText, getRoutes, - initPageConsoleErrorCatch, openColumnControls, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { BASE_PATH, customAdminRoutes } from '../../shared.js' import { arrayCollectionSlug, @@ -116,8 +116,7 @@ describe('List View', () => { noTimestampsUrl = new AdminUrlUtil(serverURL, noTimestampsSlug) customFieldsUrl = new AdminUrlUtil(serverURL, customFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ customAdminRoutes, page, serverURL }) @@ -397,9 +396,9 @@ describe('List View', () => { await page.goto(postsUrl.list) await addListFilter({ - page, fieldLabel: 'Relationship', operatorLabel: 'equals', + page, value: 'post1', }) @@ -442,9 +441,9 @@ describe('List View', () => { await expect(page.locator(tableRowLocator)).toHaveCount(2) await addListFilter({ - page, fieldLabel: 'ID', operatorLabel: 'equals', + page, value: id, }) @@ -503,9 +502,9 @@ describe('List View', () => { await expect(page.locator(tableRowLocator)).toHaveCount(2) await addListFilter({ - page, fieldLabel: 'Virtual Title From Post', operatorLabel: 'equals', + page, value: 'somePost', }) @@ -519,9 +518,9 @@ describe('List View', () => { await expect(page.locator(tableRowLocator)).toHaveCount(1) await addListFilter({ - page, fieldLabel: 'Array > Text', operatorLabel: 'equals', + page, value: 'test', }) @@ -529,9 +528,9 @@ describe('List View', () => { await page.locator('.condition__actions .btn.condition__actions-remove').first().click() await addListFilter({ - page, fieldLabel: 'Array > Text', operatorLabel: 'equals', + page, value: 'not-matching', }) @@ -542,9 +541,9 @@ describe('List View', () => { const id = (await page.locator('.cell-id').first().innerText()).replace('ID: ', '') const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'ID', operatorLabel: 'equals', + page, value: id, }) @@ -567,9 +566,9 @@ describe('List View', () => { await page.goto(postsUrl.list) const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'Relationship', operatorLabel: 'equals', + page, value: 'post1', }) @@ -588,9 +587,9 @@ describe('List View', () => { await page.goto(postsUrl.list) const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'Relationship', operatorLabel: 'equals', + page, value: 'post1', }) @@ -736,9 +735,9 @@ describe('List View', () => { await page.goto(`${postsUrl.list}?limit=5&page=2`) await addListFilter({ - page, fieldLabel: 'Title', operatorLabel: 'equals', + page, value: 'test', }) @@ -750,9 +749,9 @@ describe('List View', () => { await page.goto(postsUrl.list) const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'Title', operatorLabel: 'equals', + page, value: 'Test', }) @@ -768,9 +767,9 @@ describe('List View', () => { await page.goto(postsUrl.list) const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'Title', operatorLabel: 'equals', + page, }) const valueInput = whereBuilder.locator('.condition__value >> input') @@ -792,9 +791,9 @@ describe('List View', () => { await expect(page.locator(tableRowLocator)).toHaveCount(2) const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'Title', operatorLabel: 'equals', + page, value: 'post1', }) @@ -817,9 +816,9 @@ describe('List View', () => { await page.goto(postsUrl.list) const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'Title', operatorLabel: 'equals', + page, value: 'Test 1', }) @@ -927,9 +926,9 @@ describe('List View', () => { await page.goto(with300DocumentsUrl.list) const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'Self Relation', operatorLabel: 'equals', + page, }) const valueField = whereBuilder.locator('.condition__value') @@ -1054,8 +1053,8 @@ describe('List View', () => { const doc = await payload.create({ collection: listViewSelectAPISlug, data: { - title: 'This is a test title', description: 'This is a test description', + title: 'This is a test title', }, }) @@ -1073,8 +1072,8 @@ describe('List View', () => { return Boolean(parsedResult[0].id && parsedResult[0].description) }, { - timeout: 3000, intervals: [100, 250, 500, 1000], + timeout: 3000, }, ) .toBeTruthy() @@ -1097,8 +1096,8 @@ describe('List View', () => { return Boolean(parsedResult[0].description === undefined && parsedResult[0].id) }, { - timeout: 3000, intervals: [100, 250, 500, 1000], + timeout: 3000, }, ) .toBeTruthy() @@ -1108,11 +1107,11 @@ describe('List View', () => { const doc = await payload.create({ collection: listViewSelectAPISlug, data: { - title: 'This is a test title', description: 'This is a test description', group: { groupNameField: 'Select Nested Field', }, + title: 'This is a test title', }, }) @@ -1167,7 +1166,7 @@ describe('List View', () => { await page.reload() // The `columns` search params _should_ contain "-id" - await waitForColumnInURL({ page, columnName: 'id', state: 'off' }) + await waitForColumnInURL({ columnName: 'id', page, state: 'off' }) expect(true).toBe(true) }) @@ -1175,8 +1174,8 @@ describe('List View', () => { test('should not inject default columns into URL search params on load', async () => { // clear preferences first, ensure that they don't automatically populate in the URL on load await deletePreferences({ - payload, key: `${postsCollectionSlug}.list`, + payload, user, }) @@ -1229,8 +1228,8 @@ describe('List View', () => { test('should render top-level field and group field with same name in separate columns', async () => { await createPost({ - someTextField: 'top-level text field', namedGroup: { someTextField: 'nested group text field' }, + someTextField: 'top-level text field', }) await page.goto(postsUrl.list) @@ -1349,11 +1348,11 @@ describe('List View', () => { }) await toggleColumn(page, { - togglerSelector: '[id^=list-drawer_1_] .columns-button__button', columnContainerSelector: '.column-selector', columnLabel: 'ID', - targetState: 'off', expectURLChange: false, + targetState: 'off', + togglerSelector: '[id^=list-drawer_1_] .columns-button__button', }) await closeListDrawer({ page }) @@ -1389,7 +1388,7 @@ describe('List View', () => { test('should reset default columns', async () => { await page.goto(postsUrl.list) - await toggleColumn(page, { columnLabel: 'ID', targetState: 'off', columnName: 'id' }) + await toggleColumn(page, { columnLabel: 'ID', columnName: 'id', targetState: 'off' }) // should not have the ID column #heading-id await expect(page.locator('#heading-id')).toBeHidden() @@ -1485,7 +1484,7 @@ describe('List View', () => { await expect.poll(async () => await page.locator('.per-page button').isVisible()).toBe(true) - await expectPerPageLimits({ page, expectedLimits: [5, 10, 15] }) + await expectPerPageLimits({ expectedLimits: [5, 10, 15], page }) }) test('should paginate', async () => { @@ -1500,7 +1499,7 @@ describe('List View', () => { await wait(1000) // Set per-page limit to 5 - await setPerPageLimit({ page, limit: 5 }) + await setPerPageLimit({ limit: 5, page }) await expect.poll(async () => await page.locator(tableRowLocator).count()).toBe(5) await expect(page.locator('.page-controls__page-info')).toHaveText('1-5 of 6') @@ -1528,7 +1527,7 @@ describe('List View', () => { await wait(1000) // Set per-page limit to 5 first - await setPerPageLimit({ page, limit: 5 }) + await setPerPageLimit({ limit: 5, page }) const tableItems = page.locator(tableRowLocator) await expect.poll(async () => await tableItems.count()).toBe(5) @@ -1537,14 +1536,14 @@ describe('List View', () => { await wait(500) // Now change to 15 - await setPerPageLimit({ page, limit: 15 }) + await setPerPageLimit({ limit: 15, page }) await expect(tableItems).toHaveCount(15) await goToNextPage(page) await wait(500) await expect(tableItems).toHaveCount(1) - await expectPerPageLimits({ page, expectedLimits: [5, 10, 15] }) + await expectPerPageLimits({ expectedLimits: [5, 10, 15], page }) await expect(page.locator('.page-controls__page-info')).toHaveText('16-16 of 16') }) @@ -1557,7 +1556,7 @@ describe('List View', () => { await wait(1000) - await setPerPageLimit({ page, limit: 5 }) + await setPerPageLimit({ limit: 5, page }) // Wait for the table to reflect the new limit before reading the first // page's rows. `setPerPageLimit` only waits for the URL to update; the @@ -1582,13 +1581,13 @@ describe('List View', () => { await mapAsync([...Array(20)], async (_, i) => { await payload.create({ - disableTransaction: true, collection: listDrawerSlug, data: { - title: `List Drawer Item ${i + 1}`, description: `Description ${i + 1}`, number: i + 1, + title: `List Drawer Item ${i + 1}`, }, + disableTransaction: true, }) }) @@ -1612,7 +1611,7 @@ describe('List View', () => { await expect(page.locator('.list-drawer table tbody tr')).toHaveCount(10) // Change per-page to 5 - await setPerPageLimit({ page, limit: 5, scope: listDrawer, waitForURL: false }) + await setPerPageLimit({ limit: 5, page, scope: listDrawer, waitForURL: false }) await expect(page.locator('.list-drawer table tbody tr')).toHaveCount(5) @@ -1636,9 +1635,9 @@ describe('List View', () => { // delete all posts created by the seed await deleteAllPosts() await createPost({ - number: 1, namedGroup: { someTextField: 'nested group text field' }, namedTab: { nestedTextFieldInNamedTab: 'nested text in named tab' }, + number: 1, }) await createPost({ number: 2 }) }) @@ -1731,7 +1730,7 @@ describe('List View', () => { test('should sort with existing filters', async () => { await page.goto(postsUrl.list) - await toggleColumn(page, { columnLabel: 'ID', targetState: 'off', columnName: 'id' }) + await toggleColumn(page, { columnLabel: 'ID', columnName: 'id', targetState: 'off' }) await page.locator('#heading-id').waitFor({ state: 'detached' }) await page.locator('#heading-title button.sort-column__asc').click() @@ -1774,7 +1773,7 @@ describe('List View', () => { await page.waitForURL(/sort=title/) // enable a column that is _not_ part of this collection's default columns - await toggleColumn(page, { columnLabel: 'Status', targetState: 'on', columnName: '_status' }) + await toggleColumn(page, { columnLabel: 'Status', columnName: '_status', targetState: 'on' }) await wait(500) @@ -1791,15 +1790,15 @@ describe('List View', () => { await toggleColumn(page, { columnLabel: 'Wavelengths', - targetState: 'on', columnName: 'wavelengths', + targetState: 'on', }) await wait(500) await toggleColumn(page, { columnLabel: 'Select Field', - targetState: 'on', columnName: 'selectField', + targetState: 'on', }) await wait(500) @@ -1997,12 +1996,12 @@ describe('List View', () => { // Create test documents await payload.create({ collection: formatDocURLCollectionSlug, - data: { title: 'no-link', description: 'This should not be linkable' }, + data: { description: 'This should not be linkable', title: 'no-link' }, }) const normalDoc = await payload.create({ collection: formatDocURLCollectionSlug, - data: { title: 'normal', description: 'This should be linkable normally' }, + data: { description: 'This should be linkable normally', title: 'normal' }, }) await page.goto(formatDocURLUrl.list) @@ -2028,7 +2027,7 @@ describe('List View', () => { test('should use custom destination for documents with title "custom-link"', async () => { await payload.create({ collection: formatDocURLCollectionSlug, - data: { title: 'custom-link', description: 'This should link to custom destination' }, + data: { description: 'This should link to custom destination', title: 'custom-link' }, }) await page.goto(formatDocURLUrl.list) @@ -2046,7 +2045,7 @@ describe('List View', () => { // This test verifies the user-based URL modification const adminDoc = await payload.create({ collection: formatDocURLCollectionSlug, - data: { title: 'admin-test', description: 'This should have admin query param' }, + data: { description: 'This should have admin query param', title: 'admin-test' }, }) await page.goto(formatDocURLUrl.list) @@ -2069,13 +2068,13 @@ describe('List View', () => { // Create a document and then move it to trash const trashDoc = await payload.create({ collection: formatDocURLCollectionSlug, - data: { title: 'trash-test', description: 'This should show trash URL' }, + data: { description: 'This should show trash URL', title: 'trash-test' }, }) // Move the document to trash by setting deletedAt (not delete) await payload.update({ - collection: formatDocURLCollectionSlug, id: trashDoc.id, + collection: formatDocURLCollectionSlug, data: { deletedAt: new Date().toISOString(), }, @@ -2103,9 +2102,9 @@ describe('List View', () => { const publishedDoc = await payload.create({ collection: formatDocURLCollectionSlug, data: { - title: 'published-test', - description: 'This is a published document', _status: 'published', + description: 'This is a published document', + title: 'published-test', }, }) @@ -2128,12 +2127,12 @@ describe('List View', () => { test('should disable linking in ListDrawer for documents with formatDocURL returning null', async () => { await payload.create({ collection: formatDocURLCollectionSlug, - data: { title: 'no-link', description: 'This should not be linkable in drawer' }, + data: { description: 'This should not be linkable in drawer', title: 'no-link' }, }) await payload.create({ collection: formatDocURLCollectionSlug, - data: { title: 'linkable', description: 'This should be linkable in drawer' }, + data: { description: 'This should be linkable in drawer', title: 'linkable' }, }) await page.goto(formatDocURLUrl.list) @@ -2167,12 +2166,12 @@ describe('List View', () => { async function createPost(overrides?: Partial): Promise { return payload.create({ collection: postsCollectionSlug, - disableTransaction: true, data: { description, title, ...overrides, }, + disableTransaction: true, }) as unknown as Promise } @@ -2183,42 +2182,42 @@ async function deleteAllPosts() { async function createGeo(overrides?: Partial): Promise { return payload.create({ collection: geoCollectionSlug, - disableTransaction: true, data: { point: [4, -4], ...overrides, }, + disableTransaction: true, }) as unknown as Promise } async function createNoTimestampPost(overrides?: Partial): Promise { return payload.create({ collection: noTimestampsSlug, - disableTransaction: true, data: { title, ...overrides, }, + disableTransaction: true, }) as unknown as Promise } async function createArray() { return payload.create({ - disableTransaction: true, collection: arrayCollectionSlug, data: { array: [{ text: 'test' }], }, + disableTransaction: true, }) } async function createVirtualDoc(overrides?: Partial): Promise { return payload.create({ collection: virtualsSlug, - disableTransaction: true, data: { post: overrides?.post, ...overrides, }, + disableTransaction: true, }) as unknown as Promise } diff --git a/test/admin/e2e/sidebar-tabs/e2e.spec.ts b/test/admin/e2e/sidebar-tabs/e2e.spec.ts index 64431b80c4a..c060bb2a8f7 100644 --- a/test/admin/e2e/sidebar-tabs/e2e.spec.ts +++ b/test/admin/e2e/sidebar-tabs/e2e.spec.ts @@ -2,15 +2,16 @@ import type { Page } from '@playwright/test' import { expect, test } from '@playwright/test' import path from 'path' -import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { fileURLToPath } from 'url' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../../../helpers.js' -import { AdminUrlUtil } from '../../../helpers/adminUrlUtil.js' -import { openNav } from '../../../helpers/e2e/toggleNav.js' -import { initPayloadE2ENoConfig } from '../../../helpers/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' +import { openNav } from '../../../__helpers/e2e/toggleNav.js' +import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' +import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' +import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' const filename = fileURLToPath(import.meta.url) const currentFolder = path.dirname(filename) @@ -33,9 +34,8 @@ describe('Sidebar Tabs', () => { adminUrl = new AdminUrlUtil(serverURL, 'admin') const context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/admin/e2e/tooltip/e2e.spec.ts b/test/admin/e2e/tooltip/e2e.spec.ts index e41a3c1860a..8b3224853b7 100644 --- a/test/admin/e2e/tooltip/e2e.spec.ts +++ b/test/admin/e2e/tooltip/e2e.spec.ts @@ -8,10 +8,10 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -30,8 +30,7 @@ test.describe('Tooltip', () => { url = new AdminUrlUtil(serverURL, 'posts') context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/auth-basic/e2e.spec.ts b/test/auth-basic/e2e.spec.ts index b65fc122565..f917256f26e 100644 --- a/test/auth-basic/e2e.spec.ts +++ b/test/auth-basic/e2e.spec.ts @@ -12,11 +12,11 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, getRoutes, - initPageConsoleErrorCatch, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -83,25 +83,24 @@ describe('Auth (Basic)', () => { url = new AdminUrlUtil(serverURL, 'users') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) const { routes: { admin }, } = getRoutes({}) adminRoute = admin await ensureCompilationIsDone({ + noAutoLogin: true, page, + readyURL: formatAdminURL({ adminRoute, path: '/**', serverURL }), serverURL, - readyURL: formatAdminURL({ path: '/**', serverURL, adminRoute }), - noAutoLogin: true, }) // Undo onInit seeding, as we need to test this without having a user created, or testing create-first-user await reInitializeDB({ + deleteOnly: true, serverURL, snapshotKey: 'auth-basic', - deleteOnly: true, }) await payload.delete({ @@ -115,8 +114,8 @@ describe('Auth (Basic)', () => { await ensureCompilationIsDone({ page, + readyURL: formatAdminURL({ adminRoute, path: '/create-first-user', serverURL }), serverURL, - readyURL: formatAdminURL({ path: '/create-first-user', serverURL, adminRoute }), }) }) diff --git a/test/auth/e2e.spec.ts b/test/auth/e2e.spec.ts index 0535c94576b..ccf0fdc7f6b 100644 --- a/test/auth/e2e.spec.ts +++ b/test/auth/e2e.spec.ts @@ -14,12 +14,12 @@ import { logout } from '../__helpers/e2e/auth/logout.js' import { ensureCompilationIsDone, getRoutes, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { apiKeysSlug, BASE_PATH, slug } from './shared.js' @@ -30,7 +30,7 @@ process.env.NEXT_BASE_PATH = BASE_PATH let payload: PayloadTestSDK -const { beforeAll, beforeEach, afterAll, describe } = test +const { afterAll, beforeAll, beforeEach, describe } = test const headers = { 'Content-Type': 'application/json', @@ -56,18 +56,17 @@ describe('Auth', () => { adminRoute = adminRouteFromConfig context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL, noAutoLogin: true }) + await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) }) describe('create first user', () => { beforeEach(async () => { await reInitializeDB({ + deleteOnly: true, serverURL, snapshotKey: 'create-first-user', - deleteOnly: true, }) await payload.delete({ @@ -169,9 +168,9 @@ describe('Auth', () => { describe('non create first user', () => { beforeAll(async () => { await reInitializeDB({ + deleteOnly: false, serverURL, snapshotKey: 'auth', - deleteOnly: false, }) await login({ page, serverURL }) @@ -527,12 +526,12 @@ describe('Auth', () => { describe('autoRefresh', () => { beforeAll(async () => { await reInitializeDB({ + deleteOnly: false, serverURL, snapshotKey: 'auth', - deleteOnly: false, }) - await ensureCompilationIsDone({ page, serverURL, noAutoLogin: true }) + await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) url = new AdminUrlUtil(serverURL, slug) diff --git a/test/auth/payload-types.ts b/test/auth/payload-types.ts index 8c516cd5e88..ee16a40f854 100644 --- a/test/auth/payload-types.ts +++ b/test/auth/payload-types.ts @@ -144,6 +144,8 @@ export interface Config { locale: null; widgets: { collections: CollectionsWidget; + 'collection-query': CollectionQueryWidget; + activity: ActivityWidget; }; user: | User @@ -755,6 +757,56 @@ export interface CollectionsWidget { }; width: 'full'; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "collection-query_widget". + */ +export interface CollectionQueryWidget { + data?: { + title?: string | null; + relatedCollection: + | 'users' + | 'partial-disable-local-strategies' + | 'disable-local-strategy-password' + | 'api-keys' + | 'public-users' + | 'relationsCollection' + | 'api-keys-with-field-read-access'; + where?: + | { + [k: string]: unknown; + } + | unknown[] + | string + | number + | boolean + | null; + sortField?: string | null; + sortDirection?: ('asc' | 'desc') | null; + limit?: number | null; + }; + width: 'x-small' | 'small' | 'medium' | 'large' | 'x-large' | 'full'; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "activity_widget". + */ +export interface ActivityWidget { + data?: { + excludedCollections?: + | ( + | 'users' + | 'partial-disable-local-strategies' + | 'disable-local-strategy-password' + | 'api-keys' + | 'public-users' + | 'relationsCollection' + | 'api-keys-with-field-read-access' + )[] + | null; + }; + width: 'x-small' | 'small' | 'medium' | 'large' | 'x-large' | 'full'; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "MyBlock". diff --git a/test/base-path/e2e.spec.ts b/test/base-path/e2e.spec.ts index 8aa24a54f16..8432dea52eb 100644 --- a/test/base-path/e2e.spec.ts +++ b/test/base-path/e2e.spec.ts @@ -9,11 +9,11 @@ import { login } from '../__helpers/e2e/auth/login.js' import { goToListDoc } from '../__helpers/e2e/goToListDoc.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { BASE_PATH } from './shared.js' @@ -37,8 +37,7 @@ test.describe('Base Path', () => { url = new AdminUrlUtil(serverURL, 'posts') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ noAutoLogin: true, diff --git a/test/bulk-edit/e2e.spec.ts b/test/bulk-edit/e2e.spec.ts index 1f5deafbc3b..9138f9a6bca 100644 --- a/test/bulk-edit/e2e.spec.ts +++ b/test/bulk-edit/e2e.spec.ts @@ -15,7 +15,6 @@ import { ensureCompilationIsDone, exactText, findTableCell, - initPageConsoleErrorCatch, selectTableRow, // throttleTest, } from '../__helpers/e2e/helpers.js' @@ -24,6 +23,7 @@ import { toggleBlockOrArrayRow } from '../__helpers/e2e/toggleCollapsible.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { postsSlug, tabsSlug } from './shared.js' @@ -46,8 +46,7 @@ test.describe('Bulk Edit', () => { tabsUrl = new AdminUrlUtil(serverURL, tabsSlug) context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -216,8 +215,8 @@ test.describe('Bulk Edit', () => { await page.locator('.edit-many__toggle').click() const { field, modal } = await selectFieldToEdit(page, { - fieldLabel: 'Title', fieldID: 'title', + fieldLabel: 'Title', }) await field.fill(updatedPostTitle) @@ -261,8 +260,8 @@ test.describe('Bulk Edit', () => { await page.locator('.edit-many__toggle').click() const { field, modal } = await selectFieldToEdit(page, { - fieldLabel: 'Description', fieldID: 'description', + fieldLabel: 'Description', }) await field.fill(description) @@ -305,8 +304,8 @@ test.describe('Bulk Edit', () => { await page.locator('.edit-many__toggle').click() const { field, modal } = await selectFieldToEdit(page, { - fieldLabel: 'Description', fieldID: 'description', + fieldLabel: 'Description', }) await field.fill(description) @@ -399,8 +398,8 @@ test.describe('Bulk Edit', () => { await page.locator('.edit-many__toggle').click() const { field } = await selectFieldToEdit(page, { - fieldLabel: 'Title', fieldID: 'title', + fieldLabel: 'Title', }) const updatedTitle = 'Post (Updated)' @@ -419,28 +418,28 @@ test.describe('Bulk Edit', () => { await deleteAllPosts() const postData: RequiredDataFromCollectionSlug<'posts'> = { - title: 'Post 1', array: [ { - optional: 'some optional array field', innerArrayOfFields: [ { innerOptional: 'some inner optional array field', }, ], + optional: 'some optional array field', }, ], - group: { - defaultValueField: 'This is NOT the default value', - title: 'some title', - }, blocks: [ { - textFieldForBlock: 'some text for block text', blockType: 'textBlock', + textFieldForBlock: 'some text for block text', }, ], defaultValueField: 'This is NOT the default value', + group: { + defaultValueField: 'This is NOT the default value', + title: 'some title', + }, + title: 'Post 1', } const updatedPostTitle = 'Post 1 (Updated)' @@ -454,8 +453,8 @@ test.describe('Bulk Edit', () => { const { modal } = await selectAllAndEditMany(page) const { field } = await selectFieldToEdit(page, { - fieldLabel: 'Title', fieldID: 'title', + fieldLabel: 'Title', }) await field.fill(updatedPostTitle) @@ -467,8 +466,8 @@ test.describe('Bulk Edit', () => { const updatedPost = await payload.find({ collection: postsSlug, - limit: 1, depth: 0, + limit: 1, where: { id: { equals: postID, @@ -493,9 +492,9 @@ test.describe('Bulk Edit', () => { await selectAllAndEditMany(page) - const { modal, field } = await selectFieldToEdit(page, { - fieldLabel: 'Group > Title', + const { field, modal } = await selectFieldToEdit(page, { fieldID: 'group__title', + fieldLabel: 'Group > Title', }) await field.fill('New Group Title') @@ -546,7 +545,7 @@ test.describe('Bulk Edit', () => { await selectAllAndEditMany(page) - const { field } = await selectFieldToEdit(page, { fieldLabel: 'Array', fieldID: 'array' }) + const { field } = await selectFieldToEdit(page, { fieldID: 'array', fieldLabel: 'Array' }) await wait(500) @@ -559,10 +558,10 @@ test.describe('Bulk Edit', () => { await expect(page.locator(`#field-array__0__optional`)).toBeHidden() await toggleBlockOrArrayRow({ + fieldName: 'array', page, - targetState: 'open', rowIndex: 0, - fieldName: 'array', + targetState: 'open', }) await expect(field.locator('#field-array__0__optional')).toBeVisible() @@ -606,7 +605,7 @@ test.describe('Bulk Edit', () => { const postCount = 3 for (let i = 1; i <= postCount; i++) { - await createPost({ title: `Post ${i}`, _status: 'published' }) + await createPost({ _status: 'published', title: `Post ${i}` }) // Wait 50ms to ensure the createdAt date is different enough to ensure posts are in the correct order await wait(50) } @@ -685,7 +684,6 @@ test.describe('Bulk Edit', () => { const originalDoc = await payload.create({ collection: tabsSlug, data: { - title: 'Tab Title', tabTab: { tabTabArray: [ { @@ -693,6 +691,7 @@ test.describe('Bulk Edit', () => { }, ], }, + title: 'Tab Title', }, }) @@ -700,9 +699,9 @@ test.describe('Bulk Edit', () => { // Wait until page has limit in the url, to ensure it is fully loaded await expect.poll(() => page.url(), { timeout: POLL_TOPASS_TIMEOUT }).toContain('limit=') await addListFilter({ - page, fieldLabel: 'ID', operatorLabel: 'equals', + page, value: originalDoc.id, }) @@ -719,10 +718,10 @@ test.describe('Bulk Edit', () => { await expect(bulkEditForm).toBeVisible() await selectInput({ + multiSelect: true, + options: ['Title'], page, selectLocator: bulkEditForm.locator('.react-select'), - options: ['Title'], - multiSelect: true, }) await bulkEditForm.locator('#field-title').fill('Updated Tab Title') @@ -751,10 +750,10 @@ test.describe('Bulk Edit', () => { const originalDoc = await payload.create({ collection: tabsSlug, data: { - title: 'Tab Doc', tabTab: { tabText: 'original value', }, + title: 'Tab Doc', }, }) @@ -762,9 +761,9 @@ test.describe('Bulk Edit', () => { await expect.poll(() => page.url(), { timeout: POLL_TOPASS_TIMEOUT }).toContain('limit=') await addListFilter({ - page, fieldLabel: 'ID', operatorLabel: 'equals', + page, value: originalDoc.id, }) @@ -779,10 +778,10 @@ test.describe('Bulk Edit', () => { await expect(bulkEditForm).toBeVisible() await selectInput({ + multiSelect: true, + options: ['Tab Text'], page, selectLocator: bulkEditForm.locator('.react-select'), - options: ['Tab Text'], - multiSelect: true, }) await bulkEditForm.getByLabel('Tab Text').fill('updated value') @@ -804,7 +803,7 @@ test.describe('Bulk Edit', () => { .poll(() => updatedDoc?.tabTab?.tabText, { timeout: POLL_TOPASS_TIMEOUT }) .toEqual('updated value') - await payload.delete({ collection: tabsSlug, id: originalDoc.id }) + await payload.delete({ id: originalDoc.id, collection: tabsSlug }) }) test('should show clean labels for fields inside label-false groups and rows', async () => { @@ -817,9 +816,9 @@ test.describe('Bulk Edit', () => { await expect.poll(() => page.url(), { timeout: POLL_TOPASS_TIMEOUT }).toContain('limit=') await addListFilter({ - page, fieldLabel: 'ID', operatorLabel: 'equals', + page, value: doc.id, }) @@ -841,7 +840,7 @@ test.describe('Bulk Edit', () => { }) await expect(option).toBeVisible() - await payload.delete({ collection: tabsSlug, id: doc.id }) + await payload.delete({ id: doc.id, collection: tabsSlug }) }) test('should fall back to the field name for fields with label: false', async () => { @@ -854,9 +853,9 @@ test.describe('Bulk Edit', () => { await expect.poll(() => page.url(), { timeout: POLL_TOPASS_TIMEOUT }).toContain('limit=') await addListFilter({ - page, fieldLabel: 'ID', operatorLabel: 'equals', + page, value: doc.id, }) @@ -881,7 +880,7 @@ test.describe('Bulk Edit', () => { const optionTexts = await menu.locator('.rs__option').allInnerTexts() expect(optionTexts.every((text) => text.trim().length > 0)).toBe(true) - await payload.delete({ collection: tabsSlug, id: doc.id }) + await payload.delete({ id: doc.id, collection: tabsSlug }) }) test('should preserve beforeInput components when selecting multiple fields', async () => { @@ -896,14 +895,14 @@ test.describe('Bulk Edit', () => { // Select multiple fields with beforeInput components await selectInput({ - page, - selectLocator: modal.locator('.field-select'), + multiSelect: true, options: [ 'Field With Before Input A1', 'Field With Before Input A2', 'Field With Before Input B', ], - multiSelect: true, + page, + selectLocator: modal.locator('.field-select'), }) // All fields should be visible @@ -932,21 +931,21 @@ test.describe('Bulk Edit', () => { // Select the field with a custom `Field` component first, on its own await selectInput({ + multiSelect: true, + options: ['Field With Custom Field'], page, selectLocator: modal.locator('.field-select'), - options: ['Field With Custom Field'], - multiSelect: true, }) await expect(modal.locator('[data-testid="custom-field"]')).toBeVisible() // Selecting an additional field must not reset the first field to its default component await selectInput({ - page, - selectLocator: modal.locator('.field-select'), clear: false, - options: ['Field With Custom Label'], multiSelect: true, + options: ['Field With Custom Label'], + page, + selectLocator: modal.locator('.field-select'), }) await expect(modal.locator('[data-testid="custom-label"]')).toBeVisible() @@ -964,20 +963,20 @@ test.describe('Bulk Edit', () => { const { modal } = await selectAllAndEditMany(page) await selectInput({ + multiSelect: true, + options: ['Title'], page, selectLocator: modal.locator('.field-select'), - options: ['Title'], - multiSelect: true, }) await modal.locator('#field-title').fill('Bulk edited title') await selectInput({ - page, - selectLocator: modal.locator('.field-select'), clear: false, - options: ['Description'], multiSelect: true, + options: ['Description'], + page, + selectLocator: modal.locator('.field-select'), }) await expect(modal.locator('#field-description')).toBeVisible() @@ -988,8 +987,8 @@ test.describe('Bulk Edit', () => { async function selectFieldToEdit( page: Page, { - fieldLabel, fieldID, + fieldLabel, }: { fieldID: string fieldLabel: string @@ -1013,7 +1012,7 @@ async function selectFieldToEdit( const field = modal.locator(`#field-${fieldID}`) await expect(field).toBeVisible() - return { modal, field } + return { field, modal } } async function selectAllAndEditMany(page: Page): Promise<{ modal: Locator }> { diff --git a/test/embed/e2e.spec.ts b/test/embed/e2e.spec.ts index 5ac08e47c1e..23f4e174652 100644 --- a/test/embed/e2e.spec.ts +++ b/test/embed/e2e.spec.ts @@ -4,9 +4,10 @@ import { expect, test } from '@playwright/test' import * as path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { embedCookieName, themeCookieName } from './shared.js' @@ -30,8 +31,7 @@ test.describe('embed mode', () => { url = new AdminUrlUtil(serverURL, 'users') context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -50,12 +50,12 @@ test.describe('embed mode', () => { // Playwright surfaces as `partitionKey`, keyed to the top-level site). // Poll, since the cookie is written by a client effect after render. await expect.poll(getEmbedCookie).toMatchObject({ - value: 'true', expires: -1, // session cookie: no Max-Age/Expires partitionKey: 'http://localhost', path: '/', sameSite: 'None', secure: true, + value: 'true', }) // Navigating to a different page without the param keeps embed mode on via the cookie. diff --git a/test/field-error-states/e2e.spec.ts b/test/field-error-states/e2e.spec.ts index 9ce4f0cbe52..96ebf020c71 100644 --- a/test/field-error-states/e2e.spec.ts +++ b/test/field-error-states/e2e.spec.ts @@ -12,17 +12,17 @@ import { addBlock } from '../__helpers/e2e/fields/blocks/index.js' import { ensureCompilationIsDone, getRoutes, - initPageConsoleErrorCatch, saveDocAndAssert, waitForFormReady, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { collectionSlugs } from './shared.js' -const { beforeAll, describe, beforeEach } = test +const { beforeAll, beforeEach, describe } = test const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) @@ -60,7 +60,7 @@ describe('Field Error States', () => { }) beforeEach(async ({ page }) => { - initPageConsoleErrorCatch(page) + await initPage({ page }) await reInitializeDB({ serverURL, @@ -346,9 +346,9 @@ describe('Field Error States', () => { await prefillBaseRequiredFields(page) await addBlock({ - page, blockToSelect: 'Min Rows Block', fieldName: 'blocksWithMinRows', + page, }) await saveDocAndAssert(page, '#action-save', 'error') diff --git a/test/field-paths/e2e.spec.ts b/test/field-paths/e2e.spec.ts index 7744cd2d20d..e0d5f2866c6 100644 --- a/test/field-paths/e2e.spec.ts +++ b/test/field-paths/e2e.spec.ts @@ -9,12 +9,12 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, // throttleTest, } from '../__helpers/e2e/helpers.js' import { navigateToDiffVersionView } from '../__helpers/e2e/navigateToDiffVersionView.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { fieldPathsSlug } from './shared.js' import { testDoc } from './testDoc.js' @@ -36,8 +36,7 @@ test.describe('Field Paths', () => { fieldPathsUrl = new AdminUrlUtil(serverURL, fieldPathsSlug) context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields-relationship/e2e.spec.ts b/test/fields-relationship/e2e.spec.ts index 15a4fb669cb..1e81231a24d 100644 --- a/test/fields-relationship/e2e.spec.ts +++ b/test/fields-relationship/e2e.spec.ts @@ -25,7 +25,6 @@ import { addListFilter } from '../__helpers/e2e/filters/index.js' import { goToNextPage } from '../__helpers/e2e/goToNextPage.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, // throttleTest, } from '../__helpers/e2e/helpers.js' @@ -35,6 +34,7 @@ import { openDocDrawer } from '../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../__helpers/shared/assertToastErrors.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { collection1Slug, @@ -88,9 +88,8 @@ describe('Relationship Field', () => { versionedRelationshipFieldURL = new AdminUrlUtil(serverURL, versionedRelationshipFieldSlug) context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) @@ -390,8 +389,8 @@ describe('Relationship Field', () => { await page.locator('#action-save').click() await wait(200) await assertToastErrors({ - page, errors: [fieldLabel], + page, }) await wait(1000) @@ -440,9 +439,9 @@ describe('Relationship Field', () => { await page.goto(url.list) await wait(300) const { whereBuilder } = await addListFilter({ - page, fieldLabel: 'Relationship Filtered By Field', operatorLabel: 'equals', + page, }) const valueInput = page.locator('.condition__value input') @@ -487,9 +486,9 @@ describe('Relationship Field', () => { await wait(300) const { condition: condition1 } = await addListFilter({ - page, fieldLabel: 'Collapsible > Filtered By Field In Collapsible', operatorLabel: 'equals', + page, }) const valueInput = condition1.locator('.condition__value input') @@ -501,9 +500,9 @@ describe('Relationship Field', () => { await expect(valueOptions.locator(`text=${idToInclude}`)).toBeVisible() const { condition: condition2 } = await addListFilter({ - page, fieldLabel: 'Array > Filtered By Field In Array', operatorLabel: 'equals', + page, }) const valueInput2 = condition2.locator('.condition__value input') @@ -651,8 +650,8 @@ describe('Relationship Field', () => { }, }) await payload.update({ - collection: slug, id: doc.id, + collection: slug, data: { relationToSelf: doc.id, }, @@ -691,12 +690,12 @@ describe('Relationship Field', () => { await Promise.all([ payload.delete({ - collection: relationOneSlug, id: relatedDoc.id, + collection: relationOneSlug, }), payload.delete({ - collection: slug, id: doc.id, + collection: slug, }), ]) }) @@ -704,7 +703,7 @@ describe('Relationship Field', () => { test('should open document drawer and append newly created docs onto the parent field', async () => { await page.goto(url.edit(docWithExistingRelations.id)) await wait(300) - await openCreateDocDrawer({ page, fieldSelector: '#field-relationshipHasMany' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationshipHasMany', page }) const documentDrawer = page.locator('[id^=doc-drawer_relation-one_1_]') await expect(documentDrawer).toBeVisible() const drawerField = documentDrawer.locator('#field-name') @@ -751,8 +750,8 @@ describe('Relationship Field', () => { await createVersionedRelationshipFieldDoc('Without relationship') await createVersionedRelationshipFieldDoc('with relationship', [ { - value: collectionOneDoc.id, relationTo: collection1Slug, + value: collectionOneDoc.id, }, ]) @@ -761,9 +760,9 @@ describe('Relationship Field', () => { await page.locator('.columns-button__button').click() await addListFilter({ - page, fieldLabel: 'Relationship Field', operatorLabel: 'exists', + page, value: 'True', }) @@ -783,8 +782,8 @@ describe('Relationship Field', () => { }) await payload.update({ - collection: versionedRelationshipFieldSlug, id: draftRelated.id, + collection: versionedRelationshipFieldSlug, data: { title: 'Draft Only Title', }, @@ -1028,43 +1027,43 @@ describe('Relationship Field', () => { data: { relationship: relatedDoc.id, relationshipHasMany: [relatedDoc.id], - relationshipMultiple: { - relationTo: relationOneSlug, - value: relatedDoc.id, - }, relationshipHasManyMultiple: [ { relationTo: relationOneSlug, value: relatedDoc.id, }, ], + relationshipMultiple: { + relationTo: relationOneSlug, + value: relatedDoc.id, + }, }, }) const cleanup = async () => { await payload.delete({ - collection: slug, id: relatedDoc.id, + collection: slug, }) await payload.delete({ - collection: relationOneSlug, id: relatedDoc.id, + collection: relationOneSlug, }) } return { - relatedDoc, cleanup, + relatedDoc, } } test('should filter on polymorphic hasMany=true relationship field - equals', async () => { - const { relatedDoc, cleanup } = await createRelatedDoc() + const { cleanup, relatedDoc } = await createRelatedDoc() await page.goto(url.list) await addListFilter({ - page, fieldLabel: 'Relationship Has Many Multiple', operatorLabel: 'equals', + page, value: relatedDoc.id, }) const tableRow = page.locator(tableRowLocator) @@ -1072,12 +1071,12 @@ describe('Relationship Field', () => { await cleanup() }) test('should filter on polymorphic hasMany=false relationship field - equals', async () => { - const { relatedDoc, cleanup } = await createRelatedDoc() + const { cleanup, relatedDoc } = await createRelatedDoc() await page.goto(url.list) await addListFilter({ - page, fieldLabel: 'Relationship Multiple', operatorLabel: 'equals', + page, value: relatedDoc.id, }) const tableRow = page.locator(tableRowLocator) @@ -1085,28 +1084,28 @@ describe('Relationship Field', () => { await cleanup() }) test('should filter on monomorphic hasMany=false relationship field - is in', async () => { - const { relatedDoc, cleanup } = await createRelatedDoc() + const { cleanup, relatedDoc } = await createRelatedDoc() await page.goto(url.list) await addListFilter({ - page, fieldLabel: 'Relationship', + multiSelect: true, operatorLabel: 'is in', + page, value: relatedDoc.id, - multiSelect: true, }) const tableRow = page.locator(tableRowLocator) await expect(tableRow).toHaveCount(1) await cleanup() }) test('should filter on monomorphic hasMany=true relationship field - is in', async () => { - const { relatedDoc, cleanup } = await createRelatedDoc() + const { cleanup, relatedDoc } = await createRelatedDoc() await page.goto(url.list) await addListFilter({ - page, fieldLabel: 'Relationship Has Many', + multiSelect: true, operatorLabel: 'is in', + page, value: relatedDoc.id, - multiSelect: true, }) const tableRow = page.locator(tableRowLocator) await expect(tableRow).toHaveCount(1) @@ -1146,23 +1145,23 @@ describe('Relationship Field', () => { // Filter by relatedDoc1 and relatedDoc2 (should match mainDoc1 and mainDoc2) await addListFilter({ - page, fieldLabel: 'Relationship', + multiSelect: true, operatorLabel: 'is in', + page, value: [String(relatedDoc1.id), String(relatedDoc2.id)], - multiSelect: true, }) const tableRow = page.locator(tableRowLocator) await expect(tableRow).toHaveCount(2) // Cleanup - await payload.delete({ collection: slug, id: String(mainDoc1.id) }) - await payload.delete({ collection: slug, id: String(mainDoc2.id) }) - await payload.delete({ collection: slug, id: String(mainDoc3.id) }) - await payload.delete({ collection: relationOneSlug, id: String(relatedDoc1.id) }) - await payload.delete({ collection: relationOneSlug, id: String(relatedDoc2.id) }) - await payload.delete({ collection: relationOneSlug, id: String(relatedDoc3.id) }) + await payload.delete({ id: String(mainDoc1.id), collection: slug }) + await payload.delete({ id: String(mainDoc2.id), collection: slug }) + await payload.delete({ id: String(mainDoc3.id), collection: slug }) + await payload.delete({ id: String(relatedDoc1.id), collection: relationOneSlug }) + await payload.delete({ id: String(relatedDoc2.id), collection: relationOneSlug }) + await payload.delete({ id: String(relatedDoc3.id), collection: relationOneSlug }) }) }) }) @@ -1193,8 +1192,8 @@ async function createVersionedRelationshipFieldDoc( return payload.create({ collection: versionedRelationshipFieldSlug, data: { - title, relationshipField, + title, ...overrides, }, }) as unknown as Promise diff --git a/test/fields/collections/Array/e2e.spec.ts b/test/fields/collections/Array/e2e.spec.ts index 07deec8c974..a8c734df0f5 100644 --- a/test/fields/collections/Array/e2e.spec.ts +++ b/test/fields/collections/Array/e2e.spec.ts @@ -16,7 +16,6 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' @@ -24,6 +23,7 @@ import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.j import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -48,8 +48,7 @@ describe('Array', () => { })) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -179,8 +178,8 @@ describe('Array', () => { await page.click('#action-save', { delay: 100 }) await assertToastErrors({ - page, errors: ['Array With Min Rows'], + page, }) }) @@ -335,7 +334,6 @@ describe('Array', () => { await payload.create({ collection: 'array-fields', data: { - title: 'for test 1', items: [ { text: 'test 1', @@ -344,25 +342,25 @@ describe('Array', () => { text: 'test 2', }, ], + title: 'for test 1', }, }) await payload.create({ collection: 'array-fields', data: { - title: 'for test 2', items: [ { text: 'test 3', }, ], + title: 'for test 2', }, }) await payload.create({ collection: 'array-fields', data: { - title: 'for test 3', items: [ { text: 'test 4', @@ -374,6 +372,7 @@ describe('Array', () => { text: 'test 6', }, ], + title: 'for test 3', }, }) @@ -455,9 +454,9 @@ describe('Array', () => { await expect(page.locator(`#field-collapsedArray__0__text`)).toBeHidden() await toggleBlockOrArrayRow({ + fieldName: 'collapsedArray', page, rowIndex: 0, - fieldName: 'collapsedArray', targetState: 'open', }) @@ -589,8 +588,8 @@ describe('Array', () => { await rowTextInput.fill(textVal) await copyPasteField({ - page, fieldName: 'items', + page, }) await page.reload() @@ -598,9 +597,9 @@ describe('Array', () => { await expect(rowTextInput).toHaveValue('row one') await copyPasteField({ - page, action: 'paste', fieldName: 'items', + page, }) await expect(rowTextInput).toHaveValue(textVal) @@ -616,8 +615,8 @@ describe('Array', () => { await rowTextInput.fill(textVal) await copyPasteField({ - page, fieldName: 'items', + page, rowIndex: 0, }) @@ -626,9 +625,9 @@ describe('Array', () => { await expect(rowTextInput).toHaveValue('row one') await copyPasteField({ - page, action: 'paste', fieldName: 'items', + page, rowIndex: 0, }) @@ -639,15 +638,15 @@ describe('Array', () => { await page.goto(url.create) await copyPasteField({ - page, fieldName: 'localized', + page, rowIndex: 0, }) await copyPasteField({ - page, - fieldName: 'disableSort', action: 'paste', + fieldName: 'disableSort', + page, }) const rowsContainer = page @@ -662,8 +661,8 @@ describe('Array', () => { await page.goto(url.create) await copyPasteField({ - page, fieldName: 'localized', + page, }) const field = page.locator('#field-disableSort') @@ -676,7 +675,7 @@ describe('Array', () => { const row = field.locator('#disableSort-row-0') await expect(row).toBeVisible() - await copyPasteField({ page, action: 'paste', fieldName: 'disableSort' }) + await copyPasteField({ action: 'paste', fieldName: 'disableSort', page }) const rowsContainer = page .locator('#field-disableSort > div.array-field__draggable-rows') @@ -700,16 +699,16 @@ describe('Array', () => { await textInputRowOne.fill(textInputRowOneValue) await copyPasteField({ - page, fieldName: 'items', + page, rowIndex: 0, }) await copyPasteField({ - page, + action: 'paste', fieldName: 'items', + page, rowIndex: 1, - action: 'paste', }) const textInputRowTwo = field.locator('#field-items__1__subArray__0__text') @@ -737,16 +736,16 @@ describe('Array', () => { await expect(subArrayContainer2).toHaveCount(1) await copyPasteField({ - page, fieldName: 'items', + page, rowIndex: 1, }) await copyPasteField({ - page, + action: 'paste', fieldName: 'items', + page, rowIndex: 0, - action: 'paste', }) await expect(subArrayContainer).toHaveCount(1) @@ -768,16 +767,16 @@ describe('Array', () => { await rowOneText.fill(textVal) await copyPasteField({ - page, fieldName: 'items__0__subArray', + page, rowIndex: 0, }) await copyPasteField({ - page, + action: 'paste', fieldName: 'items__0__subArray', + page, rowIndex: 1, - action: 'paste', }) const rowTwoText = field.locator('#field-items__0__subArray__1__text') @@ -803,14 +802,14 @@ describe('Array', () => { await expect(targetRows).toHaveCount(1) await copyPasteField({ - page, fieldName: 'items__0__subArray', + page, }) await copyPasteField({ - page, - fieldName: 'items__1__subArray', action: 'paste', + fieldName: 'items__1__subArray', + page, }) await expect(targetRows).toHaveCount(2) @@ -842,17 +841,17 @@ describe('Array', () => { const firstDocURL = page.url() await copyPasteField({ - page, fieldName: 'items', + page, }) // Create second document await page.goto(url.create) await copyPasteField({ - page, action: 'paste', fieldName: 'items', + page, }) const pastedTextInput = page.locator('#field-items__0__text') diff --git a/test/fields/collections/Blocks/e2e.spec.ts b/test/fields/collections/Blocks/e2e.spec.ts index ad77252dfbe..629d06fe257 100644 --- a/test/fields/collections/Blocks/e2e.spec.ts +++ b/test/fields/collections/Blocks/e2e.spec.ts @@ -20,7 +20,6 @@ import { fileURLToPath } from 'url' import { assertNetworkRequests } from '../../../__helpers/e2e/assertNetworkRequests.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, // throttleTest, } from '../../../__helpers/e2e/helpers.js' @@ -29,6 +28,7 @@ import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.j import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -54,8 +54,7 @@ describe('Block fields', () => { })) context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -91,9 +90,9 @@ describe('Block fields', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'blocks', blockToSelect: 'Content', + fieldName: 'blocks', + page, }) // ensure the block was appended to the rows @@ -114,8 +113,8 @@ describe('Block fields', () => { await page.goto(url.create) const blocksDrawer = await openBlocksDrawer({ - page, fieldName: 'blocks', + page, }) const searchInput = page.locator('.block-search__input input') @@ -141,7 +140,7 @@ describe('Block fields', () => { test('should open blocks drawer from block row and add below', { framework: 'rsc' }, async () => { await page.goto(url.create) - await addBlockBelow(page, { fieldName: 'blocks', blockToSelect: 'Content' }) + await addBlockBelow(page, { blockToSelect: 'Content', fieldName: 'blocks' }) // ensure the block was inserted beneath the first in the rows const addedRow = page.locator('#field-blocks #blocks-row-1') @@ -175,9 +174,9 @@ describe('Block fields', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'collapsedByDefaultBlocks', blockToSelect: 'Localized Content', + fieldName: 'collapsedByDefaultBlocks', + page, }) const row = page.locator(`#collapsedByDefaultBlocks-row-4`) @@ -191,9 +190,9 @@ describe('Block fields', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'collapsedByDefaultBlocks', blockToSelect: 'Localized Content', + fieldName: 'collapsedByDefaultBlocks', + page, }) const row = page.locator(`#collapsedByDefaultBlocks-row-4`) @@ -203,10 +202,10 @@ describe('Block fields', () => { await expect(page.locator(`#field-collapsedByDefaultBlocks__4__text`)).toBeHidden() await toggleBlockOrArrayRow({ - page, fieldName: 'collapsedByDefaultBlocks', - targetState: 'open', + page, rowIndex: 4, + targetState: 'open', }) await page.locator('input#field-collapsedByDefaultBlocks__4__text').fill('Hello, world!') @@ -223,9 +222,9 @@ describe('Block fields', () => { await expect(page.locator('#field-i18nBlocks .blocks-field__header')).toContainText('Block en') await addBlock({ - page, - fieldName: 'i18nBlocks', blockToSelect: 'Text en', + fieldName: 'i18nBlocks', + page, }) // ensure the block was appended to the rows @@ -240,9 +239,9 @@ describe('Block fields', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'blocks', blockToSelect: 'Content', + fieldName: 'blocks', + page, }) await expect( @@ -256,9 +255,9 @@ describe('Block fields', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'blocksWithSimilarConfigs', blockToSelect: 'Block A', + fieldName: 'blocksWithSimilarConfigs', + page, }) await page @@ -275,9 +274,9 @@ describe('Block fields', () => { ).toHaveValue('items>0>title') await addBlock({ - page, - fieldName: 'blocksWithSimilarConfigs', blockToSelect: 'Block B', + fieldName: 'blocksWithSimilarConfigs', + page, }) await page @@ -303,9 +302,9 @@ describe('Block fields', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'blocksWithMinRows', blockToSelect: 'Block With Min Row', + fieldName: 'blocksWithMinRows', + page, }) const firstRow = page.locator('input[name="blocksWithMinRows.0.blockTitle"]') @@ -315,8 +314,8 @@ describe('Block fields', () => { await page.click('#action-save', { delay: 100 }) await assertToastErrors({ - page, errors: ['Blocks With Min Rows'], + page, }) }) @@ -372,9 +371,9 @@ describe('Block fields', () => { await wait(1000) await reorderBlocks({ - page, fieldName: 'blocks', fromBlockIndex: 0, + page, toBlockIndex: 1, }) @@ -607,8 +606,8 @@ describe('Block fields', () => { await rowTextInput.fill(textVal) await copyPasteField({ - page, fieldName: 'blocks', + page, }) await page.reload() @@ -616,9 +615,9 @@ describe('Block fields', () => { await expect(rowTextInput).toHaveValue('first block') await copyPasteField({ - page, action: 'paste', fieldName: 'blocks', + page, }) await expect(rowTextInput).toHaveValue(textVal) @@ -634,8 +633,8 @@ describe('Block fields', () => { await rowTextInput.fill(textVal) await copyPasteField({ - page, fieldName: 'blocks', + page, rowIndex: 0, }) @@ -644,9 +643,9 @@ describe('Block fields', () => { await expect(rowTextInput).toHaveValue('first block') await copyPasteField({ - page, action: 'paste', fieldName: 'blocks', + page, rowIndex: 0, }) @@ -657,15 +656,15 @@ describe('Block fields', () => { await page.goto(url.create) await copyPasteField({ - page, fieldName: 'blocks', + page, rowIndex: 1, }) await copyPasteField({ - page, - fieldName: 'duplicate', action: 'paste', + fieldName: 'duplicate', + page, }) const rowsContainer = page.locator('#field-duplicate > div.blocks-field__rows').first() @@ -685,15 +684,15 @@ describe('Block fields', () => { await originalInput.fill(textVal) await copyPasteField({ - page, fieldName: 'blocks', + page, }) const field = page.locator('#field-duplicate') const fieldInput = field.locator('#field-duplicate__0__text') await expect(fieldInput).toHaveValue('first block') - await copyPasteField({ page, action: 'paste', fieldName: 'duplicate', rowIndex: 0 }) + await copyPasteField({ action: 'paste', fieldName: 'duplicate', page, rowIndex: 0 }) const rowsContainer = page.locator('#field-duplicate > div.blocks-field__rows').first() await expect(rowsContainer).toBeVisible() @@ -705,7 +704,7 @@ describe('Block fields', () => { await page.goto(url.create) const field = page.locator('#field-blocks') - await addBlock({ page, fieldName: 'blocks', blockToSelect: 'Sub Block' }) + await addBlock({ blockToSelect: 'Sub Block', fieldName: 'blocks', page }) const textInputRowOne = field.locator('#field-blocks__2__subBlocks__1__text') await expect(textInputRowOne).toBeVisible() @@ -714,16 +713,16 @@ describe('Block fields', () => { await textInputRowOne.fill(textInputRowOneValue) await copyPasteField({ - page, fieldName: 'blocks', + page, rowIndex: 2, }) await copyPasteField({ - page, + action: 'paste', fieldName: 'blocks', + page, rowIndex: 4, - action: 'paste', }) const textInputRowTwo = field.locator('#field-blocks__4__subBlocks__1__text') @@ -735,9 +734,9 @@ describe('Block fields', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'blocks', blockToSelect: 'Sub Block', + fieldName: 'blocks', + page, }) const field = page.locator('#field-blocks') @@ -752,16 +751,16 @@ describe('Block fields', () => { await expect(subArrayContainer2).toHaveCount(0) await copyPasteField({ - page, fieldName: 'blocks', + page, rowIndex: 4, }) await copyPasteField({ - page, + action: 'paste', fieldName: 'blocks', + page, rowIndex: 2, - action: 'paste', }) await expect(subArrayContainer).toHaveCount(0) @@ -780,16 +779,16 @@ describe('Block fields', () => { await sourceText.fill(textVal) await copyPasteField({ - page, fieldName: 'blocks__2__subBlocks', + page, rowIndex: 1, }) await copyPasteField({ - page, + action: 'paste', fieldName: 'blocks__2__subBlocks', + page, rowIndex: 0, - action: 'paste', }) const targetText = field.locator('#field-blocks__2__subBlocks__0__text') @@ -801,9 +800,9 @@ describe('Block fields', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'blocks', blockToSelect: 'Sub Block', + fieldName: 'blocks', + page, }) const field = page.locator('#field-blocks') @@ -814,14 +813,14 @@ describe('Block fields', () => { await expect(targetRows).toHaveCount(0) await copyPasteField({ - page, fieldName: 'blocks__2__subBlocks', + page, }) await copyPasteField({ - page, - fieldName: 'blocks__4__subBlocks', action: 'paste', + fieldName: 'blocks__4__subBlocks', + page, }) await expect(targetRows).toHaveCount(2) @@ -852,17 +851,17 @@ describe('Block fields', () => { const firstDocURL = page.url() await copyPasteField({ - page, fieldName: 'blocks', + page, }) // Create second document await page.goto(url.create) await copyPasteField({ - page, action: 'paste', fieldName: 'blocks', + page, }) const pastedTextInput = page.locator('#field-blocks__0__text') @@ -883,7 +882,7 @@ describe('Block fields', () => { test('should display admin.images.thumbnail in blocks drawer', async () => { await page.goto(url.create) - const blocksDrawer = await openBlocksDrawer({ page, fieldName: 'blocks' }) + const blocksDrawer = await openBlocksDrawer({ fieldName: 'blocks', page }) const withIconCard = blocksDrawer .locator('.blocks-drawer__block') @@ -899,7 +898,7 @@ describe('Block fields', () => { test('should display imageURL as thumbnail fallback in blocks drawer', async () => { await page.goto(url.create) - const blocksDrawer = await openBlocksDrawer({ page, fieldName: 'blocks' }) + const blocksDrawer = await openBlocksDrawer({ fieldName: 'blocks', page }) const contentCard = blocksDrawer .locator('.blocks-drawer__block') @@ -976,8 +975,8 @@ describe('Block fields', () => { await page.locator('#field-enabledBlocks').fill('nonexistentblock') }, { - minimumNumberOfRequests: 1, allowedNumberOfRequests: 2, + minimumNumberOfRequests: 1, }, ) await wait(200) // To be safe, wait to ensure form state has been merged back on the client-side @@ -998,8 +997,8 @@ describe('Block fields', () => { await page.locator('#field-enabledBlocks').fill('blockTwo') }, { - minimumNumberOfRequests: 1, allowedNumberOfRequests: 2, + minimumNumberOfRequests: 1, }, ) await wait(200) // To be safe, wait to ensure form state has been merged back on the client-side @@ -1037,8 +1036,8 @@ describe('Block fields', () => { await page.locator('#field-enabledBlocks').fill('blockOne') }, { - minimumNumberOfRequests: 1, allowedNumberOfRequests: 2, + minimumNumberOfRequests: 1, }, ) await wait(200) // To be safe, wait to ensure form state has been merged back on the client-side diff --git a/test/fields/collections/Checkbox/e2e.spec.ts b/test/fields/collections/Checkbox/e2e.spec.ts index 03413a1fd78..b867068ed70 100644 --- a/test/fields/collections/Checkbox/e2e.spec.ts +++ b/test/fields/collections/Checkbox/e2e.spec.ts @@ -8,13 +8,13 @@ import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicator import { addListFilter } from '../../../__helpers/e2e/filters/index.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { checkboxFieldsSlug } from '../../slugs.js' @@ -41,8 +41,7 @@ describe('Checkboxes', () => { url = new AdminUrlUtil(serverURL, checkboxFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/Code/e2e.spec.ts b/test/fields/collections/Code/e2e.spec.ts index 9cea3927a91..00e129f0959 100644 --- a/test/fields/collections/Code/e2e.spec.ts +++ b/test/fields/collections/Code/e2e.spec.ts @@ -8,12 +8,12 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { codeFieldsSlug } from '../../slugs.js' @@ -37,8 +37,7 @@ test.describe('Code', () => { url = new AdminUrlUtil(serverURL, codeFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/Collapsible/e2e.spec.ts b/test/fields/collections/Collapsible/e2e.spec.ts index 234db09abaa..3f9a845c2de 100644 --- a/test/fields/collections/Collapsible/e2e.spec.ts +++ b/test/fields/collections/Collapsible/e2e.spec.ts @@ -12,13 +12,13 @@ import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicator import { addArrayRow } from '../../../__helpers/e2e/fields/array/index.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { collapsibleFieldsSlug } from '../../slugs.js' @@ -46,8 +46,7 @@ describe('Collapsibles', () => { url = new AdminUrlUtil(serverURL, collapsibleFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -119,10 +118,10 @@ describe('Collapsibles', () => { await page.locator('#field-text').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.collection-edit__main'], page, testInfo, - include: ['.collection-edit__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -134,8 +133,8 @@ describe('Collapsibles', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.collection-edit__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) diff --git a/test/fields/collections/ConditionalLogic/e2e.spec.ts b/test/fields/collections/ConditionalLogic/e2e.spec.ts index e30cd91c633..748234eabc3 100644 --- a/test/fields/collections/ConditionalLogic/e2e.spec.ts +++ b/test/fields/collections/ConditionalLogic/e2e.spec.ts @@ -12,7 +12,6 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, // throttleTest, } from '../../../__helpers/e2e/helpers.js' @@ -20,6 +19,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { conditionalLogicSlug } from '../../slugs.js' @@ -62,8 +62,7 @@ describe('Conditional Logic', () => { url = new AdminUrlUtil(serverURL, conditionalLogicSlug) context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -298,9 +297,9 @@ describe('Conditional Logic', () => { await page.goto(url.create) await addBlock({ - page, - fieldName: 'blocksWithRadioCondition', blockToSelect: 'Block With Radio Condition', + fieldName: 'blocksWithRadioCondition', + page, }) // Conditional field should be hidden (defaultValue: 'hide') diff --git a/test/fields/collections/CustomID/e2e.spec.ts b/test/fields/collections/CustomID/e2e.spec.ts index 1afa5b6c678..36b69b7ea16 100644 --- a/test/fields/collections/CustomID/e2e.spec.ts +++ b/test/fields/collections/CustomID/e2e.spec.ts @@ -1,7 +1,6 @@ import type { Page } from '@playwright/test' import { expect, test } from '@playwright/test' -import { navigateToDoc } from '../../../__helpers/e2e/navigateToDoc.js' import path from 'path' import { fileURLToPath } from 'url' @@ -10,12 +9,13 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' +import { navigateToDoc } from '../../../__helpers/e2e/navigateToDoc.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' -import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' +import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { customIDSlug, customRowIDSlug, customTabIDSlug } from '../../slugs.js' import { customRowID, customTabID, nonStandardID } from './shared.js' @@ -48,8 +48,7 @@ describe('Custom IDs', () => { customRowIDURL = new AdminUrlUtil(serverURL, customRowIDSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/Date/e2e.spec.ts b/test/fields/collections/Date/e2e.spec.ts index 2e03be35513..f114a000988 100644 --- a/test/fields/collections/Date/e2e.spec.ts +++ b/test/fields/collections/Date/e2e.spec.ts @@ -12,7 +12,6 @@ import { getColumnSelectorItem } from '../../../__helpers/e2e/columns/index.js' import { addListFilter } from '../../../__helpers/e2e/filters/addListFilter.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' @@ -20,6 +19,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { dateFieldsSlug } from '../../slugs.js' @@ -68,8 +68,7 @@ describe('Date', () => { url = new AdminUrlUtil(serverURL, dateFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -103,9 +102,9 @@ describe('Date', () => { // Add a date filter without a value — this sets up the field and operator const { condition } = await addListFilter({ - page, fieldLabel: 'Created At', operatorLabel: 'is greater than', + page, }) // Click the date picker input to open the calendar @@ -182,7 +181,7 @@ describe('Date', () => { const id = page.url().split('/').pop() - const { doc } = await client.findByID({ id: id!, auth: true, slug: 'date-fields' }) + const { doc } = await client.findByID({ id: id!, slug: 'date-fields', auth: true }) await expect(() => { // Ensure that the time field does not contain milliseconds @@ -214,7 +213,7 @@ describe('Date', () => { const id = page.url().split('/').pop() - const { doc } = await client.findByID({ id: id!, auth: true, slug: 'date-fields' }) + const { doc } = await client.findByID({ id: id!, slug: 'date-fields', auth: true }) await expect(() => { // Ensure that the time with miliseconds field contains the exact miliseconds specified @@ -258,11 +257,11 @@ describe('Date', () => { const id = routeSegments.pop() // fetch the doc (need the date string from the DB) - const { doc } = await client.findByID({ id: id!, auth: true, slug: 'date-fields' }) + const { doc } = await client.findByID({ id: id!, slug: 'date-fields', auth: true }) await expect(() => { expect(doc.default).toEqual('2023-02-07T12:00:00.000Z') - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) }) @@ -302,11 +301,11 @@ describe('Date', () => { const id = routeSegments.pop() // fetch the doc (need the date string from the DB) - const { doc } = await client.findByID({ id: id!, auth: true, slug: 'date-fields' }) + const { doc } = await client.findByID({ id: id!, slug: 'date-fields', auth: true }) await expect(() => { expect(doc.default).toEqual('2023-02-07T12:00:00.000Z') - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) }) @@ -346,11 +345,11 @@ describe('Date', () => { const id = routeSegments.pop() // fetch the doc (need the date string from the DB) - const { doc } = await client.findByID({ id: id!, auth: true, slug: 'date-fields' }) + const { doc } = await client.findByID({ id: id!, slug: 'date-fields', auth: true }) await expect(() => { expect(doc.default).toEqual('2023-02-07T12:00:00.000Z') - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) }) }) @@ -385,7 +384,7 @@ describe('Date', () => { await expect(() => { expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) expect(existingDoc?.dayAndTimeWithTimezone_tz).toEqual(expectedTimezone) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) test('changing the timezone should update the date to the new equivalent', async () => { @@ -608,7 +607,7 @@ describe('Date', () => { const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -622,7 +621,7 @@ describe('Date', () => { }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) }) @@ -737,10 +736,10 @@ describe('Date', () => { await page.locator('#field-default').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.document-fields__main'], page, testInfo, - include: ['.document-fields__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -763,8 +762,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => url = new AdminUrlUtil(serverURL, dateFieldsSlug) const context = await browser.newContext({ timezoneId }) - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -800,7 +798,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => await expect(() => { expect(result).toEqual(timezoneId) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) const dateOnlyLocator = page.locator( '#field-defaultWithTimezone .react-datepicker-wrapper input', @@ -823,13 +821,13 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => await expect(async () => { await expect(dateTimeLocator).toHaveText('January 31st 2025, 10:00 AM') - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) const dateTimeLocatorFixed = page.locator('.cell-dayAndTimeWithTimezoneFixed').first() await expect(async () => { await expect(dateTimeLocatorFixed).toHaveText('October 29th 2025, 8:00 PM') - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) test('date field with hidden timezone column should display date correctly in list view', async () => { @@ -842,7 +840,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => // The date is 2027-08-12T14:00:00.000Z with America/New_York timezone // In New York (UTC-4 in summer), this should display as 10:00 AM await expect(dateTimeLocator).toHaveText('August 12th 2027, 10:00 AM') - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) // The timezone column should NOT be visible (hidden via disabled.column override) const timezoneColumnCell = page.locator('.cell-dateWithTimezoneWithDisabledColumns_tz') @@ -890,7 +888,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -904,7 +902,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) }) @@ -932,7 +930,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -946,7 +944,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) }) @@ -974,7 +972,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -988,7 +986,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) }) @@ -1027,7 +1025,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -1041,7 +1039,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedDateTimeUTCValue) expect(existingDoc?.defaultWithTimezone).toEqual(expectedDateOnlyUTCValue) }) @@ -1081,7 +1079,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -1095,7 +1093,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedDateTimeUTCValue) expect(existingDoc?.defaultWithTimezone).toEqual(expectedDateOnlyUTCValue) }) @@ -1216,7 +1214,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -1231,7 +1229,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }) // The UTC value should be identical regardless of browser timezone context - // eslint-disable-next-line payload/no-flaky-assertions + expect(existingDoc?.dateWithOffsetTimezone).toEqual(expectedUTCValue) expect(existingDoc?.dateWithOffsetTimezone_tz).toEqual(expectedTimezone) }) @@ -1275,7 +1273,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -1289,7 +1287,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(existingDoc?.dateWithOffsetTimezone).toEqual(expectedUTCValue) expect(existingDoc?.dateWithOffsetTimezone_tz).toEqual(expectedTimezone) }) @@ -1338,7 +1336,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - // eslint-disable-next-line payload/no-flaky-assertions + expect(docID).toBeTruthy() const { @@ -1361,9 +1359,9 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const doc = await payload.create({ collection: dateFieldsSlug, data: { - default: '2025-01-01T00:00:00.000Z', dayAndTimeWithTimezone: '2025-01-01T01:00:00.000Z', dayAndTimeWithTimezone_tz: 'Asia/Tokyo', + default: '2025-01-01T00:00:00.000Z', // 2025-01-01T12:30:00.000Z with +05:30 should display as Jan 1, 2025 6:00 PM dateWithOffsetTimezone: '2025-01-01T12:30:00.000Z', dateWithOffsetTimezone_tz: '+05:30', diff --git a/test/fields/collections/Email/e2e.spec.ts b/test/fields/collections/Email/e2e.spec.ts index d8334d02db0..46525858852 100644 --- a/test/fields/collections/Email/e2e.spec.ts +++ b/test/fields/collections/Email/e2e.spec.ts @@ -10,13 +10,13 @@ import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { emailFieldsSlug } from '../../slugs.js' import { emailDoc } from './shared.js' @@ -45,8 +45,7 @@ describe('Email', () => { url = new AdminUrlUtil(serverURL, emailFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -135,10 +134,10 @@ describe('Email', () => { await page.locator('#field-email').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.document-fields__main'], page, testInfo, - include: ['.document-fields__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -150,8 +149,8 @@ describe('Email', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.document-fields__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) diff --git a/test/fields/collections/Group/e2e.spec.ts b/test/fields/collections/Group/e2e.spec.ts index 2ff26295bcc..15950c0a18e 100644 --- a/test/fields/collections/Group/e2e.spec.ts +++ b/test/fields/collections/Group/e2e.spec.ts @@ -9,13 +9,13 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { groupFieldsSlug } from '../../slugs.js' import { namedGroupDoc } from './shared.js' @@ -44,8 +44,7 @@ describe('Group', () => { url = new AdminUrlUtil(serverURL, groupFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -145,9 +144,9 @@ describe('Group', () => { await page.locator('#field-group__text').waitFor() const scanResults = await runAxeScan({ + include: ['.collection-edit__main'], page, testInfo, - include: ['.collection-edit__main'], }) expect(scanResults.violations.length).toBe(0) diff --git a/test/fields/collections/Indexed/e2e.spec.ts b/test/fields/collections/Indexed/e2e.spec.ts index 44d35c66ba2..62dc910928f 100644 --- a/test/fields/collections/Indexed/e2e.spec.ts +++ b/test/fields/collections/Indexed/e2e.spec.ts @@ -11,13 +11,13 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, gotoAndWaitForForm, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { indexedFieldsSlug } from '../../slugs.js' @@ -45,8 +45,7 @@ describe('Radio', () => { url = new AdminUrlUtil(serverURL, indexedFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/JSON/e2e.spec.ts b/test/fields/collections/JSON/e2e.spec.ts index 9ad3bb3b38d..449bf44c02f 100644 --- a/test/fields/collections/JSON/e2e.spec.ts +++ b/test/fields/collections/JSON/e2e.spec.ts @@ -10,7 +10,6 @@ import type { Config } from '../../payload-types.js' import { openListFilters } from '../../../__helpers/e2e/filters/openListFilters.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' @@ -18,6 +17,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { jsonFieldsSlug } from '../../slugs.js' import { jsonDoc } from './shared.js' @@ -46,8 +46,7 @@ describe('JSON', () => { url = new AdminUrlUtil(serverURL, jsonFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -75,10 +74,10 @@ describe('JSON', () => { test('should truncate long JSON values in list view', async () => { // Create a document with very long JSON (>150 chars, should truncate) const longJsonData = { - veryLongProperty: - 'This is a very long string value that will definitely exceed the 100 character universal truth when stringified.', anotherProperty: 'Additional data to ensure we exceed the limit', nested: { deep: { value: 'More nested data' } }, + veryLongProperty: + 'This is a very long string value that will definitely exceed the 100 character universal truth when stringified.', } const longDoc = await payload.create({ @@ -252,9 +251,9 @@ describe('JSON', () => { await page.locator('#field-json').waitFor() const scanResults = await runAxeScan({ + include: ['.document-fields__main'], page, testInfo, - include: ['.document-fields__main'], }) expect(scanResults.violations.length).toBe(0) diff --git a/test/fields/collections/Number/e2e.spec.ts b/test/fields/collections/Number/e2e.spec.ts index 0d604ce4dad..4155d752809 100644 --- a/test/fields/collections/Number/e2e.spec.ts +++ b/test/fields/collections/Number/e2e.spec.ts @@ -12,7 +12,6 @@ import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicator import { addListFilter } from '../../../__helpers/e2e/filters/index.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' @@ -21,6 +20,7 @@ import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.j import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { numberDoc } from './shared.js' @@ -48,8 +48,7 @@ describe('Number', () => { url = new AdminUrlUtil(serverURL, 'number-fields') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -79,9 +78,9 @@ describe('Number', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(3) await addListFilter({ - page, fieldLabel: 'Number', operatorLabel: 'is greater than or equal to', + page, value: '3', }) @@ -94,9 +93,9 @@ describe('Number', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(3) await addListFilter({ - page, fieldLabel: 'Number', operatorLabel: 'is in', + page, value: '2', }) @@ -109,9 +108,9 @@ describe('Number', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(3) await addListFilter({ - page, fieldLabel: 'Number', operatorLabel: 'is not in', + page, value: '2', }) @@ -124,9 +123,9 @@ describe('Number', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(3) await addListFilter({ - page, fieldLabel: 'Has Many', operatorLabel: 'is in', + page, value: '5', }) @@ -139,9 +138,9 @@ describe('Number', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(3) await addListFilter({ - page, fieldLabel: 'Has Many', operatorLabel: 'is not in', + page, value: '6', }) @@ -182,8 +181,8 @@ describe('Number', () => { await page.keyboard.press('Enter') await page.click('#action-save', { delay: 100 }) await assertToastErrors({ - page, errors: ['With Min Rows'], + page, }) }) @@ -206,10 +205,10 @@ describe('Number', () => { await page.locator('#field-number').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.document-fields__main'], page, testInfo, - include: ['.document-fields__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -222,8 +221,8 @@ describe('Number', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.document-fields__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) diff --git a/test/fields/collections/Point/e2e.spec.ts b/test/fields/collections/Point/e2e.spec.ts index b1936307b4c..153bbd6b820 100644 --- a/test/fields/collections/Point/e2e.spec.ts +++ b/test/fields/collections/Point/e2e.spec.ts @@ -10,7 +10,6 @@ import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' @@ -18,6 +17,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { pointFieldsSlug } from '../../slugs.js' @@ -46,8 +46,7 @@ describe('Point', () => { url = new AdminUrlUtil(serverURL, pointFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -164,9 +163,9 @@ describe('Point', () => { await page.locator('#field-longitude-point').waitFor() const scanResults = await runAxeScan({ + include: ['.document-fields__main'], page, testInfo, - include: ['.document-fields__main'], }) expect(scanResults.violations.length).toBe(0) @@ -178,8 +177,8 @@ describe('Point', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.document-fields__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) diff --git a/test/fields/collections/Radio/e2e.spec.ts b/test/fields/collections/Radio/e2e.spec.ts index 3f05132c9b7..9a4890cd3bc 100644 --- a/test/fields/collections/Radio/e2e.spec.ts +++ b/test/fields/collections/Radio/e2e.spec.ts @@ -10,13 +10,13 @@ import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { radioFieldsSlug } from '../../slugs.js' @@ -44,8 +44,7 @@ describe('Radio', () => { url = new AdminUrlUtil(serverURL, radioFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/Relationship/e2e.spec.ts b/test/fields/collections/Relationship/e2e.spec.ts index d88ae5b5b2b..c1d74ffb164 100644 --- a/test/fields/collections/Relationship/e2e.spec.ts +++ b/test/fields/collections/Relationship/e2e.spec.ts @@ -14,7 +14,6 @@ import { addListFilter, openListFilters } from '../../../__helpers/e2e/filters/i import { ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, saveDocHotkeyAndAssert, } from '../../../__helpers/e2e/helpers.js' @@ -31,6 +30,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { relationshipFieldsSlug, textFieldsSlug } from '../../slugs.js' @@ -54,8 +54,7 @@ describe('relationship', () => { })) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -86,7 +85,7 @@ describe('relationship', () => { test('should create inline relationship within field with many relations', async () => { await loadCreatePage() - await openCreateDocDrawer({ page, fieldSelector: '#field-relationship' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationship', page }) await page .locator('.popup__content .relationship-add-new__relation-button--text-fields') .click() @@ -107,7 +106,7 @@ describe('relationship', () => { test('should save correct relationTo when creating doc in second collection (bug #14728)', async () => { await loadCreatePage() - await openCreateDocDrawer({ page, fieldSelector: '#field-relationship' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationship', page }) // Select the SECOND collection (array-fields) instead of the first (text-fields) await page @@ -134,7 +133,7 @@ describe('relationship', () => { await loadCreatePage() // Open first modal - await openCreateDocDrawer({ page, fieldSelector: '#field-relationToSelf' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationToSelf', page }) // Fill first modal's required relationship field await page.locator('[id^=doc-drawer_relationship-fields_1_] #field-relationship').click() @@ -229,14 +228,14 @@ describe('relationship', () => { collection: relationshipFieldsSlug, data: { relationship: { - value: createdRelatedDoc.id, relationTo: textFieldsSlug, + value: createdRelatedDoc.id, }, }, }) await payload.delete({ - collection: textFieldsSlug, id: createdRelatedDoc.id, + collection: textFieldsSlug, }) await page.goto(url.edit(doc.id)) @@ -327,7 +326,7 @@ describe('relationship', () => { await loadCreatePage() // First fill out the relationship field, as it's required - await openCreateDocDrawer({ page, fieldSelector: '#field-relationship' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationship', page }) await page .locator('.popup__content .relationship-add-new__relation-button--text-fields') .click() @@ -342,7 +341,7 @@ describe('relationship', () => { // Create a new doc for the `relationshipHasMany` field await expect.poll(() => page.url(), { timeout: POLL_TOPASS_TIMEOUT }).not.toContain('create') - await openCreateDocDrawer({ page, fieldSelector: '#field-relationshipHasMany' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationshipHasMany', page }) const value = 'Hello, world!' await page.locator('.drawer__content #field-text').fill(value) @@ -435,7 +434,7 @@ describe('relationship', () => { await loadCreatePage() // First fill out the relationship field, as it's required - await openCreateDocDrawer({ page, fieldSelector: '#field-relationship' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationship', page }) await page.locator('#field-relationship .value-container').click() await wait(500) // Select "Seeded text document" relationship @@ -644,7 +643,7 @@ describe('relationship', () => { await loadCreatePage() // First fill out the relationship field, as it's required - await openCreateDocDrawer({ page, fieldSelector: '#field-relationship' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationship', page }) await page.locator('#field-relationship .value-container').click() await page.getByText('Seeded text document', { exact: true }).click() @@ -656,7 +655,7 @@ describe('relationship', () => { await loadCreatePage() // First fill out the relationship field, as it's required - await openCreateDocDrawer({ page, fieldSelector: '#field-relationship' }) + await openCreateDocDrawer({ fieldSelector: '#field-relationship', page }) await page.locator('#field-relationship .value-container').click() await page.getByText('Seeded text document', { exact: true }).click() @@ -669,8 +668,8 @@ describe('relationship', () => { await page.click('#action-save', { delay: 100 }) await assertToastErrors({ - page, errors: ['Relationship With Min Rows'], + page, }) }) @@ -707,15 +706,15 @@ describe('relationship', () => { test('should allow filtering by relationship field / equals', async () => { const textDoc = await createTextFieldDoc() - await createRelationshipFieldDoc({ value: textDoc.id, relationTo: 'text-fields' }) + await createRelationshipFieldDoc({ relationTo: 'text-fields', value: textDoc.id }) await page.goto(url.list) await wait(1000) // wait for page to load await addListFilter({ - page, fieldLabel: 'Relationship', operatorLabel: 'equals', + page, value: 'some text', }) @@ -728,14 +727,14 @@ describe('relationship', () => { const textDoc3 = await createTextFieldDoc({ text: 'Text 3' }) await createRelationshipFieldDoc( - { value: textDoc1.id, relationTo: 'text-fields' }, + { relationTo: 'text-fields', value: textDoc1.id }, { relationshipHasMany: [textDoc1.id], }, ) await createRelationshipFieldDoc( - { value: textDoc2.id, relationTo: 'text-fields' }, + { relationTo: 'text-fields', value: textDoc2.id }, { relationshipHasMany: [textDoc2.id, textDoc3.id], }, @@ -745,11 +744,11 @@ describe('relationship', () => { await wait(1000) await addListFilter({ - page, fieldLabel: 'Relationship Has Many', + multiSelect: true, operatorLabel: 'equals', + page, value: 'Text 1', - multiSelect: true, }) await expect(page.locator(tableRowLocator)).toHaveCount(1) @@ -760,14 +759,14 @@ describe('relationship', () => { const textDoc2 = await createTextFieldDoc({ text: 'Poly Text 2' }) await createRelationshipFieldDoc( - { value: textDoc1.id, relationTo: 'text-fields' }, + { relationTo: 'text-fields', value: textDoc1.id }, { relationHasManyPolymorphic: [{ relationTo: 'text-fields', value: textDoc1.id }], }, ) await createRelationshipFieldDoc( - { value: textDoc2.id, relationTo: 'text-fields' }, + { relationTo: 'text-fields', value: textDoc2.id }, { relationHasManyPolymorphic: [ { relationTo: 'text-fields', value: textDoc1.id }, @@ -780,11 +779,11 @@ describe('relationship', () => { await wait(1000) await addListFilter({ - page, fieldLabel: 'Relation Has Many Polymorphic', + multiSelect: true, operatorLabel: 'equals', + page, value: 'Poly Text 1', - multiSelect: true, }) await expect(page.locator(tableRowLocator)).toHaveCount(1) @@ -801,36 +800,36 @@ describe('relationship', () => { // Select relationship field await selectInput({ - page, - selectLocator: condition.locator('.condition__field'), multiSelect: false, option: 'Relationship', + page, + selectLocator: condition.locator('.condition__field'), }) // Select equals operator (default) await selectInput({ - page, - selectLocator: condition.locator('.condition__operator'), multiSelect: false, option: 'equals', + page, + selectLocator: condition.locator('.condition__operator'), }) // Select a value const valueLocator = condition.locator('.condition__value') await selectInput({ - page, - selectLocator: valueLocator, multiSelect: false, option: 'Seeded text document', + page, + selectLocator: valueLocator, selectType: 'relationship', }) // Switch to "is not equal to" operator await selectInput({ - page, - selectLocator: condition.locator('.condition__operator'), multiSelect: false, option: 'is not equal to', + page, + selectLocator: condition.locator('.condition__operator'), }) // Wait for options to reload @@ -1114,10 +1113,10 @@ describe('relationship', () => { await page.locator('#field-select').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.collection-edit__main'], page, testInfo, - include: ['.collection-edit__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -1131,10 +1130,10 @@ describe('relationship', () => { await page.locator('#field-select').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.collection-edit__main'], page, testInfo, - include: ['.collection-edit__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -1146,8 +1145,8 @@ describe('relationship', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.collection-edit__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) @@ -1160,8 +1159,8 @@ async function createTextFieldDoc(overrides?: Partial): Promise diff --git a/test/fields/collections/Row/e2e.spec.ts b/test/fields/collections/Row/e2e.spec.ts index 61b7dbef4cc..789d67b19e8 100644 --- a/test/fields/collections/Row/e2e.spec.ts +++ b/test/fields/collections/Row/e2e.spec.ts @@ -10,12 +10,12 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' -import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' +import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { rowFieldsSlug } from '../../slugs.js' @@ -43,8 +43,7 @@ describe('Row', () => { url = new AdminUrlUtil(serverURL, rowFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/Select/e2e.spec.ts b/test/fields/collections/Select/e2e.spec.ts index 11720b0f36a..31d73af281d 100644 --- a/test/fields/collections/Select/e2e.spec.ts +++ b/test/fields/collections/Select/e2e.spec.ts @@ -12,7 +12,6 @@ import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicator import { clickColumnSelectorItem, openListColumns } from '../../../__helpers/e2e/columns/index.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, waitForFormReady, } from '../../../__helpers/e2e/helpers.js' @@ -21,6 +20,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { selectFieldsSlug } from '../../slugs.js' @@ -48,8 +48,7 @@ describe('Select', () => { url = new AdminUrlUtil(serverURL, selectFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -200,10 +199,10 @@ describe('Select', () => { await page.locator('#field-select').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.collection-edit__main'], page, testInfo, - include: ['.collection-edit__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -217,10 +216,10 @@ describe('Select', () => { await page.locator('#field-select').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.collection-edit__main'], page, testInfo, - include: ['.collection-edit__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -232,8 +231,8 @@ describe('Select', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.collection-edit__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) diff --git a/test/fields/collections/SlugField/e2e.spec.ts b/test/fields/collections/SlugField/e2e.spec.ts index 71e25157cdd..d574d0f8ff9 100644 --- a/test/fields/collections/SlugField/e2e.spec.ts +++ b/test/fields/collections/SlugField/e2e.spec.ts @@ -11,7 +11,6 @@ import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicator import { changeLocale, ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' @@ -19,6 +18,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { slugFieldsSlug } from '../../slugs.js' @@ -60,8 +60,7 @@ describe('SlugField', () => { url = new AdminUrlUtil(serverURL, slugFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -206,10 +205,10 @@ describe('SlugField', () => { await page.locator('#field-title').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.collection-edit__main'], page, testInfo, - include: ['.collection-edit__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -221,8 +220,8 @@ describe('SlugField', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.collection-edit__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) diff --git a/test/fields/collections/Tabs/e2e.spec.ts b/test/fields/collections/Tabs/e2e.spec.ts index e6860480201..442627bcc99 100644 --- a/test/fields/collections/Tabs/e2e.spec.ts +++ b/test/fields/collections/Tabs/e2e.spec.ts @@ -11,7 +11,6 @@ import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, switchTab, } from '../../../__helpers/e2e/helpers.js' @@ -21,6 +20,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { tabsFieldsSlug } from '../../slugs.js' @@ -48,8 +48,7 @@ describe('Tabs', () => { url = new AdminUrlUtil(serverURL, tabsFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -222,10 +221,10 @@ describe('Tabs', () => { await page.locator('.tabs-field__tabs').first().waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.collection-edit__main'], page, testInfo, - include: ['.collection-edit__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -237,8 +236,8 @@ describe('Tabs', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.collection-edit__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) diff --git a/test/fields/collections/Tabs2/e2e.spec.ts b/test/fields/collections/Tabs2/e2e.spec.ts index 824688bbc73..f03fb46f3ec 100644 --- a/test/fields/collections/Tabs2/e2e.spec.ts +++ b/test/fields/collections/Tabs2/e2e.spec.ts @@ -1,22 +1,22 @@ import type { Page } from '@playwright/test' import { expect, test } from '@playwright/test' -import { addArrayRow } from '../../../__helpers/e2e/fields/array/index.js' import path from 'path' import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' +import { addArrayRow } from '../../../__helpers/e2e/fields/array/index.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' -import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' +import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { tabsFields2Slug } from '../../slugs.js' @@ -44,8 +44,7 @@ describe('Tabs', () => { url = new AdminUrlUtil(serverURL, tabsFields2Slug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/Text/e2e.spec.ts b/test/fields/collections/Text/e2e.spec.ts index 330f7a74894..44cd39d1557 100644 --- a/test/fields/collections/Text/e2e.spec.ts +++ b/test/fields/collections/Text/e2e.spec.ts @@ -18,7 +18,6 @@ import { addListFilter } from '../../../__helpers/e2e/filters/index.js' import { ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, selectTableRow, } from '../../../__helpers/e2e/helpers.js' @@ -28,6 +27,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { textFieldsSlug } from '../../slugs.js' import { textDoc } from './shared.js' @@ -56,8 +56,7 @@ describe('Text', () => { url = new AdminUrlUtil(serverURL, textFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -166,9 +165,9 @@ describe('Text', () => { test('should respect admin.disableListColumn despite preferences', async () => { await upsertPreferences>({ + key: 'text-fields-list', payload, user: client.user, - key: 'text-fields-list', value: { columns: [ { @@ -194,9 +193,9 @@ describe('Text', () => { await page.waitForURL(new RegExp(`${url.list}.*\\?.*`)) await toggleColumn(page, { - targetState: 'on', columnLabel: 'Text en', columnName: 'i18nText', + targetState: 'on', }) const textCell = page.locator('.row-1 .cell-i18nText') @@ -285,9 +284,9 @@ describe('Text', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(2) await addListFilter({ - page, fieldLabel: 'Text', operatorLabel: 'is in', + page, value: 'Another text document', }) @@ -300,9 +299,9 @@ describe('Text', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(2) await addListFilter({ - page, fieldLabel: 'Text', operatorLabel: 'is not in', + page, value: 'Another text document', }) @@ -315,9 +314,9 @@ describe('Text', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(2) await addListFilter({ - page, fieldLabel: 'Has Many', operatorLabel: 'is in', + page, value: 'one', }) @@ -330,9 +329,9 @@ describe('Text', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(2) await addListFilter({ - page, fieldLabel: 'Has Many', operatorLabel: 'is not in', + page, value: 'four', }) @@ -345,9 +344,9 @@ describe('Text', () => { await expect(page.locator('table >> tbody >> tr')).toHaveCount(2) await addListFilter({ - page, fieldLabel: 'Has Many', operatorLabel: 'contains', + page, value: 'two', }) @@ -361,9 +360,9 @@ describe('Text', () => { // Add filter with first value const { condition } = await addListFilter({ - page, fieldLabel: 'Has Many', operatorLabel: 'contains', + page, value: 'one', }) @@ -383,10 +382,10 @@ describe('Text', () => { await page.locator('#field-text').waitFor() const scanResults = await runAxeScan({ + exclude: ['[id*="react-select-"]'], // ignore react-select elements here + include: ['.document-fields__main'], page, testInfo, - include: ['.document-fields__main'], - exclude: ['[id*="react-select-"]'], // ignore react-select elements here }) expect(scanResults.violations.length).toBe(0) diff --git a/test/fields/collections/Textarea/e2e.spec.ts b/test/fields/collections/Textarea/e2e.spec.ts index 498ef11c71d..27e42fd9716 100644 --- a/test/fields/collections/Textarea/e2e.spec.ts +++ b/test/fields/collections/Textarea/e2e.spec.ts @@ -19,7 +19,6 @@ import { addListFilter } from '../../../__helpers/e2e/filters/index.js' import { ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, selectTableRow, } from '../../../__helpers/e2e/helpers.js' @@ -29,6 +28,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { textareaFieldsSlug } from '../../slugs.js' import { textareaDoc } from './shared.js' @@ -57,8 +57,7 @@ describe('Textarea', () => { url = new AdminUrlUtil(serverURL, textareaFieldsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -162,9 +161,9 @@ describe('Textarea', () => { test('should respect admin.disableListColumn despite preferences', async () => { await upsertPreferences>({ + key: 'text-fields-list', payload, user: client.user, - key: 'text-fields-list', value: { columns: [ { @@ -190,9 +189,9 @@ describe('Textarea', () => { await page.waitForURL(new RegExp(`${url.list}.*\\?.*`)) await toggleColumn(page, { - targetState: 'on', columnLabel: 'Text en', columnName: 'i18nText', + targetState: 'on', }) const textCell = page.locator('.row-1 .cell-i18nText') @@ -223,10 +222,10 @@ describe('Textarea', () => { await page.locator('#field-text').waitFor() const scanResults = await runAxeScan({ + exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 + include: ['.document-fields__main'], page, testInfo, - include: ['.document-fields__main'], - exclude: ['.field-description'], // known issue - reported elsewhere @todo: remove this once fixed - see report https://github.com/payloadcms/payload/discussions/14489 }) expect(scanResults.violations.length).toBe(0) @@ -238,8 +237,8 @@ describe('Textarea', () => { const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.document-fields__main', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) diff --git a/test/fields/collections/UI/e2e.spec.ts b/test/fields/collections/UI/e2e.spec.ts index 73403694579..34c87fb8ba5 100644 --- a/test/fields/collections/UI/e2e.spec.ts +++ b/test/fields/collections/UI/e2e.spec.ts @@ -10,12 +10,12 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uiSlug } from '../../slugs.js' @@ -43,8 +43,7 @@ describe('Radio', () => { url = new AdminUrlUtil(serverURL, uiSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/Upload/e2e.spec.ts b/test/fields/collections/Upload/e2e.spec.ts index 4dea08882d5..d116d2f5b86 100644 --- a/test/fields/collections/Upload/e2e.spec.ts +++ b/test/fields/collections/Upload/e2e.spec.ts @@ -11,7 +11,6 @@ import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' @@ -19,6 +18,7 @@ import { openDocDrawer } from '../../../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsSlug } from '../../slugs.js' @@ -45,8 +45,7 @@ describe('Upload', () => { url = new AdminUrlUtil(serverURL, uploadsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/UploadMulti/e2e.spec.ts b/test/fields/collections/UploadMulti/e2e.spec.ts index f222dce45e2..f14b54ff6c3 100644 --- a/test/fields/collections/UploadMulti/e2e.spec.ts +++ b/test/fields/collections/UploadMulti/e2e.spec.ts @@ -11,13 +11,13 @@ import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { openDocDrawer } from '../../../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsMulti } from '../../slugs.js' @@ -44,8 +44,7 @@ describe('Upload with hasMany', () => { url = new AdminUrlUtil(serverURL, uploadsMulti) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/UploadMultiPoly/e2e.spec.ts b/test/fields/collections/UploadMultiPoly/e2e.spec.ts index 4ebb27bb1de..9b7a6955a0f 100644 --- a/test/fields/collections/UploadMultiPoly/e2e.spec.ts +++ b/test/fields/collections/UploadMultiPoly/e2e.spec.ts @@ -9,7 +9,6 @@ import { closeAllToasts, ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, waitForFormReady, } from '../../../__helpers/e2e/helpers.js' @@ -17,6 +16,7 @@ import { getSelectMenu } from '../../../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsMultiPoly } from '../../slugs.js' @@ -46,7 +46,7 @@ describe('Upload polymorphic with hasMany', () => { snapshotKey: 'fieldsTest', uploadsDir: path.resolve(dirname, './collections/Upload/uploads'), }) - initPageConsoleErrorCatch(page) + await initPage({ page }) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/UploadPoly/e2e.spec.ts b/test/fields/collections/UploadPoly/e2e.spec.ts index 131f840f480..bc19d3d9cc2 100644 --- a/test/fields/collections/UploadPoly/e2e.spec.ts +++ b/test/fields/collections/UploadPoly/e2e.spec.ts @@ -14,12 +14,12 @@ import { ensureCompilationIsDone, exactText, gotoAndWaitForForm, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsPoly } from '../../slugs.js' @@ -46,8 +46,7 @@ describe('Upload polymorphic', () => { url = new AdminUrlUtil(serverURL, uploadsPoly) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/fields/collections/UploadRestricted/e2e.spec.ts b/test/fields/collections/UploadRestricted/e2e.spec.ts index 6233ed20143..00175e0eee0 100644 --- a/test/fields/collections/UploadRestricted/e2e.spec.ts +++ b/test/fields/collections/UploadRestricted/e2e.spec.ts @@ -1,20 +1,20 @@ import type { Page } from '@playwright/test' -import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import { expect, test } from '@playwright/test' import path from 'path' import { fileURLToPath } from 'url' +import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' -import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' +import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsRestricted } from '../../slugs.js' @@ -43,8 +43,7 @@ describe('Upload with restrictions', () => { url = new AdminUrlUtil(serverURL, uploadsRestricted) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/form-state/e2e.spec.ts b/test/form-state/e2e.spec.ts index acd748d7b08..c0eac4c81d3 100644 --- a/test/form-state/e2e.spec.ts +++ b/test/form-state/e2e.spec.ts @@ -21,7 +21,6 @@ import { import { addBlock } from '../__helpers/e2e/fields/blocks/index.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, throttleTest, waitForFormReady, @@ -30,6 +29,7 @@ import { currentFramework, test } from '../__helpers/e2e/playwright.js' import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSaveToRunAndComplete.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { autosavePostsSlug } from './collections/Autosave/index.js' import { postsSlug } from './collections/Posts/index.js' @@ -56,8 +56,7 @@ test.describe('Form State', () => { autosavePostsUrl = new AdminUrlUtil(serverURL, autosavePostsSlug) context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/group-by/e2e.spec.ts b/test/group-by/e2e.spec.ts index 10efb31bcc5..509f2020f68 100644 --- a/test/group-by/e2e.spec.ts +++ b/test/group-by/e2e.spec.ts @@ -19,7 +19,6 @@ import { import { ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, selectTableRow, } from '../__helpers/e2e/helpers.js' @@ -30,6 +29,7 @@ import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { @@ -61,8 +61,7 @@ test.describe('Group By', () => { noGroupableUrl = new AdminUrlUtil(serverURL, noGroupableSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) user = await payload.login({ diff --git a/test/hierarchy/e2e.spec.ts b/test/hierarchy/e2e.spec.ts index 00cac58d172..20d4b6ac815 100644 --- a/test/hierarchy/e2e.spec.ts +++ b/test/hierarchy/e2e.spec.ts @@ -7,10 +7,11 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config, Organization } from './payload-types.js' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -69,8 +70,7 @@ test.describe('Hierarchy Sidebar', () => { organizationsURL = new AdminUrlUtil(serverURL, 'organizations') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -159,7 +159,7 @@ test.describe('Hierarchy Sidebar', () => { where: { key: { equals: 'hierarchy-tree-divisions' } }, }) for (const pref of prefs.docs) { - await payload.delete({ collection: 'payload-preferences', id: pref.id }) + await payload.delete({ id: pref.id, collection: 'payload-preferences' }) } await page.goto(`${serverURL}/admin`) @@ -425,7 +425,7 @@ test.describe('Hierarchy Sidebar', () => { where: { key: { equals: 'hierarchy-tree-folders' } }, }) for (const pref of prefs.docs) { - await payload.delete({ collection: 'payload-preferences', id: pref.id }) + await payload.delete({ id: pref.id, collection: 'payload-preferences' }) } }) diff --git a/test/hooks/e2e.spec.ts b/test/hooks/e2e.spec.ts index 6c00faee7db..f53471048f9 100644 --- a/test/hooks/e2e.spec.ts +++ b/test/hooks/e2e.spec.ts @@ -10,11 +10,11 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { beforeValidateSlug } from './shared.js' @@ -42,9 +42,8 @@ describe('Hooks', () => { beforeDeleteURL = new AdminUrlUtil(serverURL, 'before-delete-hooks') beforeDelete2URL = new AdminUrlUtil(serverURL, 'before-delete-2-hooks') const context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) @@ -121,8 +120,8 @@ describe('Hooks', () => { .toBe(1) await payload.delete({ - collection: 'before-delete-hooks', id: doc.id, + collection: 'before-delete-hooks', }) }) @@ -162,8 +161,8 @@ describe('Hooks', () => { .toBe(1) await payload.delete({ - collection: 'before-delete-hooks', id: doc.id, + collection: 'before-delete-hooks', }) }) @@ -192,8 +191,8 @@ describe('Hooks', () => { ) await payload.delete({ - collection: 'before-delete-2-hooks', id: doc.id, + collection: 'before-delete-2-hooks', }) }) @@ -218,8 +217,8 @@ describe('Hooks', () => { ) await payload.delete({ - collection: 'before-delete-2-hooks', id: doc.id, + collection: 'before-delete-2-hooks', }) }) }) diff --git a/test/i18n/e2e.spec.ts b/test/i18n/e2e.spec.ts index e04d576effe..81f3f0b0dc8 100644 --- a/test/i18n/e2e.spec.ts +++ b/test/i18n/e2e.spec.ts @@ -15,10 +15,11 @@ import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import { assertNetworkRequests } from '../__helpers/e2e/assertNetworkRequests.js' import { getColumnSelectorItem } from '../__helpers/e2e/columns/index.js' import { openListFilters } from '../__helpers/e2e/filters/index.js' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' let payload: PayloadTestSDK @@ -46,9 +47,8 @@ describe('i18n', () => { collection1URL = new AdminUrlUtil(serverURL, 'collection1') const context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) beforeEach(async () => { diff --git a/test/joins/e2e.spec.ts b/test/joins/e2e.spec.ts index 47ac530e404..9973a782af7 100644 --- a/test/joins/e2e.spec.ts +++ b/test/joins/e2e.spec.ts @@ -12,7 +12,6 @@ import { changeLocale, ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, // throttleTest, } from '../__helpers/e2e/helpers.js' @@ -22,6 +21,7 @@ import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' +import { initPage } from '../__setup/initPage.js' import { EXPECT_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { categoriesJoinRestrictedSlug, @@ -67,8 +67,7 @@ describe('Join Field', () => { versionsURL = new AdminUrlUtil(serverURL, versionsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) //await throttleTest({ context, delay: 'Slow 4G', page }) @@ -102,7 +101,7 @@ describe('Join Field', () => { ;({ id: categoryID } = docs[0]) - const folder = await payload.find({ collection: 'folders', sort: 'createdAt', depth: 0 }) + const folder = await payload.find({ collection: 'folders', depth: 0, sort: 'createdAt' }) rootParentID = folder.docs[0]!.id }) @@ -144,24 +143,24 @@ describe('Join Field', () => { await payload.create({ collection: postsSlug, data: { - title: 'a', category: category.id, + title: 'a', }, }) await payload.create({ collection: postsSlug, data: { - title: 'b', category: category.id, + title: 'b', }, }) await payload.create({ collection: postsSlug, data: { - title: 'z', category: category.id, + title: 'z', }, }) @@ -306,9 +305,9 @@ describe('Join Field', () => { await expect(link).toBeHidden() await reorderColumns(page, { - togglerSelector: '#field-relatedPosts .columns-button__button', fromColumn: 'Category', toColumn: 'Title', + togglerSelector: '#field-relatedPosts .columns-button__button', }) const newActionColumn = joinField.locator('tbody tr td:nth-child(2)').first() @@ -319,9 +318,9 @@ describe('Join Field', () => { // put columns back in original order for the next test await reorderColumns(page, { - togglerSelector: '#field-relatedPosts .columns-button__button', fromColumn: 'Title', toColumn: 'Category', + togglerSelector: '#field-relatedPosts .columns-button__button', }) }) @@ -351,9 +350,9 @@ describe('Join Field', () => { const innerText = await thead.innerText() // expect the order of columns to be 'ID', 'Created At', 'Title' - // eslint-disable-next-line payload/no-flaky-assertions + expect(innerText.indexOf('ID')).toBeLessThan(innerText.indexOf('Created At')) - // eslint-disable-next-line payload/no-flaky-assertions + expect(innerText.indexOf('Created At')).toBeLessThan(innerText.indexOf('Title')) }) @@ -526,8 +525,8 @@ describe('Join Field', () => { await payload.create({ collection: postsSlug, data: { - title, category: categoryID as string, + title, }, }) @@ -612,8 +611,8 @@ describe('Join Field', () => { await payload.create({ collection: versionsSlug, data: { - title: 'Test Post', categoryVersion: categoryVersionsDoc.id, + title: 'Test Post', }, }) @@ -885,8 +884,8 @@ describe('Join Field', () => { const versionDoc = await payload.create({ collection: versionsSlug, data: { - title: 'Version 1', categoryVersion: categoryVersionsDoc.id, + title: 'Version 1', }, }) diff --git a/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts b/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts index bddc85188d0..ceb5f7e7666 100644 --- a/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts +++ b/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts @@ -22,7 +22,6 @@ import type { Config, LexicalField, Upload } from '../../../../payload-types.js' import { assertNetworkRequests } from '../../../../../__helpers/e2e/assertNetworkRequests.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, waitForFormReady, waitForLexicalReady, @@ -34,6 +33,7 @@ import { assertToastErrors } from '../../../../../__helpers/shared/assertToastEr import { reInitializeDB } from '../../../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../../../__helpers/shared/rest.js' +import { initPage } from '../../../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../../../playwright.config.js' import { lexicalFieldsSlug, lexicalNestedBlocksSlug } from '../../../../slugs.js' import { lexicalDocData } from '../../data.js' @@ -64,9 +64,8 @@ describe('lexicalBlocks', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) @@ -96,7 +95,6 @@ describe('lexicalBlocks', () => { const { richTextField } = await navigateToLexicalFields() const { newBlock: newRSCBlock } = await createBlock({ - richTextField, name: 'Block R S C', async afterLastParagraphClick() { await page.keyboard.press('1') @@ -105,6 +103,7 @@ describe('lexicalBlocks', () => { await page.keyboard.press('Enter') }, + richTextField, }) await expect(newRSCBlock.locator('.collapsible__content')).toHaveText('Data:') @@ -186,8 +185,8 @@ describe('lexicalBlocks', () => { const { richTextField } = await navigateToLexicalFields() const { newBlock } = await createBlock({ - richTextField, name: 'No Block Name', + richTextField, }) await expect(newBlock.locator('#blockName')).toHaveCount(0) @@ -214,8 +213,8 @@ describe('lexicalBlocks', () => { }) const { newBlock } = await createBlock({ - richTextField, name: 'Filter Options Block', + richTextField, }) await saveDocAndAssert(page) @@ -256,11 +255,11 @@ describe('lexicalBlocks', () => { return { blockGroupTextField, blockTextField, - dependsOnDocData, dependsOnBlockData, + dependsOnDocData, dependsOnSiblingData, - topLevelDocTextField, newBlock: reloadedBlock, + topLevelDocTextField, } } @@ -416,8 +415,8 @@ describe('lexicalBlocks', () => { }) const { newBlock } = await createBlock({ - richTextField, name: 'Validation Block', + richTextField, }) await saveDocAndAssert(page) @@ -459,11 +458,11 @@ describe('lexicalBlocks', () => { return { blockGroupTextField, blockTextField, + dependsOnBlockData, dependsOnDocData, dependsOnSiblingData, - dependsOnBlockData, - topLevelDocTextField, newBlock: reloadedBlock, + topLevelDocTextField, } } @@ -475,8 +474,8 @@ describe('lexicalBlocks', () => { await saveDocAndAssert(page, '#action-save', 'error', { disableDismissAllToasts: true }) await assertToastErrors({ - page, errors: ['Lexical With Blocks', 'Lexical With Blocks → Group → Text Depends On Doc Data'], + page, }) await expect(page.locator('.payload-toast-container .payload-toast-item')).toBeHidden() @@ -500,11 +499,11 @@ describe('lexicalBlocks', () => { await saveDocAndAssert(page, '#action-save', 'error', { disableDismissAllToasts: true }) await assertToastErrors({ - page, errors: [ 'Lexical With Blocks', 'Lexical With Blocks → Group → Text Depends On Sibling Data', ], + page, }) await expect(page.locator('.payload-toast-container .payload-toast-item')).toBeHidden() @@ -527,8 +526,8 @@ describe('lexicalBlocks', () => { await saveDocAndAssert(page, '#action-save', 'error', { disableDismissAllToasts: true }) await assertToastErrors({ - page, errors: ['Lexical With Blocks', 'Lexical With Blocks → Group → Text Depends On Block Data'], + page, }) await expect(page.locator('.payload-toast-container .payload-toast-item')).toBeHidden() @@ -549,8 +548,8 @@ describe('lexicalBlocks', () => { const { richTextField } = await navigateToLexicalFields() const { newBlock } = await createBlock({ - richTextField, name: 'Async Hooks Block', + richTextField, }) await newBlock.locator('#field-test1').fill('text1') @@ -882,8 +881,8 @@ describe('lexicalBlocks', () => { const { richTextField } = await navigateToLexicalFields() const { newBlock: newRichTextBlock, slashMenuPopover } = await createBlock({ - richTextField, name: 'Rich Text', + richTextField, }) // Ensure that sub-editor is empty and wait for it to be fully initialized @@ -1768,9 +1767,9 @@ async function createInlineBlock({ } async function createBlock({ - richTextField, name, afterLastParagraphClick, + richTextField, }: { afterLastParagraphClick?: (args: { lastParagraph: Locator }) => Promise | void name: string diff --git a/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts b/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts index 1622b8e15ec..f5efad404e2 100644 --- a/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts +++ b/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts @@ -17,7 +17,6 @@ import type { Config, LexicalField } from '../../../../payload-types.js' import { closeAllToasts, ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, saveDocHotkeyAndAssert, waitForFormReady, @@ -30,6 +29,7 @@ import { AdminUrlUtil } from '../../../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../../../__helpers/shared/rest.js' +import { initPage } from '../../../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../../../playwright.config.js' import { lexicalCustomCellSlug, lexicalFieldsSlug, richTextFieldsSlug } from '../../../../slugs.js' import { lexicalDocData } from '../../data.js' @@ -83,9 +83,8 @@ describe('lexicalMain', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/lexical/collections/utils.ts b/test/lexical/collections/utils.ts index 95ffddf9879..f2c17627b11 100644 --- a/test/lexical/collections/utils.ts +++ b/test/lexical/collections/utils.ts @@ -5,7 +5,7 @@ import fs from 'fs' import path from 'path' import { wait } from 'payload/shared' -import { patchPageGoToWithHydrationMarker } from '../../__helpers/e2e/goTo.js' +import { patchPageGoToWithHydrationMarker } from '../../__setup/patchPageGoToWithHydrationMarker.js' export type PasteMode = 'blob' | 'html' @@ -143,9 +143,9 @@ export class LexicalHelpers { const evt = new DragEvent(type, { bubbles: true, cancelable: true, - composed: true, clientX: x, clientY: y, + composed: true, dataTransfer: dt, }) target.dispatchEvent(evt) @@ -155,7 +155,7 @@ export class LexicalHelpers { dispatch('dragover') dispatch('drop') }, - { bytes, name, mime }, + { name, bytes, mime }, ) } @@ -185,12 +185,12 @@ export class LexicalHelpers { if (mode === 'blob') { const buf = await fs.promises.readFile(filePath) - payload = { kind: 'blob', bytes: Array.from(buf), name, mime } + payload = { name, bytes: Array.from(buf), kind: 'blob', mime } } else if (mode === 'html') { const b64 = await readAsBase64(filePath) const src = `data:${mime};base64,${b64}` const html = `${name}` - payload = { kind: 'html', html } + payload = { html, kind: 'html' } } await this.page.evaluate((p) => { @@ -210,9 +210,9 @@ export class LexicalHelpers { try { const evt = new ClipboardEvent('paste', { - clipboardData: dt, bubbles: true, cancelable: true, + clipboardData: dt, }) target.dispatchEvent(evt) } catch { diff --git a/test/live-preview/e2e.spec.ts b/test/live-preview/e2e.spec.ts index 463af3724ae..edf6fda3483 100644 --- a/test/live-preview/e2e.spec.ts +++ b/test/live-preview/e2e.spec.ts @@ -10,7 +10,6 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, // throttleTest, } from '../__helpers/e2e/helpers.js' @@ -30,6 +29,7 @@ import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSav import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { @@ -72,7 +72,7 @@ describe('Live Preview', () => { beforeAll(async ({ browser }, testInfo) => { testInfo.setTimeout(TEST_TIMEOUT_LONG) - ;({ serverURL, payload } = await initPayloadE2ENoConfig({ dirname })) + ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) pagesURLUtil = new AdminUrlUtil(serverURL, pagesSlug) postsURLUtil = new AdminUrlUtil(serverURL, postsSlug) @@ -81,9 +81,8 @@ describe('Live Preview', () => { ssrAutosavePagesURLUtil = new AdminUrlUtil(serverURL, ssrAutosavePagesSlug) context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) user = await payload @@ -148,9 +147,9 @@ describe('Live Preview', () => { test('saves live preview state to preferences and loads it on next visit', async () => { await deletePreferences({ + key: `collection-${pagesSlug}`, payload, user, - key: `collection-${pagesSlug}`, }) await navigateToDoc(page, pagesURLUtil) @@ -185,9 +184,9 @@ describe('Live Preview', () => { const openByDefaultURL = new AdminUrlUtil(serverURL, openByDefaultSlug) await deletePreferences({ + key: `collection-${openByDefaultSlug}`, payload, user, - key: `collection-${openByDefaultSlug}`, }) await page.goto(openByDefaultURL.create) @@ -215,9 +214,9 @@ describe('Live Preview', () => { test('collection — defers iframe render until toggled and keeps it mounted after toggling off', async () => { await deletePreferences({ + key: `collection-${pagesSlug}`, payload, user, - key: `collection-${pagesSlug}`, }) await navigateToDoc(page, pagesURLUtil) @@ -459,11 +458,11 @@ describe('Live Preview', () => { const testDoc = await payload.create({ collection: pagesSlug, data: { - title: initialTitle, slug: 'csr-test', hero: { type: 'none', }, + title: initialTitle, }, }) @@ -601,11 +600,11 @@ describe('Live Preview', () => { const testDoc = await payload.create({ collection: ssrAutosavePagesSlug, data: { - title: initialTitle, slug: 'ssr-test', hero: { type: 'none', }, + title: initialTitle, }, }) @@ -617,7 +616,7 @@ describe('Live Preview', () => { const titleField = page.locator('#field-title') - const { iframe, frame } = await getLivePreviewIframe(page, { + const { frame, iframe } = await getLivePreviewIframe(page, { expectIframeSrcToMatch: new RegExp(`/live-preview/${ssrAutosavePagesSlug}/${testDoc.slug}`), }) @@ -668,13 +667,13 @@ describe('Live Preview', () => { await expect(frame.locator(renderedPageTitleLocator)).toHaveText('For Testing: SSR Home') const newTitleValue = 'SSR Home (Edited)' - // eslint-disable-next-line payload/no-wait-function + await wait(1000) await titleField.clear() await titleField.pressSequentially(newTitleValue) - // eslint-disable-next-line payload/no-wait-function + await wait(1000) await waitForAutoSaveToRunAndComplete(page) @@ -903,10 +902,10 @@ describe('Live Preview', () => { await expect.poll(async () => iframe.getAttribute('src')).toMatch(/\/live-preview/) const scanResults = await runAxeScan({ + exclude: ['.document-fields__main'], // we don't need to test fields here + include: ['.collection-edit'], page, testInfo, - include: ['.collection-edit'], - exclude: ['.document-fields__main'], // we don't need to test fields here }) expect(scanResults.violations.length).toBe(0) diff --git a/test/localization/e2e.spec.ts b/test/localization/e2e.spec.ts index 826183e90a1..61c60f7be4d 100644 --- a/test/localization/e2e.spec.ts +++ b/test/localization/e2e.spec.ts @@ -17,7 +17,6 @@ import { closeLocaleSelector, ensureCompilationIsDone, findTableRow, - initPageConsoleErrorCatch, openLocaleSelector, saveDocAndAssert, throttleTest, @@ -33,6 +32,7 @@ import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSav import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' +import { initPage } from '../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { arrayCollectionSlug } from './collections/Array/index.js' import { blocksCollectionSlug } from './collections/Blocks/index.js' @@ -109,9 +109,8 @@ describe('Localization', () => { urlLocaleRestricted = new AdminUrlUtil(serverURL, localeRestrictedSlug) context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) client = new RESTClient({ defaultSlug: 'users', serverURL }) @@ -336,7 +335,7 @@ describe('Localization', () => { await changeLocale(page, defaultLocale) await page.locator('#field-title').fill(englishTitle) await page.locator('button.tabs-field__tab-button', { hasText: 'Main Nav' }).click() - await addBlock({ page, fieldName: 'nav__layout', blockToSelect: 'Text' }) + await addBlock({ blockToSelect: 'Text', fieldName: 'nav__layout', page }) await page.locator('#field-nav__layout__0__text').waitFor({ state: 'visible' }) await page.locator('#field-nav__layout__0__text').fill('test') await expect(page.locator('#field-nav__layout__0__text')).toHaveValue('test') @@ -368,9 +367,9 @@ describe('Localization', () => { test('should not render default locale in locale selector when prefs are not default', async () => { await upsertPreferences>({ + key: 'locale', payload, user: client.user, - key: 'locale', value: 'es', }) @@ -453,10 +452,10 @@ describe('Localization', () => { test('should not overwrite existing data when overwrite is unchecked', async () => { await changeLocale(page, defaultLocale) - await createAndSaveDoc(page, url, { title: englishTitle, description }) + await createAndSaveDoc(page, url, { description, title: englishTitle }) await changeLocale(page, spanishLocale) - await fillValues({ title: spanishTitle, description: 'Spanish description' }) + await fillValues({ description: 'Spanish description', title: spanishTitle }) await saveDocAndAssert(page) await changeLocale(page, defaultLocale) @@ -472,7 +471,7 @@ describe('Localization', () => { test('should overwrite existing data when overwrite is checked', async () => { await changeLocale(page, defaultLocale) - await createAndSaveDoc(page, url, { title: englishTitle, description }) + await createAndSaveDoc(page, url, { description, title: englishTitle }) await changeLocale(page, spanishLocale) await fillValues({ title: spanishTitle }) await saveDocAndAssert(page) @@ -566,7 +565,7 @@ describe('Localization', () => { await titleField.fill('English Block Title') // Add a block with content - await addBlock({ page, fieldName: 'content', blockToSelect: 'Block Inside Block' }) + await addBlock({ blockToSelect: 'Block Inside Block', fieldName: 'content', page }) const blockTextField = page.locator('#field-content__0__text') await blockTextField.fill('English block text content') @@ -636,9 +635,9 @@ describe('Localization', () => { // only throttle test after initial load to avoid timeouts const cdpSession = await throttleTest({ - page, context, delay: 'Fast 4G', + page, }) await localeToSelect.click() @@ -650,9 +649,9 @@ describe('Localization', () => { await closeLocaleSelector(page) await cdpSession.send('Network.emulateNetworkConditions', { - offline: false, - latency: 0, downloadThroughput: -1, + latency: 0, + offline: false, uploadThroughput: -1, }) @@ -752,7 +751,7 @@ describe('Localization', () => { await changeLocale(page, 'en') const titleLocator = page.locator('#field-title') await titleLocator.fill('Block Test') - await addBlock({ page, blockToSelect: 'Block Inside Block', fieldName: 'content' }) + await addBlock({ blockToSelect: 'Block Inside Block', fieldName: 'content', page }) const rowTextInput = page.locator(`#field-content__0__text`) await rowTextInput.fill('text') await saveDocAndAssert(page) @@ -772,7 +771,7 @@ describe('Localization', () => { // The only reason it passed after a retry was because after it fails, it will set the locale to pt. When it then retries, it will incorrectly start with pt instead of en. await page.goto(urlBlocks.create) - await addBlock({ page, blockToSelect: 'Block Inside Block', fieldName: 'content' }) + await addBlock({ blockToSelect: 'Block Inside Block', fieldName: 'content', page }) const rowTextInput = page.locator(`#field-content__0__text`) await rowTextInput.fill('text') await saveDocAndAssert(page) @@ -784,10 +783,10 @@ describe('Localization', () => { const doc = await payload.find({ collection: 'blocks-fields', - where: { id: { equals: docID } }, locale: 'all', + where: { id: { equals: docID } }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(doc.docs).toHaveLength(1) }) }) @@ -815,7 +814,7 @@ describe('Localization', () => { // This verifies that the Popup component is not hidden behind overflow: hidden of the parent element, // which is set for smaller screen sizes. // This was an issue until createPortal was introduced in the Popup component. - await page.setViewportSize({ width: 480, height: 720 }) + await page.setViewportSize({ height: 720, width: 480 }) await page.goto(urlBlocks.create) await page.locator('.form-submit .popup-button').click() @@ -1032,8 +1031,6 @@ describe('Localization', () => { await payload.create({ collection: withRequiredLocalizedFields, data: { - title: 'Existing doc title', - seoTitle: uniqueSeoTitle, nav: { layout: [ { @@ -1042,6 +1039,8 @@ describe('Localization', () => { }, ], }, + seoTitle: uniqueSeoTitle, + title: 'Existing doc title', }, locale: defaultLocale, }) @@ -1051,7 +1050,7 @@ describe('Localization', () => { await page.locator('#field-title').fill('Second doc title') await page.locator('button.tabs-field__tab-button', { hasText: 'Main Nav' }).click() - await addBlock({ page, fieldName: 'nav__layout', blockToSelect: 'Text' }) + await addBlock({ blockToSelect: 'Text', fieldName: 'nav__layout', page }) await page.locator('#field-nav__layout__0__text').waitFor({ state: 'visible' }) await page.locator('#field-nav__layout__0__text').fill('test block') @@ -1082,10 +1081,10 @@ describe('Localization', () => { await page.goto(url.list) const scanResults = await runAxeScan({ + exclude: ['main'], + include: ['.localizer'], page, testInfo, - include: ['.localizer'], - exclude: ['main'], }) expect(scanResults.violations.length).toBe(0) diff --git a/test/locked-documents/e2e.spec.ts b/test/locked-documents/e2e.spec.ts index 4cc0f883ab5..757143f293a 100644 --- a/test/locked-documents/e2e.spec.ts +++ b/test/locked-documents/e2e.spec.ts @@ -24,19 +24,19 @@ import { goToNextPage } from '../__helpers/e2e/goToNextPage.js' import { ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { getSelectMenu } from '../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) -const { beforeAll, describe, beforeEach } = test +const { beforeAll, beforeEach, describe } = test const lockedDocumentCollection = 'payload-locked-documents' @@ -67,9 +67,8 @@ describe('Locked Documents', () => { autosaveUrl = new AdminUrlUtil(serverURL, 'autosave') const context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) @@ -90,7 +89,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - // eslint-disable-next-line payload/no-wait-function + await wait(500) const lockedDocs = await payload.find({ @@ -194,7 +193,7 @@ describe('Locked Documents', () => { await page.goto(testsUrl.list) // Need to wait for lock duration to expire (lockDuration: 5 seconds) - // eslint-disable-next-line payload/no-wait-function + await wait(5000) await page.reload() @@ -268,8 +267,8 @@ describe('Locked Documents', () => { test('should only allow bulk unpublish on unlocked documents on all pages', async () => { await mapAsync([...Array(10)], async () => { await createPostDoc({ - text: 'Ready for publish', _status: 'published', + text: 'Ready for publish', }) }) @@ -287,8 +286,8 @@ describe('Locked Documents', () => { test('should only allow bulk edit on unlocked documents on all pages', async () => { await mapAsync([...Array(8)], async () => { await createPostDoc({ - text: 'doc', _status: 'draft', + text: 'doc', }) }) await page.goto(postsUrl.list) @@ -406,7 +405,7 @@ describe('Locked Documents', () => { await expect(page.locator('.table .row-2 .locked svg.icon--lock')).toBeVisible() await expect(page.locator('.table .row-3 .locked svg.icon--lock')).toBeVisible() - // eslint-disable-next-line payload/no-wait-function + await wait(5000) await page.reload() @@ -426,7 +425,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('some test doc') - // eslint-disable-next-line payload/no-wait-function + await wait(500) const lockedDocs = await payload.find({ @@ -443,7 +442,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - // eslint-disable-next-line payload/no-wait-function + await wait(500) const lockedDocs = await payload.find({ @@ -464,7 +463,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - // eslint-disable-next-line payload/no-wait-function + await wait(500) const lockedDocs = await payload.find({ @@ -480,7 +479,7 @@ describe('Locked Documents', () => { await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) const unlockedDocs = await payload.find({ @@ -501,7 +500,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('testing tab navigation...') - // eslint-disable-next-line payload/no-wait-function + await wait(500) const lockedDocs = await payload.find({ @@ -524,7 +523,7 @@ describe('Locked Documents', () => { // Click the "Leave anyway" button await page.locator('#leave-without-saving .dialog__footer .btn--style-primary').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) const unlockedDocs = await payload.find({ @@ -552,7 +551,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - // eslint-disable-next-line payload/no-wait-function + await wait(1000) const lockedDocs = await payload.find({ @@ -575,7 +574,7 @@ describe('Locked Documents', () => { // Click the "Leave anyway" button await page.locator('#leave-without-saving .dialog__footer .btn--style-primary').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) expect(page.url()).toContain(postsUrl.list) @@ -665,17 +664,17 @@ describe('Locked Documents', () => { expiredPostLockedDoc = await payload.create({ collection: lockedDocumentCollection, data: { + createdAt: new Date(Date.now() - 1000 * 60 * 60).toISOString(), document: { relationTo: 'posts', value: expiredPostDoc.id, }, globalSlug: undefined, + updatedAt: new Date(Date.now() - 1000 * 60 * 60).toISOString(), user: { relationTo: 'users', value: user2.id, }, - createdAt: new Date(Date.now() - 1000 * 60 * 60).toISOString(), - updatedAt: new Date(Date.now() - 1000 * 60 * 60).toISOString(), }, }) @@ -698,7 +697,7 @@ describe('Locked Documents', () => { test('should show Document Locked modal for incoming user when entering locked document', async () => { await page.goto(postsUrl.list) - // eslint-disable-next-line payload/no-wait-function + await wait(500) await page.goto(postsUrl.edit(postDoc.id)) @@ -715,7 +714,7 @@ describe('Locked Documents', () => { test('should properly close modal and allow re-opening after clicking Go Back', async () => { await page.goto(postsUrl.list) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // First time: navigate to locked document @@ -745,7 +744,7 @@ describe('Locked Documents', () => { await page.goto(testsUrl.list) // Need to wait for lock duration to expire (lockDuration: 5 seconds) - // eslint-disable-next-line payload/no-wait-function + await wait(5000) await page.reload() @@ -887,7 +886,7 @@ describe('Locked Documents', () => { // Click take-over button to take over editing rights of locked doc await page.locator('#document-locked-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(1000) const lockedDoc = await payload.find({ @@ -899,7 +898,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) expect(lockedDoc.docs.length).toBe(1) @@ -999,7 +998,7 @@ describe('Locked Documents', () => { await page.locator('#take-over').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) const lockedDoc = await payload.find({ @@ -1011,7 +1010,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) expect(lockedDoc.docs.length).toBe(1) @@ -1042,7 +1041,7 @@ describe('Locked Documents', () => { await page.locator('#take-over').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) await expect(page.locator('#field-customTextServer')).toBeEnabled() @@ -1080,7 +1079,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Retrieve document id from payload locks collection @@ -1093,7 +1092,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Update payload-locks collection document with different user @@ -1108,7 +1107,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(1000) // Try to edit the document again as the "old" user @@ -1119,8 +1118,8 @@ describe('Locked Documents', () => { await expect(modalContainer).toBeVisible() await payload.delete({ - collection: lockedDocumentCollection, id: lockedDoc.docs[0]?.id, + collection: lockedDocumentCollection, }) }) @@ -1130,7 +1129,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Retrieve document id from payload locks collection @@ -1143,7 +1142,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Update payload-locks collection document with different user @@ -1158,7 +1157,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(1000) // Try to edit the document again as the "old" user @@ -1174,8 +1173,8 @@ describe('Locked Documents', () => { expect(page.url()).toContain(postsUrl.admin) await payload.delete({ - collection: lockedDocumentCollection, id: lockedDoc.docs[0]?.id, + collection: lockedDocumentCollection, }) }) @@ -1185,7 +1184,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Retrieve document id from payload locks collection @@ -1198,7 +1197,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Update payload-locks collection document with different user @@ -1213,7 +1212,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Try to edit the document again as the "old" user @@ -1240,7 +1239,7 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-customTextServer') await textInput.fill('hello world') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Retrieve document id from payload locks collection @@ -1253,7 +1252,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Update payload-locks collection document with different user @@ -1268,7 +1267,7 @@ describe('Locked Documents', () => { }, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Try to edit the document again as the "old" user @@ -1336,11 +1335,11 @@ describe('Locked Documents', () => { test('should not show lock on document card in dashboard view if unlocked', async () => { await payload.delete({ - collection: lockedDocumentCollection, id: lockedMenuGlobal.id, + collection: lockedDocumentCollection, }) - // eslint-disable-next-line payload/no-wait-function + await wait(500) await page.goto(postsUrl.admin) @@ -1350,8 +1349,8 @@ describe('Locked Documents', () => { test('should not show lock on document card in dashboard view if locked by current user', async () => { await payload.delete({ - collection: lockedDocumentCollection, id: lockedMenuGlobal.id, + collection: lockedDocumentCollection, }) await page.goto(globalUrl.global('menu')) @@ -1374,7 +1373,7 @@ describe('Locked Documents', () => { ).toBeVisible() // Need to wait for lock duration to expire (lockDuration: 10 seconds) - // eslint-disable-next-line payload/no-wait-function + await wait(10000) await page.reload() @@ -1382,8 +1381,8 @@ describe('Locked Documents', () => { await expect(page.locator('.collections__card-list #card-admin .locked')).toBeHidden() await payload.delete({ - collection: lockedDocumentCollection, id: lockedAdminGlobal.id, + collection: lockedDocumentCollection, }) }) @@ -1407,7 +1406,7 @@ describe('Locked Documents', () => { ).toBeVisible() // Need to wait for lock duration to expire (lockDuration: 10 seconds) - // eslint-disable-next-line payload/no-wait-function + await wait(10000) await page.reload() @@ -1474,14 +1473,14 @@ describe('Locked Documents', () => { await user1FieldA.fill('User 1 Change') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit (should trigger stale data check) const user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('User 2 Change') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Stale data modal should appear for user 2 @@ -1502,20 +1501,20 @@ describe('Locked Documents', () => { await user1FieldA.fill('User 1 Updated Value') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit const user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Should be discarded') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 clicks reload button in modal await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) const modalContainer = user2Page.locator('.payload__modal-container') @@ -1535,14 +1534,14 @@ describe('Locked Documents', () => { await user1FieldA.fill('Cycle 1 - User 1') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit and sees modal let user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Cycle 1 - User 2 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) let modalContainer = user2Page.locator('.payload__modal-container') @@ -1551,7 +1550,7 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 2: User 2 now saves @@ -1559,14 +1558,14 @@ describe('Locked Documents', () => { await user2FieldA.fill('Cycle 2 - User 2') await saveDocAndAssert(user2Page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 tries to edit and should see modal again user1FieldA = page.locator('#field-fieldA') await user1FieldA.fill('Cycle 2 - User 1 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -1575,7 +1574,7 @@ describe('Locked Documents', () => { // User 1 reloads await page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 3: User 1 now saves @@ -1583,14 +1582,14 @@ describe('Locked Documents', () => { await user1FieldA.fill('Cycle 3 - User 1') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit and should see modal again user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Cycle 3 - User 2 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = user2Page.locator('.payload__modal-container') @@ -1599,7 +1598,7 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 4: User 2 now saves @@ -1607,14 +1606,14 @@ describe('Locked Documents', () => { await user2FieldA.fill('Cycle 4 - User 2') await saveDocAndAssert(user2Page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 tries to edit and should see modal again user1FieldA = page.locator('#field-fieldA') await user1FieldA.fill('Cycle 4 - User 1 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -1631,14 +1630,14 @@ describe('Locked Documents', () => { await user1FieldA.fill('Cycle 1 - User 1') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit and sees modal let user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Cycle 1 - User 2 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) let modalContainer = user2Page.locator('.payload__modal-container') @@ -1647,7 +1646,7 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 2: User 2 now saves @@ -1655,14 +1654,14 @@ describe('Locked Documents', () => { await user2FieldA.fill('Cycle 2 - User 2') await saveDocAndAssert(user2Page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 tries to edit and should see modal again user1FieldA = page.locator('#field-fieldA') await user1FieldA.fill('Cycle 2 - User 1 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -1671,7 +1670,7 @@ describe('Locked Documents', () => { // User 1 reloads await page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 3: User 1 now saves @@ -1679,14 +1678,14 @@ describe('Locked Documents', () => { await user1FieldA.fill('Cycle 3 - User 1') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit and should see modal again user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Cycle 3 - User 2 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = user2Page.locator('.payload__modal-container') @@ -1695,7 +1694,7 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 4: User 2 now saves @@ -1703,14 +1702,14 @@ describe('Locked Documents', () => { await user2FieldA.fill('Cycle 4 - User 2') await saveDocAndAssert(user2Page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 tries to edit and should see modal again user1FieldA = page.locator('#field-fieldA') await user1FieldA.fill('Cycle 4 - User 1 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -1725,13 +1724,13 @@ describe('Locked Documents', () => { await user1FieldA.fill('My First Change') await page.locator('#action-save-draft').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 edits again (their own save) await user1FieldA.fill('My Second Change') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Modal should NOT appear @@ -1741,13 +1740,13 @@ describe('Locked Documents', () => { // User 1 saves draft again await page.locator('#action-save-draft').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 edits a third time await user1FieldA.fill('My Third Change') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Modal should still NOT appear @@ -1781,17 +1780,17 @@ describe('Locked Documents', () => { // Make many rapid edits to create multiple queued autosaves for (let i = 1; i <= 10; i++) { await fieldA.fill(`Edit ${i}`) - // eslint-disable-next-line payload/no-wait-function + await wait(30) } // Wait for all autosaves to process - // eslint-disable-next-line payload/no-wait-function + await wait(2000) // Make one more edit to trigger stale data check await fieldA.fill('Final Edit') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Modal should NOT appear because it's the same user @@ -1802,7 +1801,7 @@ describe('Locked Documents', () => { // Clean up created autosave document for (const id of createdAutosaveIDs) { - await payload.delete({ collection: 'autosave', id }).catch(() => { + await payload.delete({ id, collection: 'autosave' }).catch(() => { // Ignore deletion errors (document might already be deleted) }) } @@ -1835,7 +1834,7 @@ describe('Locked Documents', () => { await page.route(editUrl, async (route) => { if (route.request().method() === 'POST' && !firstPostDelayed) { firstPostDelayed = true - // eslint-disable-next-line payload/no-wait-function + await wait(3000) } try { @@ -1858,7 +1857,7 @@ describe('Locked Documents', () => { await expect(page.locator('.payload-toast-container')).toContainText('successfully') await page.unroute(editUrl) - // eslint-disable-next-line payload/no-wait-function + await wait(4000) await expect(modalContainer).toBeHidden() @@ -1873,7 +1872,7 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Initial Global State') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Both users now open the same global @@ -1885,14 +1884,14 @@ describe('Locked Documents', () => { await user1GlobalText.fill('User 1 Global Change') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit (should trigger stale data check) const user2GlobalText = user2Page.locator('#field-globalText') await user2GlobalText.fill('User 2 Global Change') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Stale data modal should appear for user 2 @@ -1910,7 +1909,7 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Initial Global State') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Both users now open the same global @@ -1922,20 +1921,20 @@ describe('Locked Documents', () => { await user1GlobalText.fill('User 1 Updated Global Value') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit const user2GlobalText = user2Page.locator('#field-globalText') await user2GlobalText.fill('Should be discarded') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 clicks reload button in modal await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) const modalContainer = user2Page.locator('.payload__modal-container') @@ -1952,7 +1951,7 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Initial Global State') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Both users now open the same global @@ -1964,14 +1963,14 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Cycle 1 - User 1') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit and sees modal let user2GlobalText = user2Page.locator('#field-globalText') await user2GlobalText.fill('Cycle 1 - User 2 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) let modalContainer = user2Page.locator('.payload__modal-container') @@ -1980,7 +1979,7 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 2: User 2 now saves @@ -1988,14 +1987,14 @@ describe('Locked Documents', () => { await user2GlobalText.fill('Cycle 2 - User 2') await saveDocAndAssert(user2Page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 tries to edit and should see modal again user1GlobalText = page.locator('#field-globalText') await user1GlobalText.fill('Cycle 2 - User 1 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -2004,7 +2003,7 @@ describe('Locked Documents', () => { // User 1 reloads await page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 3: User 1 now saves @@ -2012,14 +2011,14 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Cycle 3 - User 1') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit and should see modal again user2GlobalText = user2Page.locator('#field-globalText') await user2GlobalText.fill('Cycle 3 - User 2 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = user2Page.locator('.payload__modal-container') @@ -2028,7 +2027,7 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 4: User 2 now saves @@ -2036,14 +2035,14 @@ describe('Locked Documents', () => { await user2GlobalText.fill('Cycle 4 - User 2') await saveDocAndAssert(user2Page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 tries to edit and should see modal again user1GlobalText = page.locator('#field-globalText') await user1GlobalText.fill('Cycle 4 - User 1 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -2057,7 +2056,7 @@ describe('Locked Documents', () => { await user1TextField.fill('Initial Published Version') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Both users now open the same global @@ -2070,20 +2069,20 @@ describe('Locked Documents', () => { const user2TextField = user2Page.locator('#field-text') await expect(user2TextField).toBeVisible() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 makes a change and saves as draft await user1TextField.fill('User 1 Draft Change') await page.locator('#action-save-draft').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit (should trigger stale data check) await user2TextField.fill('User 2 Draft Change') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Stale data modal should appear for user 2 @@ -2101,7 +2100,7 @@ describe('Locked Documents', () => { await user1TextField.fill('Initial Published Version') await saveDocAndAssert(page) - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Both users now open the same global @@ -2114,20 +2113,20 @@ describe('Locked Documents', () => { let user2TextField = user2Page.locator('#field-text') await expect(user2TextField).toBeVisible() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 1: User 1 saves draft await user1TextField.fill('Cycle 1 - User 1') await page.locator('#action-save-draft').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit and sees modal await user2TextField.fill('Cycle 1 - User 2 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) let modalContainer = user2Page.locator('.payload__modal-container') @@ -2136,7 +2135,7 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 2: User 2 now saves draft @@ -2144,14 +2143,14 @@ describe('Locked Documents', () => { await user2TextField.fill('Cycle 2 - User 2') await user2Page.locator('#action-save-draft').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 tries to edit and should see modal again user1TextField = page.locator('#field-text') await user1TextField.fill('Cycle 2 - User 1 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -2160,7 +2159,7 @@ describe('Locked Documents', () => { // User 1 reloads await page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 3: User 1 now saves draft @@ -2168,14 +2167,14 @@ describe('Locked Documents', () => { await user1TextField.fill('Cycle 3 - User 1') await page.locator('#action-save-draft').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 2 tries to edit and should see modal again user2TextField = user2Page.locator('#field-text') await user2TextField.fill('Cycle 3 - User 2 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = user2Page.locator('.payload__modal-container') @@ -2184,7 +2183,7 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Cycle 4: User 2 now saves draft @@ -2192,14 +2191,14 @@ describe('Locked Documents', () => { await user2TextField.fill('Cycle 4 - User 2') await user2Page.locator('#action-save-draft').click() - // eslint-disable-next-line payload/no-wait-function + await wait(500) // User 1 tries to edit and should see modal again user1TextField = page.locator('#field-text') await user1TextField.fill('Cycle 4 - User 1 attempt') - // eslint-disable-next-line payload/no-wait-function + await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -2220,17 +2219,17 @@ describe('Locked Documents', () => { // Make many rapid edits to create multiple queued autosaves for (let i = 1; i <= 10; i++) { await textField.fill(`Edit ${i}`) - // eslint-disable-next-line payload/no-wait-function + await wait(30) } // Wait for all autosaves to process - // eslint-disable-next-line payload/no-wait-function + await wait(2000) // Make one more edit to trigger stale data check await textField.fill('Final Edit') - // eslint-disable-next-line payload/no-wait-function + await wait(500) // Modal should NOT appear because stale check is disabled for autosave-enabled globals diff --git a/test/plugin-ecommerce/e2e.spec.ts b/test/plugin-ecommerce/e2e.spec.ts index 8ef047dcd1b..88c7d559a26 100644 --- a/test/plugin-ecommerce/e2e.spec.ts +++ b/test/plugin-ecommerce/e2e.spec.ts @@ -9,11 +9,11 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -45,18 +45,17 @@ test.describe('Ecommerce Plugin', () => { variantsUrl = new AdminUrlUtil(serverURL, 'variants') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) // Create a product with USD and EUR prices const productWithPrice = await payload.create({ collection: 'products', data: { - priceInUSDEnabled: true, - priceInUSD: 1999, - priceInEUREnabled: true, priceInEUR: 2599, + priceInEUREnabled: true, + priceInUSD: 1999, + priceInUSDEnabled: true, }, }) productWithPriceId = productWithPrice.id @@ -66,8 +65,8 @@ test.describe('Ecommerce Plugin', () => { const zeroPriceProduct = await payload.create({ collection: 'products', data: { - priceInUSDEnabled: true, priceInUSD: 0, + priceInUSDEnabled: true, }, }) zeroPriceProductId = zeroPriceProduct.id @@ -84,8 +83,8 @@ test.describe('Ecommerce Plugin', () => { // Find a seeded variant (created by seed with priceInUSD: 1999) const seededVariants = await payload.find({ collection: 'variants', - where: { priceInUSD: { equals: 1999 } }, limit: 1, + where: { priceInUSD: { equals: 1999 } }, }) if (seededVariants.docs.length > 0) { @@ -95,7 +94,7 @@ test.describe('Ecommerce Plugin', () => { test.afterAll(async () => { for (const id of createdProductIDs) { - await payload.delete({ collection: 'products', id }).catch(() => {}) + await payload.delete({ id, collection: 'products' }).catch(() => {}) } }) @@ -171,8 +170,8 @@ test.describe('Ecommerce Plugin', () => { const editableProduct = await payload.create({ collection: 'products', data: { - priceInUSDEnabled: true, priceInUSD: 999, + priceInUSDEnabled: true, }, }) createdProductIDs.push(editableProduct.id) diff --git a/test/plugin-form-builder/e2e.spec.ts b/test/plugin-form-builder/e2e.spec.ts index 5a47d827aae..7113461e756 100644 --- a/test/plugin-form-builder/e2e.spec.ts +++ b/test/plugin-form-builder/e2e.spec.ts @@ -10,12 +10,12 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { selectInput } from '../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { documentsSlug, formsSlug, formSubmissionsSlug, mediaSlug } from './shared.js' @@ -46,8 +46,7 @@ test.describe('Form Builder Plugin', () => { payload = payloadFromInit const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) @@ -160,9 +159,9 @@ test.describe('Form Builder Plugin', () => { const formSelect = page.locator('#field-form') await selectInput({ - page, multiSelect: false, option: 'Contact Form', + page, selectLocator: formSelect, selectType: 'relationship', }) diff --git a/test/plugin-import-export/e2e.spec.ts b/test/plugin-import-export/e2e.spec.ts index e99065a280b..319d15bf6cf 100644 --- a/test/plugin-import-export/e2e.spec.ts +++ b/test/plugin-import-export/e2e.spec.ts @@ -14,7 +14,6 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, runJobsQueue, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' @@ -22,6 +21,7 @@ import { getSelectMenu } from '../__helpers/e2e/selectInput.js' import { setPerPageLimit } from '../__helpers/e2e/setPerPageLimit.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { readCSV } from './helpers.js' import { @@ -59,8 +59,7 @@ test.describe('Import Export Plugin', () => { payload = payloadFromInit const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/plugin-mcp/e2e.spec.ts b/test/plugin-mcp/e2e.spec.ts index 12e673a7a70..af763119d40 100644 --- a/test/plugin-mcp/e2e.spec.ts +++ b/test/plugin-mcp/e2e.spec.ts @@ -5,8 +5,9 @@ import { randomUUID } from 'crypto' import path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -25,8 +26,7 @@ test.describe('MCP Plugin', () => { serverURL = serverFromInit const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) diff --git a/test/plugin-multi-tenant/e2e.spec.ts b/test/plugin-multi-tenant/e2e.spec.ts index 2a5d7052cc7..894908cb668 100644 --- a/test/plugin-multi-tenant/e2e.spec.ts +++ b/test/plugin-multi-tenant/e2e.spec.ts @@ -14,7 +14,6 @@ import { goToListDoc } from '../__helpers/e2e/goToListDoc.js' import { changeLocale, ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, waitForFormReady, } from '../__helpers/e2e/helpers.js' @@ -29,6 +28,7 @@ import { closeNav, openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { credentials } from './credentials.js' import { @@ -73,8 +73,7 @@ test.describe('Multi Tenant', () => { autosaveGlobalURL = new AdminUrlUtil(serverURL, autosaveGlobalSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) }) @@ -369,9 +368,9 @@ test.describe('Multi Tenant', () => { await closeNav(page) await openAssignTenantModal({ page, payload }) await selectInput({ - page, multiSelect: false, option: 'Steel Cat', + page, selectLocator: page.locator('.tenantField'), }) @@ -433,9 +432,9 @@ test.describe('Multi Tenant', () => { await closeNav(page) await openAssignTenantModal({ page, payload }) await selectInput({ - page, multiSelect: false, option: 'Steel Cat', + page, selectLocator: page.locator('.tenantField'), }) @@ -570,9 +569,9 @@ test.describe('Multi Tenant', () => { await expect(editManyDrawer).toBeVisible() await selectInput({ - page, multiSelect: true, options: ['Site'], + page, selectLocator: editManyDrawer.locator('.edit-many-bulk-uploads__form .react-select'), }) @@ -583,9 +582,9 @@ test.describe('Multi Tenant', () => { await expect(inlineTenantField).toBeVisible() await selectInput({ - page, multiSelect: false, option: 'Blue Dog', + page, selectLocator: inlineTenantField, selectType: 'relationship', }) @@ -733,8 +732,8 @@ test.describe('Multi Tenant', () => { // Check if this is a render-list action if (Array.isArray(parsedPayload) && parsedPayload[0]?.name === 'render-list') { renderListRequests.push({ - url: request.url(), payload: parsedPayload, + url: request.url(), }) } } catch (e) { @@ -757,8 +756,8 @@ test.describe('Multi Tenant', () => { }) await openRelationshipFieldDrawer({ - page, fieldName: 'polymorphicRelationship', + page, selectRelation: 'Relationship', // select a tenant-enabled collection }) @@ -1201,7 +1200,7 @@ test.describe('Multi Tenant', () => { await checkbox.click() // Open the move drawer - const moveButton = page.getByRole('button', { exact: true, name: 'Move' }) + const moveButton = page.getByRole('button', { name: 'Move', exact: true }) await expect(moveButton).toBeVisible() await moveButton.click() @@ -1444,9 +1443,9 @@ async function selectDocumentTenant({ await closeNav(page) await openAssignTenantModal({ page, payload }) await selectInput({ - page, multiSelect: false, option: tenant, + page, selectLocator: page.locator('.tenantField'), }) @@ -1499,9 +1498,9 @@ async function setTenantFilter({ await openNav(page) await selectInput({ - page, multiSelect: false, option: tenant, + page, selectLocator: page.locator('.tenant-selector'), }) } @@ -1515,9 +1514,9 @@ async function switchGlobalDocTenant({ }): Promise { await openNav(page) await selectInput({ - page, multiSelect: false, option: tenant, + page, selectLocator: page.locator('.tenant-selector'), }) } diff --git a/test/plugin-nested-docs/e2e.spec.ts b/test/plugin-nested-docs/e2e.spec.ts index b200f89ca43..593b04bb86c 100644 --- a/test/plugin-nested-docs/e2e.spec.ts +++ b/test/plugin-nested-docs/e2e.spec.ts @@ -6,9 +6,10 @@ import { fileURLToPath } from 'url' import type { Config, Page as PayloadPage } from './payload-types.js' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -25,27 +26,26 @@ let childID: string describe('Nested Docs Plugin', () => { beforeAll(async ({ browser }, testInfo) => { testInfo.setTimeout(TEST_TIMEOUT_LONG) - const { serverURL, payload } = await initPayloadE2ENoConfig({ dirname }) + const { payload, serverURL } = await initPayloadE2ENoConfig({ dirname }) url = new AdminUrlUtil(serverURL, 'pages') const context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) async function createPage({ slug, - title = 'Title page', - parent, _status = 'published', + parent, + title = 'Title page', }: Partial): Promise { return payload.create({ collection: 'pages', data: { - title, slug, _status, parent, + title, }, }) as unknown as Promise } @@ -55,8 +55,8 @@ describe('Nested Docs Plugin', () => { const childPage = await createPage({ slug: 'child-slug', - title: 'Child page', parent: parentID, + title: 'Child page', }) childID = childPage.id @@ -65,9 +65,9 @@ describe('Nested Docs Plugin', () => { const draftChildPage = await createPage({ slug: 'child-slug-draft', - title: 'Child page', - parent: draftParentID, _status: 'draft', + parent: draftParentID, + title: 'Child page', }) draftChildID = draftChildPage.id }) diff --git a/test/plugin-redirects/e2e.spec.ts b/test/plugin-redirects/e2e.spec.ts index d04a18ef959..82726dfe752 100644 --- a/test/plugin-redirects/e2e.spec.ts +++ b/test/plugin-redirects/e2e.spec.ts @@ -9,11 +9,11 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -36,8 +36,7 @@ test.describe('Redirects Plugin', () => { payload = payloadFromInit const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/plugin-seo/e2e.spec.ts b/test/plugin-seo/e2e.spec.ts index d0da5c27a6f..50d767ceb7c 100644 --- a/test/plugin-seo/e2e.spec.ts +++ b/test/plugin-seo/e2e.spec.ts @@ -11,20 +11,20 @@ import type { Config, Page as PayloadPage } from './payload-types.js' import { checkFocusIndicators } from '../__helpers/e2e/checkFocusIndicators.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, switchTab, waitForFormReady, } from '../__helpers/e2e/helpers.js' import { runAxeScan } from '../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { mediaSlug } from './shared.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) -const { beforeAll, describe, beforeEach } = test +const { beforeAll, beforeEach, describe } = test let url: AdminUrlUtil let page: Page @@ -41,8 +41,7 @@ describe('SEO Plugin', () => { url = new AdminUrlUtil(serverURL, 'pages') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) const filePath = path.resolve(dirname, './image-1.jpg') diff --git a/test/query-presets/e2e.spec.ts b/test/query-presets/e2e.spec.ts index 65bd6ab97d7..5f33fd16fef 100644 --- a/test/query-presets/e2e.spec.ts +++ b/test/query-presets/e2e.spec.ts @@ -12,7 +12,6 @@ import { addGroupBy, clearGroupBy } from '../__helpers/e2e/groupBy/index.js' import { ensureCompilationIsDone, exactText, - initPageConsoleErrorCatch, saveDocAndAssert, } from '../__helpers/e2e/helpers.js' import { navigateToListView } from '../__helpers/e2e/navigateToListView.js' @@ -20,6 +19,7 @@ import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { assertURLParams } from './helpers/assertURLParams.js' import { openQueryPresetDrawer } from './helpers/openQueryPresetDrawer.js' @@ -62,7 +62,7 @@ describe('Query Presets', () => { }) beforeEach(async ({ page }) => { - initPageConsoleErrorCatch(page) + await initPage({ page }) await reInitializeDB({ serverURL, @@ -259,9 +259,9 @@ describe('Query Presets', () => { page, }) => { await navigateToListView({ page, url: pagesUrl.list }) - await checkPresetMenuOptions({ page, expectEdit: false, expectDelete: false }) + await checkPresetMenuOptions({ expectDelete: false, expectEdit: false, page }) await selectPreset({ page, presetTitle: seededData.everyone.title }) - await checkPresetMenuOptions({ page, expectEdit: true, expectDelete: true }) + await checkPresetMenuOptions({ expectDelete: true, expectEdit: true, page }) }) // eslint-disable-next-line playwright/expect-expect -- assertions are in checkPresetModifiedOptions helper @@ -271,17 +271,17 @@ describe('Query Presets', () => { await navigateToListView({ page, url: pagesUrl.list }) // Before selecting a preset, reset/save should not be visible in popup - await checkPresetModifiedOptions({ page, expectReset: false, expectSave: false }) + await checkPresetModifiedOptions({ expectReset: false, expectSave: false, page }) await selectPreset({ page, presetTitle: seededData.onlyMe.title }) // After selecting preset but before changes, should still not show reset/save - await checkPresetModifiedOptions({ page, expectReset: false, expectSave: false }) + await checkPresetModifiedOptions({ expectReset: false, expectSave: false, page }) await toggleColumn(page, { columnLabel: 'ID' }) // After making changes, reset/save should be visible - await checkPresetModifiedOptions({ page, expectReset: true, expectSave: true }) + await checkPresetModifiedOptions({ expectReset: true, expectSave: true, page }) }) test('should conditionally render "update for everyone" label based on if preset is shared', async ({ @@ -343,7 +343,7 @@ describe('Query Presets', () => { await expect(page.locator('.icon--filter__badge')).toBeHidden() // Verify the reset/save options are hidden (no longer modified) - await checkPresetModifiedOptions({ page, expectReset: false, expectSave: false }) + await checkPresetModifiedOptions({ expectReset: false, expectSave: false, page }) }) test('should only enter modified state when changes are made to an active preset', async ({ @@ -760,13 +760,13 @@ describe('Query Presets', () => { await expect(page.locator('#select-preset')).toContainText(seededData.onlyMe.title) // 3. Save button should NOT show in popup (no modifications yet) - await checkPresetModifiedOptions({ page, expectReset: false, expectSave: false }) + await checkPresetModifiedOptions({ expectReset: false, expectSave: false, page }) // 4. Make a change await toggleColumn(page, { columnLabel: 'ID' }) // 5. Save button should show in popup - await checkPresetModifiedOptions({ page, expectReset: true, expectSave: true }) + await checkPresetModifiedOptions({ expectReset: true, expectSave: true, page }) }) test('should reset groupBy when clicking reset button on modified preset', async ({ page }) => { @@ -790,7 +790,7 @@ describe('Query Presets', () => { await expect(page.locator('.table-section__header').first()).toBeVisible() // Verify reset/save buttons are not visible initially (no modifications) - await checkPresetModifiedOptions({ page, expectReset: false, expectSave: false }) + await checkPresetModifiedOptions({ expectReset: false, expectSave: false, page }) // Clear the groupBy (modify the preset) await clearGroupBy(page) @@ -798,7 +798,7 @@ describe('Query Presets', () => { await expect(page.locator('.table-section__header')).toHaveCount(0) // Verify reset button becomes visible after modification - await checkPresetModifiedOptions({ page, expectReset: true, expectSave: true }) + await checkPresetModifiedOptions({ expectReset: true, expectSave: true, page }) // Reset the preset changes await resetPresetChanges({ page }) @@ -808,7 +808,7 @@ describe('Query Presets', () => { await expect(page.locator('.table-section__header').first()).toBeVisible() // Verify reset button is hidden again after reset - await checkPresetModifiedOptions({ page, expectReset: false, expectSave: false }) + await checkPresetModifiedOptions({ expectReset: false, expectSave: false, page }) }) test('should apply preset from URL query param', async ({ page }) => { @@ -817,10 +817,10 @@ describe('Query Presets', () => { // Verify the where query is in the URL await assertURLParams({ - page, columns: seededData.everyone.columns, - where: seededData.everyone.where, + page, preset: seededData.everyone.id, + where: seededData.everyone.where, }) // Verify the preset is selected in the preset selector diff --git a/test/queues/e2e.spec.ts b/test/queues/e2e.spec.ts index 6fdd7200c6c..5f392852f7d 100644 --- a/test/queues/e2e.spec.ts +++ b/test/queues/e2e.spec.ts @@ -8,8 +8,9 @@ import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' import { login } from '../__helpers/e2e/auth/login.js' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -29,8 +30,7 @@ describe('Queues', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) // This suite logs in explicitly (no auto-login), so `/admin` redirects to // `/admin/login`. Pass `noAutoLogin` so the compilation poll waits for the // login URL instead of the dashboard URL that never loads — otherwise it diff --git a/test/server-functions/e2e.spec.ts b/test/server-functions/e2e.spec.ts index dfd0834bd5b..a9b9cecca42 100644 --- a/test/server-functions/e2e.spec.ts +++ b/test/server-functions/e2e.spec.ts @@ -1,7 +1,6 @@ import type { Page } from '@playwright/test' import { expect, test } from '@playwright/test' -import { devUser } from '../credentials.js' import path from 'path' import { formatAdminURL } from 'payload/shared' import { fileURLToPath } from 'url' @@ -12,10 +11,11 @@ import type { Config } from './payload-types.js' import { ensureCompilationIsDone, getRoutes, - initPageConsoleErrorCatch, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' +import { devUser } from '../credentials.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -42,13 +42,12 @@ describe('Server Functions', () => { adminRoute = adminRouteFromConfig const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ + noAutoLogin: true, page, serverURL, - noAutoLogin: true, }) }) diff --git a/test/server-url/e2e.spec.ts b/test/server-url/e2e.spec.ts index acd52475268..73c5180250d 100644 --- a/test/server-url/e2e.spec.ts +++ b/test/server-url/e2e.spec.ts @@ -6,9 +6,10 @@ import { fileURLToPath } from 'url' import { login } from '../__helpers/e2e/auth/login.js' import { logoutViaNav } from '../__helpers/e2e/auth/logout.js' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) @@ -25,8 +26,7 @@ test.describe('serverURL', () => { url = new AdminUrlUtil(serverURL, 'posts') const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) }) diff --git a/test/sort/e2e.spec.ts b/test/sort/e2e.spec.ts index 8b49eb62108..84eb2826e24 100644 --- a/test/sort/e2e.spec.ts +++ b/test/sort/e2e.spec.ts @@ -10,7 +10,6 @@ import type { Config } from './payload-types.js' import { goToListDoc } from '../__helpers/e2e/goToListDoc.js' import { ensureCompilationIsDone, - initPageConsoleErrorCatch, // throttleTest } from '../__helpers/e2e/helpers.js' import { scrollEntirePage } from '../__helpers/e2e/scrollEntirePage.js' @@ -18,6 +17,7 @@ import { moveRow } from '../__helpers/e2e/sort/moveRow.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { orderableSlug } from './collections/Orderable/index.js' import { orderableJoinSlug } from './collections/OrderableJoin/index.js' @@ -39,9 +39,8 @@ describe('Sort functionality', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) - initPageConsoleErrorCatch(page) // Wait for the server to be ready before the node-side REST login: on the // slower TanStack prod cold-start, `client.login()` (a direct fetch, no retry) @@ -123,9 +122,9 @@ describe('Sort functionality', () => { // Expect a warning because not sorted by order first await moveRow(page, { + expected: 'warning', fromIndex: 0, toIndex: 2, - expected: 'warning', }) }) @@ -137,8 +136,8 @@ describe('Sort functionality', () => { // the soft navigation's URL only updates after the RSC payload arrives, which // can stall past the test timeout on a cold CI server. await goToListDoc({ - page, cellClass: '.cell-title', + page, textToMatch: 'Join A', urlUtil: url, }) @@ -154,8 +153,8 @@ describe('Sort functionality', () => { // Move to middle await moveRow(page, { fromIndex: 1, - toIndex: 2, scope: page.locator('#field-orderableJoinField1'), + toIndex: 2, }) await assertRows(['A', 'C', 'B', 'D'], { @@ -169,8 +168,8 @@ describe('Sort functionality', () => { // Move to end await moveRow(page, { fromIndex: 0, - toIndex: 3, scope: page.locator('#field-orderableJoinField2'), + toIndex: 3, }) await assertRows(['B', 'C', 'D', 'A'], { diff --git a/test/tags/e2e.spec.ts b/test/tags/e2e.spec.ts index 35839cab9a7..94451bacdea 100644 --- a/test/tags/e2e.spec.ts +++ b/test/tags/e2e.spec.ts @@ -7,10 +7,11 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config, Tag } from './payload-types.js' -import { ensureCompilationIsDone, initPageConsoleErrorCatch } from '../__helpers/e2e/helpers.js' +import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { tagsSlug } from './config.js' @@ -111,8 +112,7 @@ test.describe('Tags', () => { tagsURL = new AdminUrlUtil(serverURL, tagsSlug) const context = await browser.newContext() - page = await context.newPage() - initPageConsoleErrorCatch(page) + ;({ page } = await initPage({ context })) await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/trash/e2e.spec.ts b/test/trash/e2e.spec.ts index 7bd0ce4301e..972bb61fd74 100644 --- a/test/trash/e2e.spec.ts +++ b/test/trash/e2e.spec.ts @@ -12,11 +12,11 @@ import { changeLocale, closeAllToasts, ensureCompilationIsDone, - initPageConsoleErrorCatch, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { pagesSlug } from './collections/Pages/index.js' import { postsSlug } from './collections/Posts/index.js' @@ -49,7 +49,7 @@ describe('Trash', () => { await ensureCompilationIsDone({ browser, serverURL }) }) - beforeEach(async ({ page, context }) => { + beforeEach(async ({ context, page }) => { await reInitializeDB({ serverURL, snapshotKey: 'trash', @@ -57,16 +57,16 @@ describe('Trash', () => { pagesDocOneID = ( await payload.find({ collection: 'pages', - limit: 1, depth: 0, + limit: 1, pagination: false, }) ).docs[0]!.id postsDocOneID = ( await payload.find({ collection: 'posts', - limit: 1, depth: 0, + limit: 1, pagination: false, where: { title: { @@ -78,8 +78,8 @@ describe('Trash', () => { postsDocTwoID = ( await payload.find({ collection: 'posts', - limit: 1, depth: 0, + limit: 1, pagination: false, where: { title: { @@ -88,7 +88,7 @@ describe('Trash', () => { }, }) ).docs[0]!.id - initPageConsoleErrorCatch(page) + await initPage({ page }) //await throttleTest({ page, context, delay: 'Slow 4G' }) await ensureCompilationIsDone({ page, serverURL }) @@ -311,8 +311,8 @@ describe('Trash', () => { await expect(page.locator('.list-selection__button[aria-label="Delete"]')).toBeVisible() await payload.delete({ - collection: postsSlug, id: trashedDoc.id, + collection: postsSlug, trash: true, }) }) @@ -576,9 +576,9 @@ describe('Trash', () => { await page.goto(postsUrl.trash) await addListFilter({ - page, fieldLabel: 'Title', operatorLabel: 'is like', + page, value: 'Test', }) @@ -588,8 +588,8 @@ describe('Trash', () => { // Cleanup: permanently delete the created docs await mapAsync(createdDocs, async (doc) => { await payload.delete({ - collection: postsSlug, id: doc.id, + collection: postsSlug, trash: true, // Force permanent delete }) }) @@ -769,8 +769,8 @@ describe('Trash', () => { page, }) => { const incomingTrashedDoc = await createPostDoc({ - title: 'Post 1', _status: 'published', + title: 'Post 1', }) await page.goto(postsUrl.list) @@ -811,8 +811,8 @@ describe('Trash', () => { ) await payload.delete({ - collection: postsSlug, id: incomingTrashedDoc.id, + collection: postsSlug, trash: true, }) }) @@ -821,8 +821,8 @@ describe('Trash', () => { page, }) => { const incomingTrashedDoc = await createPostDoc({ - title: 'Post 1', _status: 'published', + title: 'Post 1', }) await page.goto(postsUrl.list) @@ -868,8 +868,8 @@ describe('Trash', () => { ) await payload.delete({ - collection: postsSlug, id: incomingTrashedDoc.id, + collection: postsSlug, trash: true, }) }) @@ -878,8 +878,8 @@ describe('Trash', () => { page, }) => { const incomingTrashedDoc = await createPostDoc({ - title: 'Post 1', _status: 'published', + title: 'Post 1', }) await page.goto(postsUrl.list) @@ -927,16 +927,16 @@ describe('Trash', () => { .toMatch(/\w+ \d{1,2}(st|nd|rd|th) \d{4}, \d{1,2}:\d{2} [AP]M/) await payload.delete({ - collection: postsSlug, id: incomingTrashedDoc.id, + collection: postsSlug, trash: true, }) }) test('Should allow viewing of the API tab view from trash edit view', async ({ page }) => { const incomingTrashedDoc = await createPostDoc({ - title: 'Post 1', _status: 'published', + title: 'Post 1', }) await page.goto(postsUrl.list) @@ -976,8 +976,8 @@ describe('Trash', () => { ) await payload.delete({ - collection: postsSlug, id: incomingTrashedDoc.id, + collection: postsSlug, trash: true, }) }) @@ -986,8 +986,8 @@ describe('Trash', () => { page, }) => { const incomingTrashedDoc = await createPostDoc({ - title: 'Post 1', _status: 'published', + title: 'Post 1', }) await page.goto(postsUrl.list) @@ -1032,8 +1032,8 @@ describe('Trash', () => { ) await payload.delete({ - collection: postsSlug, id: incomingTrashedDoc.id, + collection: postsSlug, trash: true, }) }) @@ -1044,11 +1044,11 @@ describe('Trash', () => { // Ensure Dev user exists and store its ID const { docs } = await payload.find({ collection: usersSlug, - limit: 1, - where: { name: { equals: 'Dev' } }, - trash: true, depth: 0, + limit: 1, pagination: false, + trash: true, + where: { name: { equals: 'Dev' } }, }) if (docs.length === 0) { throw new Error('Dev user not found! Ensure test seed data includes a Dev user.') @@ -1059,18 +1059,18 @@ describe('Trash', () => { async function ensureDevUserTrashed() { const { docs } = await payload.find({ collection: usersSlug, + limit: 1, + trash: true, where: { and: [{ name: { equals: 'Dev' } }, { deletedAt: { exists: true } }], }, - limit: 1, - trash: true, }) if (docs.length === 0) { // Trash the user if it's not already trashed await payload.update({ - collection: usersSlug, id: devUserID, + collection: usersSlug, data: { deletedAt: new Date().toISOString() }, }) } @@ -1183,31 +1183,31 @@ describe('Trash', () => { const draftPost = await payload.create({ collection: postsSlug, data: { - title: 'Draft with Localized Field', _status: 'draft', + title: 'Draft with Localized Field', }, }) await payload.update({ - collection: postsSlug, id: draftPost.id, - locale: 'en', + collection: postsSlug, data: { - localizedField: localizedFieldValueEN, _status: 'draft', + localizedField: localizedFieldValueEN, }, draft: true, + locale: 'en', }) await payload.update({ - collection: postsSlug, id: draftPost.id, - locale: 'es', + collection: postsSlug, data: { - localizedField: localizedFieldValueES, _status: 'draft', + localizedField: localizedFieldValueES, }, draft: true, + locale: 'es', }) await page.goto(postsUrl.edit(draftPost.id)) @@ -1246,34 +1246,34 @@ describe('Trash', () => { const draftPost = await payload.create({ collection: postsSlug, data: { - title: 'Draft with Localized Field', _status: 'draft', + title: 'Draft with Localized Field', }, }) // Update en locale as draft - isSavingDraft = true skips updateOne on the main table, // storing localized data only in the versions table await payload.update({ - collection: postsSlug, id: draftPost.id, - locale: 'en', + collection: postsSlug, data: { - localizedField: localizedFieldValueEN, _status: 'draft', + localizedField: localizedFieldValueEN, }, draft: true, + locale: 'en', }) // Update es locale as draft await payload.update({ - collection: postsSlug, id: draftPost.id, - locale: 'es', + collection: postsSlug, data: { - localizedField: localizedFieldValueES, _status: 'draft', + localizedField: localizedFieldValueES, }, draft: true, + locale: 'es', }) await page.goto(postsUrl.list) diff --git a/test/uploads/e2e.spec.ts b/test/uploads/e2e.spec.ts index 692c1245ad0..951e6455714 100644 --- a/test/uploads/e2e.spec.ts +++ b/test/uploads/e2e.spec.ts @@ -21,7 +21,6 @@ import { ensureCompilationIsDone, exactText, gotoAndWaitForForm, - initPageConsoleErrorCatch, saveDocAndAssert, waitForFormReady, } from '../__helpers/e2e/helpers.js' @@ -33,6 +32,7 @@ import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB. import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' import { startTestFileServer } from '../__helpers/shared/startTestFileServer.js' +import { initPage } from '../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { adminThumbnailFunctionSlug, @@ -183,15 +183,12 @@ describe('Uploads', () => { const context = await browser.newContext() await context.grantPermissions(['clipboard-read', 'clipboard-write']) - page = await context.newPage() + const initialized = await initPage({ context, ignoreCORS: true }) - const { collectErrors, consoleErrors, stopCollectingErrors } = initPageConsoleErrorCatch(page, { - ignoreCORS: true, - }) - - consoleErrorsFromPage = consoleErrors - collectErrorsFromPage = collectErrors - stopCollectingErrorsFromPage = stopCollectingErrors + page = initialized.page + consoleErrorsFromPage = initialized.consoleErrors + collectErrorsFromPage = initialized.collectErrors + stopCollectingErrorsFromPage = initialized.stopCollectingErrors await ensureCompilationIsDone({ page, serverURL }) }) diff --git a/test/versions/e2e.spec.ts b/test/versions/e2e.spec.ts index d1f14b29e25..679fa9c571e 100644 --- a/test/versions/e2e.spec.ts +++ b/test/versions/e2e.spec.ts @@ -41,7 +41,6 @@ import { ensureCompilationIsDone, exactText, getRoutes, - initPageConsoleErrorCatch, openDocDrawer, saveDocAndAssert, waitForFormReady, @@ -55,6 +54,7 @@ import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSav import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { initPage } from '../__setup/initPage.js' import { postsCollectionSlug } from '../admin/slugs.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { draftWithCustomUnpublishSlug } from './collections/DraftsWithCustomUnpublish.js' @@ -120,14 +120,13 @@ describe('Versions', () => { 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 initPayloadE2ENoConfig({ dirname })) context = await browser.newContext() - page = await context.newPage() + ;({ page } = await initPage({ context })) const { routes: { admin: adminRouteFromConfig }, } = getRoutes({}) adminRoute = adminRouteFromConfig - initPageConsoleErrorCatch(page) await ensureCompilationIsDone({ page, serverURL }) }) @@ -166,8 +165,8 @@ describe('Versions', () => { collection: draftCollectionSlug, data: { _status: 'published', - title: 'Published Document', description: 'This is published', + title: 'Published Document', }, }) @@ -245,7 +244,7 @@ describe('Versions', () => { await page.goto(`${serverURL}${docHref}/versions`) await expect(() => { expect(page.url()).toMatch(/\/versions/) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) test('autosave relationships - should select doc after creating from relationship field', async () => { @@ -341,8 +340,8 @@ describe('Versions', () => { collection: draftCollectionSlug, data: { _status: 'published', - title: 'title', description: 'description', + title: 'title', }, overrideAccess: true, }) @@ -356,16 +355,16 @@ describe('Versions', () => { collection: draftCollectionSlug, data: { _status: 'published', - title: 'title', description: 'description', + title: 'title', }, overrideAccess: true, }) // Unpublish the document await payload.update({ - collection: draftCollectionSlug, id: publishedDoc.id, + collection: draftCollectionSlug, data: { _status: 'draft', }, @@ -445,7 +444,7 @@ describe('Versions', () => { await page.goto(versionsURL) await expect(() => { expect(page.url()).toMatch(/\/versions/) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) test('collection - should autosave', async () => { @@ -457,8 +456,8 @@ describe('Versions', () => { const { id: postID } = await payload.create({ collection: postCollectionSlug, data: { - title: 'post title', description: 'post description', + title: 'post title', }, }) @@ -510,17 +509,17 @@ describe('Versions', () => { const { id: postID } = await payload.create({ collection: postCollectionSlug, data: { - title: 'post title', description: 'post description', + title: 'post title', }, }) const { id: docID } = await payload.create({ collection: autosaveCollectionSlug, data: { - title: 'autosave title', description: 'autosave description', relationship: postID, + title: 'autosave title', }, }) @@ -581,7 +580,7 @@ describe('Versions', () => { await expect(() => { expect(updatedDocsCount).toBe(initialDocsCount + 1) - }).toPass({ timeout: POLL_TOPASS_TIMEOUT, intervals: [100] }) + }).toPass({ intervals: [100], timeout: POLL_TOPASS_TIMEOUT }) await page.goto(autosaveURL.list) const createNewButton = page.locator('#create-new-doc') @@ -599,7 +598,7 @@ describe('Versions', () => { await expect(() => { expect(latestDocsCount).toBe(updatedDocsCount + 1) - }).toPass({ timeout: POLL_TOPASS_TIMEOUT, intervals: [100] }) + }).toPass({ intervals: [100], timeout: POLL_TOPASS_TIMEOUT }) }) test('collection - should update updatedAt', async () => { @@ -848,8 +847,8 @@ describe('Versions', () => { await expect(page.getByRole('button', { name: 'Custom Unpublish' })).toBeVisible() await payload.delete({ - collection: draftWithCustomUnpublishSlug, id: publishedDoc.id, + collection: draftWithCustomUnpublishSlug, }) }) @@ -857,8 +856,8 @@ describe('Versions', () => { const doc = await payload.create({ collection: versionCollectionSlug, data: { - title: 'No Drafts Doc', description: 'This collection has drafts disabled', + title: 'No Drafts Doc', }, }) @@ -868,8 +867,8 @@ describe('Versions', () => { await expect(page.locator('#action-unpublish')).not.toBeAttached() await payload.delete({ - collection: versionCollectionSlug, id: doc.id, + collection: versionCollectionSlug, }) }) @@ -878,8 +877,8 @@ describe('Versions', () => { collection: draftCollectionSlug, data: { _status: 'published', - title: 'unpublish version count test', description: 'description', + title: 'unpublish version count test', }, }) @@ -897,8 +896,8 @@ describe('Versions', () => { await expect.poll(() => page.locator(versionsCountSelector).textContent()).toBe(countBefore) await payload.delete({ - collection: draftCollectionSlug, id: publishedDoc.id, + collection: draftCollectionSlug, }) }) @@ -952,7 +951,7 @@ describe('Versions', () => { await expect(async () => { newCount1 = await page.locator(versionsCountSelector).textContent() expect(Number(newCount1)).toBeGreaterThan(Number(initialCount)) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) await field.fill('new description 2') await saveDocAndAssert(page, '#action-save-draft') @@ -962,7 +961,7 @@ describe('Versions', () => { await expect(async () => { newCount2 = await page.locator(versionsCountSelector).textContent() expect(Number(newCount2)).toBeGreaterThan(Number(newCount1)) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) await field.fill('new description 3') await saveDocAndAssert(page, '#action-save-draft') @@ -970,7 +969,7 @@ describe('Versions', () => { await expect(async () => { const newCount3 = await page.locator(versionsCountSelector).textContent() expect(Number(newCount3)).toBeGreaterThan(Number(newCount2)) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) test('collection — respects max number of versions', async () => { @@ -1021,12 +1020,12 @@ describe('Versions', () => { await page.goto(`${serverURL}${docHref}/versions`) await expect(() => { expect(page.url()).toMatch(/\/versions/) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) const scanResults = await runAxeScan({ + include: ['.versions'], page, testInfo, - include: ['.versions'], }) expect(scanResults.violations.length).toBe(0) @@ -1039,12 +1038,12 @@ describe('Versions', () => { await page.goto(`${serverURL}${docHref}/versions`) await expect(() => { expect(page.url()).toMatch(/\/versions/) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.versions', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) @@ -1058,7 +1057,7 @@ describe('Versions', () => { await page.goto(`${serverURL}${docHref}/versions`) await expect(() => { expect(page.url()).toMatch(/\/versions/) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) const versionLink = page.locator('.cell-updatedAt a').first() const versionHref = await versionLink.getAttribute('href') @@ -1067,9 +1066,9 @@ describe('Versions', () => { await page.locator('.view-version').waitFor() const scanResults = await runAxeScan({ + include: ['.view-version'], page, testInfo, - include: ['.view-version'], }) expect(scanResults.violations.length).toBe(0) @@ -1082,12 +1081,12 @@ describe('Versions', () => { await page.goto(`${serverURL}${docHref}/versions`) await expect(() => { expect(page.url()).toMatch(/\/versions/) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) const scanResults = await checkFocusIndicators({ page, - testInfo, selector: '.versions', + testInfo, }) expect(scanResults.totalFocusableElements).toBeGreaterThan(0) @@ -1341,7 +1340,7 @@ describe('Versions', () => { await page.goto(versionsURL) await expect(() => { expect(page.url()).toMatch(/\/versions/) - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) }) test('global - should show "save as draft" button when showSaveDraftButton is true', async () => { @@ -1392,7 +1391,7 @@ describe('Versions', () => { test('globals — should show unpublish button after publishing', async () => { await payload.updateGlobal({ slug: simpleDraftGlobalSlug, - data: { title: 'published global', _status: 'published' }, + data: { _status: 'published', title: 'published global' }, }) const globalURL = new AdminUrlUtil(serverURL, simpleDraftGlobalSlug) @@ -1405,7 +1404,7 @@ describe('Versions', () => { test('globals — dot menu should only contain unpublish and copy to locale options', async () => { await payload.updateGlobal({ slug: simpleDraftGlobalSlug, - data: { title: 'published global', _status: 'published' }, + data: { _status: 'published', title: 'published global' }, }) const globalURL = new AdminUrlUtil(serverURL, simpleDraftGlobalSlug) @@ -1423,7 +1422,7 @@ describe('Versions', () => { test('globals — should not increment version count when unpublishing', async () => { await payload.updateGlobal({ slug: simpleDraftGlobalSlug, - data: { title: 'unpublish version count test', _status: 'published' }, + data: { _status: 'published', title: 'unpublish version count test' }, }) const globalURL = new AdminUrlUtil(serverURL, simpleDraftGlobalSlug) @@ -1628,8 +1627,8 @@ describe('Versions', () => { const post = await payload.create({ collection: draftCollectionSlug, data: { - title: 'new post', description: 'new description', + title: 'new post', }, }) @@ -1665,7 +1664,7 @@ describe('Versions', () => { await expect(() => { expect(createdDate).toContain('6:00:00 PM') - }).toPass({ timeout: 10000, intervals: [100] }) + }).toPass({ intervals: [100], timeout: 10000 }) const { docs: [createdJob], @@ -1678,10 +1677,10 @@ describe('Versions', () => { }, }) - // eslint-disable-next-line payload/no-flaky-assertions + expect(createdJob).toBeTruthy() - // eslint-disable-next-line payload/no-flaky-assertions + expect(createdJob?.waitUntil).toEqual('2049-01-01T17:00:00.000Z') }) }) @@ -1776,13 +1775,13 @@ describe('Versions', () => { // Step 2: Add a block via API (simpler and more reliable than UI interaction) await payload.update({ - collection: localizedCollectionSlug, id, + collection: localizedCollectionSlug, data: { blocks: [ { - blockType: 'localizedTextBlock', blockText: 'Block content for English', + blockType: 'localizedTextBlock', }, ], }, @@ -1792,14 +1791,14 @@ describe('Versions', () => { // Step 3: Publish specific locale (English) via API const published = await payload.update({ - collection: localizedCollectionSlug, id, + collection: localizedCollectionSlug, data: { _status: 'published', blocks: [ { - blockType: 'localizedTextBlock', blockText: 'Block content for English', + blockType: 'localizedTextBlock', }, ], text: 'english text', @@ -2144,8 +2143,8 @@ describe('Versions', () => { await payload.create({ collection: autosaveCollectionSlug, data: { - title: 'This is a test', description: 'some description', + title: 'This is a test', }, }) @@ -2243,23 +2242,19 @@ describe('Versions', () => { beforeEach(async () => { const newPost = await payload.create({ collection: draftCollectionSlug, - depth: 0, data: { - title: 'new post', description: 'new description', + title: 'new post', }, + depth: 0, }) postID = newPost.id await payload.update({ - collection: draftCollectionSlug, id: postID, - draft: true, - depth: 0, + collection: draftCollectionSlug, data: { - title: 'current draft post title', - description: 'draft description', blocksField: [ { blockName: 'block1', @@ -2267,13 +2262,17 @@ describe('Versions', () => { text: 'block text', }, ], + description: 'draft description', + title: 'current draft post title', }, + depth: 0, + draft: true, }) const versions = await payload.findVersions({ collection: draftCollectionSlug, - limit: 2, depth: 0, + limit: 2, where: { parent: { equals: postID }, }, @@ -2319,11 +2318,11 @@ describe('Versions', () => { async function navigateToDiffVersionView(versionID?: string) { await _navigateToDiffVersionView({ adminRoute, - serverURL, collectionSlug: diffCollectionSlug, docID: diffID, - versionID: versionID ?? versionDiffID, page, + serverURL, + versionID: versionID ?? versionDiffID, }) } @@ -2645,9 +2644,9 @@ describe('Versions', () => { const draftDocs = await payload.find({ collection: 'draft-posts', - sort: 'createdAt', - limit: 3, depth: 0, + limit: 3, + sort: 'createdAt', }) await expect( @@ -2779,9 +2778,9 @@ describe('Versions', () => { const uploadDocs = await payload.find({ collection: 'media', - sort: 'createdAt', depth: 0, limit: 2, + sort: 'createdAt', }) await expect(upload.locator('.html-diff__diff-old .upload-diff__info')).toHaveText( @@ -2857,6 +2856,7 @@ describe('Versions', () => { test('diff is displayed correctly when editing 2nd block in a blocks field with 3 blocks', async () => { await payload.update({ + id: diffID, collection: 'diff', data: { blocks: [ @@ -2871,7 +2871,6 @@ describe('Versions', () => { }), ], }, - id: diffID, }) const latestVersionDiff = ( @@ -2919,14 +2918,15 @@ describe('Versions', () => { }, ] await payload.update({ + id: diffID, collection: 'diff', data: { array: newArray, }, - id: diffID, }) await payload.update({ + id: diffID, collection: 'diff', data: { array: newArray.map((arrayItem, i) => { @@ -2939,7 +2939,6 @@ describe('Versions', () => { return arrayItem }), }, - id: diffID, }) const latestVersionDiff = ( @@ -2976,58 +2975,58 @@ describe('Versions', () => { }) await payload.update({ + id: diffID, collection: diffCollectionSlug, data: { blocks: [ { blockType: 'SingleRelationshipBlock', - title: 'Single Block', relatedItem: { relationTo: textCollectionSlug, value: textDoc.id, }, + title: 'Single Block', }, { blockType: 'ManyRelationshipBlock', - title: 'Many Block', relatedItem: [ { relationTo: textCollectionSlug, value: textDoc.id, }, ], + title: 'Many Block', }, ], }, - id: diffID, }) // Swap the order of the blocks await payload.update({ + id: diffID, collection: diffCollectionSlug, data: { blocks: [ { blockType: 'ManyRelationshipBlock', - title: 'Many Block', relatedItem: [ { relationTo: textCollectionSlug, value: textDoc.id, }, ], + title: 'Many Block', }, { blockType: 'SingleRelationshipBlock', - title: 'Single Block', relatedItem: { relationTo: textCollectionSlug, value: textDoc.id, }, + title: 'Single Block', }, ], }, - id: diffID, }) const latestVersionDiff = ( @@ -3060,8 +3059,8 @@ describe('Versions', () => { // Update to create a version await payload.update({ - collection: diffCollectionSlug, id: doc.id, + collection: diffCollectionSlug, data: { _status: 'published', text: '', @@ -3081,11 +3080,11 @@ describe('Versions', () => { await _navigateToDiffVersionView({ adminRoute, - serverURL, collectionSlug: diffCollectionSlug, docID: doc.id, - versionID: versionDiff.id, page, + serverURL, + versionID: versionDiff.id, }) const text = page.locator('[data-field-path="text"]') @@ -3095,7 +3094,7 @@ describe('Versions', () => { await expect(text.locator('.html-diff__diff-new')).toHaveText('') // Cleanup - await payload.delete({ collection: diffCollectionSlug, id: doc.id }) + await payload.delete({ id: doc.id, collection: diffCollectionSlug }) }) test('correctly renders JSON fields containing HTML special characters', async () => { @@ -3110,8 +3109,8 @@ describe('Versions', () => { // Update to create a version await payload.update({ - collection: diffCollectionSlug, id: doc.id, + collection: diffCollectionSlug, data: { _status: 'published', json: { html: 'click' }, @@ -3131,11 +3130,11 @@ describe('Versions', () => { await _navigateToDiffVersionView({ adminRoute, - serverURL, collectionSlug: diffCollectionSlug, docID: doc.id, - versionID: versionDiff.id, page, + serverURL, + versionID: versionDiff.id, }) const json = page.locator('[data-field-path="json"]') @@ -3147,7 +3146,7 @@ describe('Versions', () => { ) // Cleanup - await payload.delete({ collection: diffCollectionSlug, id: doc.id }) + await payload.delete({ id: doc.id, collection: diffCollectionSlug }) }) }) }) diff --git a/tsconfig.base.json b/tsconfig.base.json index 5d3b1fcaf45..d2fbf746437 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -32,7 +32,7 @@ ], "paths": { "@payloadcms/figma": ["../enterprise-plugins/packages/figma/src/index.ts"], - "@payload-config": ["./test/_community/config.ts"], + "@payload-config": ["./test/admin/config.ts"], "@payloadcms/admin-bar": ["./packages/admin-bar/src"], "@payloadcms/live-preview": ["./packages/live-preview/src"], "@payloadcms/live-preview-react": ["./packages/live-preview-react/src/index.ts"], From 513c35e05c23fe75f8b86cae7674892f08ba538c Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 17:50:43 -0400 Subject: [PATCH 04/16] chore: consolidate e2e page setup into test/__setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Splits per-test setup into single-responsibility modules under `test/__setup` and routes every spec through one entry point. `initPage` now takes the browser context and returns the page, so there is no way to end up with a page that skipped the setup. It accepts `page` instead for the handful of suites whose page comes from Playwright's fixture. Because all 78 call sites ran `ensureCompilationIsDone` immediately afterwards, that moves inside too — the ~60 `beforeEach` callers that re-check after `reInitializeDB` keep calling it directly. Also fixes three things found while wiring it up: - `catchConsoleErrors` registered its `pageerror` handler twice, so an uncaught page error was thrown or recorded twice. - `test/__setup` was in no tsconfig `include`, leaving the new modules unparsed by eslint and unchecked by tsc. - `test/admin/e2e/sidebar-tabs` imported `test/helpers.js` and `test/helpers/*`, which have not existed under those names for some time, so the file could not load at all. Moves `initPageConsoleErrorCatch` and `ensureCompilationIsDone` out of `__helpers/e2e/helpers.ts`, and `initPayloadInt` out of `__helpers/shared`. --- test/__helpers/e2e/helpers.ts | 126 +---------------- test/__setup/catchConsoleErrors.ts | 21 +-- test/__setup/ensureCompilationIsDone.ts | 133 ++++++++++++++++++ test/__setup/initPage.ts | 34 ++++- .../shared => __setup}/initPayloadInt.ts | 8 +- test/_community/e2e.spec.ts | 4 +- test/_community/int.spec.ts | 2 +- test/a11y/e2e.spec.ts | 4 +- test/a11y/focus-indicators.e2e.spec.ts | 9 +- test/access-control/e2e.spec.ts | 10 +- test/access-control/int.spec.ts | 2 +- test/access-control/postgres-logs.int.spec.ts | 2 +- test/admin-bar/e2e.spec.ts | 4 +- test/admin-root/e2e.spec.ts | 10 +- test/admin-root/int.spec.ts | 2 +- test/admin/e2e/command-palette/e2e.spec.ts | 10 +- test/admin/e2e/document-view/e2e.spec.ts | 6 +- test/admin/e2e/general/e2e.spec.ts | 6 +- test/admin/e2e/list-view/e2e.spec.ts | 12 +- test/admin/e2e/sidebar-tabs/e2e.spec.ts | 5 +- test/admin/e2e/tooltip/e2e.spec.ts | 7 +- test/array-update/int.spec.ts | 2 +- test/auth-basic/e2e.spec.ts | 15 +- test/auth/custom-strategy/int.spec.ts | 2 +- test/auth/e2e.spec.ts | 11 +- .../forgot-password-localized/int.spec.ts | 2 +- test/auth/int.spec.ts | 2 +- test/auth/removed-token/int.spec.ts | 2 +- test/base-path/e2e.spec.ts | 13 +- test/bulk-edit/e2e.spec.ts | 4 +- test/collections-graphql/int.spec.ts | 2 +- test/collections-rest/int.spec.ts | 2 +- test/config/int.spec.ts | 2 +- test/custom-graphql/int.spec.ts | 2 +- test/dashboard/e2e.spec.ts | 2 +- test/database/int.spec.ts | 2 +- test/database/postgres-logs.int.spec.ts | 2 +- .../sqlite-bound-parameters-limit.int.spec.ts | 2 +- test/dataloader/int.spec.ts | 2 +- test/email-nodemailer/int.spec.ts | 2 +- test/embed/e2e.spec.ts | 5 +- test/endpoints/int.spec.ts | 2 +- test/evals/runCodegenDataset.ts | 2 +- test/field-access-context/int.spec.ts | 2 +- test/field-error-states/e2e.spec.ts | 14 +- test/field-paths/e2e.spec.ts | 9 +- test/field-paths/int.spec.ts | 2 +- test/fields-relationship/e2e.spec.ts | 6 +- test/fields-relationship/int.spec.ts | 2 +- test/fields/collections/Array/e2e.spec.ts | 10 +- test/fields/collections/Blocks/e2e.spec.ts | 6 +- test/fields/collections/Checkbox/e2e.spec.ts | 8 +- test/fields/collections/Code/e2e.spec.ts | 8 +- .../collections/Collapsible/e2e.spec.ts | 13 +- .../collections/ConditionalLogic/e2e.spec.ts | 6 +- test/fields/collections/CustomID/e2e.spec.ts | 8 +- test/fields/collections/Date/e2e.spec.ts | 32 +---- test/fields/collections/Email/e2e.spec.ts | 8 +- test/fields/collections/Group/e2e.spec.ts | 8 +- test/fields/collections/Indexed/e2e.spec.ts | 10 +- test/fields/collections/JSON/e2e.spec.ts | 10 +- test/fields/collections/Number/e2e.spec.ts | 10 +- test/fields/collections/Point/e2e.spec.ts | 10 +- test/fields/collections/Radio/e2e.spec.ts | 8 +- .../collections/Relationship/e2e.spec.ts | 6 +- test/fields/collections/Row/e2e.spec.ts | 8 +- test/fields/collections/Select/e2e.spec.ts | 11 +- test/fields/collections/SlugField/e2e.spec.ts | 11 +- test/fields/collections/Tabs/e2e.spec.ts | 11 +- test/fields/collections/Tabs2/e2e.spec.ts | 10 +- test/fields/collections/Text/e2e.spec.ts | 12 +- test/fields/collections/Textarea/e2e.spec.ts | 12 +- test/fields/collections/UI/e2e.spec.ts | 8 +- test/fields/collections/Upload/e2e.spec.ts | 10 +- .../collections/UploadMulti/e2e.spec.ts | 11 +- .../collections/UploadMultiPoly/e2e.spec.ts | 8 +- .../fields/collections/UploadPoly/e2e.spec.ts | 12 +- .../collections/UploadRestricted/e2e.spec.ts | 8 +- test/fields/int.spec.ts | 2 +- test/folders/int.spec.ts | 2 +- test/form-state/e2e.spec.ts | 30 ++-- test/form-state/int.spec.ts | 2 +- test/globals/int.spec.ts | 2 +- test/graphql/int.spec.ts | 2 +- test/group-by/e2e.spec.ts | 11 +- test/hierarchy/e2e.spec.ts | 4 +- test/hierarchy/int.spec.ts | 2 +- test/hooks/e2e.spec.ts | 10 +- test/hooks/int.spec.ts | 2 +- test/i18n/e2e.spec.ts | 6 +- test/joins/e2e.spec.ts | 8 +- test/joins/int.spec.ts | 2 +- test/kv/int.spec.ts | 2 +- test/lexical-mdx/int.spec.ts | 2 +- test/lexical/benchmarks/perf.spec.ts | 14 +- .../Lexical/e2e/blocks/e2e.spec.ts | 6 +- .../collections/Lexical/e2e/main/e2e.spec.ts | 6 +- .../LexicalAutosaveBlock/e2e.spec.ts | 2 +- .../LexicalHeadingFeature/e2e.spec.ts | 2 +- .../LexicalJSXConverter/e2e.spec.ts | 2 +- .../LexicalLinkFeature/e2e.spec.ts | 11 +- .../LexicalListsFeature/e2e.spec.ts | 2 +- .../LexicalSlugFieldNameCollision/e2e.spec.ts | 2 +- .../LexicalViewsFrontend/e2e.spec.ts | 8 +- .../LexicalViewsNested/e2e.spec.ts | 2 +- .../LexicalViewsProvider/e2e.spec.ts | 4 +- .../LexicalViewsProviderDefault/e2e.spec.ts | 2 +- .../LexicalViewsProviderFallback/e2e.spec.ts | 2 +- .../collections/OnDemandForm/e2e.spec.ts | 3 +- .../_LexicalFullyFeatured/db/e2e.spec.ts | 25 ++-- .../_LexicalFullyFeatured/e2e.spec.ts | 2 +- test/lexical/collections/utils.ts | 4 +- test/lexical/lexical.int.spec.ts | 2 +- test/live-preview/e2e.spec.ts | 9 +- test/live-preview/int.spec.ts | 2 +- test/localization/e2e.spec.ts | 7 +- test/localization/int.spec.ts | 2 +- test/localization/localizeStatus.int.spec.ts | 2 +- test/localization/testMigration.ts | 2 +- test/locked-documents/e2e.spec.ts | 132 ++--------------- test/locked-documents/int.spec.ts | 2 +- test/login-with-username/int.spec.ts | 2 +- test/payload-cloud/int.spec.ts | 2 +- test/plugin-cloud-storage/e2e.spec.ts | 3 +- .../int.compositePrefixes.int.spec.ts | 2 +- test/plugin-cloud-storage/int.spec.ts | 2 +- test/plugin-ecommerce/e2e.spec.ts | 9 +- test/plugin-ecommerce/int.spec.ts | 2 +- test/plugin-form-builder/e2e.spec.ts | 34 +++-- test/plugin-form-builder/int.spec.ts | 2 +- test/plugin-import-export/e2e.spec.ts | 49 ++++--- .../field-hooks.int.spec.ts | 2 +- test/plugin-import-export/hooks.int.spec.ts | 2 +- test/plugin-import-export/int.spec.ts | 2 +- test/plugin-mcp/e2e.spec.ts | 5 +- test/plugin-mcp/helpers/mcpFixtures.ts | 2 +- test/plugin-multi-tenant/e2e.spec.ts | 11 +- test/plugin-multi-tenant/int.spec.ts | 2 +- test/plugin-nested-docs/e2e.spec.ts | 5 +- test/plugin-nested-docs/int.spec.ts | 2 +- test/plugin-redirects/e2e.spec.ts | 9 +- test/plugin-redirects/int.spec.ts | 2 +- test/plugin-search/int.spec.ts | 2 +- test/plugin-sentry/int.spec.ts | 2 +- test/plugin-seo/e2e.spec.ts | 10 +- test/plugin-seo/int.spec.ts | 2 +- test/plugin-stripe/int.spec.ts | 2 +- test/plugins/int.spec.ts | 2 +- test/query-presets/e2e.spec.ts | 13 +- test/query-presets/int.spec.ts | 2 +- test/queues/cli.int.spec.ts | 2 +- test/queues/e2e.spec.ts | 4 +- test/queues/int.spec.ts | 2 +- test/queues/postgres-logs.int.spec.ts | 2 +- test/queues/schedules-autocron.int.spec.ts | 2 +- test/queues/schedules.int.spec.ts | 2 +- test/relationships/int.spec.ts | 2 +- test/sdk/int.spec.ts | 2 +- test/select/int.spec.ts | 2 +- test/select/postgreslogs.int.spec.ts | 2 +- test/server-functions/e2e.spec.ts | 13 +- test/server-url/e2e.spec.ts | 4 +- test/sort/e2e.spec.ts | 10 +- test/sort/int.spec.ts | 2 +- test/storage-azure/client-uploads/e2e.spec.ts | 8 +- test/storage-azure/client-uploads/int.spec.ts | 2 +- test/storage-azure/int.spec.ts | 2 +- .../streamingUploads.int.spec.ts | 2 +- test/storage-s3/client-uploads/e2e.spec.ts | 23 +-- test/storage-s3/client-uploads/int.spec.ts | 2 +- test/storage-s3/int.spec.ts | 2 +- test/storage-s3/searchBeforeS3.int.spec.ts | 2 +- .../compositePrefixes.int.spec.ts | 2 +- .../client-uploads/e2e.spec.ts | 23 +-- .../client-uploads/int.spec.ts | 2 +- test/storage-vercel-blob/int.spec.ts | 2 +- test/tags/e2e.spec.ts | 4 +- test/tags/int.spec.ts | 2 +- test/trash/e2e.spec.ts | 13 +- test/trash/int.spec.ts | 2 +- test/tsconfig.json | 2 + test/uploads/e2e.spec.ts | 6 +- test/uploads/int.spec.ts | 2 +- test/uuid-v7/int.spec.ts | 2 +- test/versions/e2e.spec.ts | 8 +- test/versions/int.spec.ts | 2 +- 186 files changed, 587 insertions(+), 940 deletions(-) create mode 100644 test/__setup/ensureCompilationIsDone.ts rename test/{__helpers/shared => __setup}/initPayloadInt.ts (86%) diff --git a/test/__helpers/e2e/helpers.ts b/test/__helpers/e2e/helpers.ts index 176088b5465..db3a0b25808 100644 --- a/test/__helpers/e2e/helpers.ts +++ b/test/__helpers/e2e/helpers.ts @@ -1,5 +1,4 @@ import type { - Browser, BrowserContext, CDPSession, ChromiumBrowserContext, @@ -9,11 +8,10 @@ import type { import { expect } from '@playwright/test' import { addDefaultsToConfig, type Config, type SanitizedConfig } from 'payload' -import { formatAdminURL, wait } from 'payload/shared' +import { wait } from 'payload/shared' import { setTimeout } from 'timers/promises' import { POLL_TOPASS_TIMEOUT } from '../../playwright.config.js' -import { hideNextDevTools } from './hideNextDevTools.js' export type AdminRoutes = NonNullable['routes']> @@ -47,128 +45,6 @@ const networkConditions = { }, } -/** - * Ensure admin panel is loaded before running tests - * @param page - * @param serverURL - */ -export async function ensureCompilationIsDone({ - browser, - customAdminRoutes, - customRoutes, - noAutoLogin, - page: pageFromArgs, - readyURL, - serverURL, -}: { - /** - * Provide a browser if you need this utility to create and close a temporary page for you. - */ - browser?: Browser - customAdminRoutes?: AdminRoutes - customRoutes?: Config['routes'] - noAutoLogin?: boolean - page?: Page - readyURL?: string - serverURL: string -}): Promise { - if (!pageFromArgs && !browser) { - throw new Error('Either page or browser must be provided') - } - if (pageFromArgs && browser) { - throw new Error('Either page or browser must be provided, not both') - } - - const page = pageFromArgs ?? (await browser!.newPage()) - - // Hide Next.js dev tools to prevent them from blocking interactions - await hideNextDevTools(page) - - const { routes: { admin: adminRoute } = {} } = getRoutes({ customAdminRoutes, customRoutes }) - - const adminURL = formatAdminURL({ adminRoute, path: '', serverURL }) - - // Disable the hydration wait during compilation polling — the page won't - // have the React tree mounted yet, so waiting 15s per attempt for the - // hydration marker would exhaust the beforeAll hook timeout. - const patchedPage = page as unknown as { __payloadSkipHydrationWait?: boolean } - patchedPage.__payloadSkipHydrationWait = true - - const maxAttempts = 15 - let attempt = 1 - - while (attempt <= maxAttempts) { - try { - console.log( - `Checking if compilation is done (attempt ${attempt}/${maxAttempts})...`, - readyURL ?? - (noAutoLogin ? `${adminURL + (adminURL.endsWith('/') ? '' : '/')}login` : adminURL), - ) - - // Commit is faster than waiting for the default waitUntil: load - await page.goto(adminURL, { waitUntil: 'commit' }) - - if (readyURL) { - await page.waitForURL(readyURL, { waitUntil: 'commit' }) - } else { - await expect - .poll( - () => { - if (noAutoLogin) { - const baseAdminURL = adminURL + (adminURL.endsWith('/') ? '' : '/') - return ( - page.url() === `${baseAdminURL}create-first-user` || - page.url() === `${baseAdminURL}login` - ) - } else { - return page.url() === adminURL - } - }, - { timeout: POLL_TOPASS_TIMEOUT }, - ) - .toBe(true) - } - - console.log('Successfully compiled') - patchedPage.__payloadSkipHydrationWait = false - if (browser) { - await page.close() - } - return - } catch (error) { - if (attempt === maxAttempts) { - patchedPage.__payloadSkipHydrationWait = false - console.error( - 'Compilation not done yet. Giving up. The dev server is probably not running or crashed.', - ) - throw error - } - - console.log('Compilation not done yet. Retrying in 2 seconds...') - await wait(2000) - attempt++ - } - } - - patchedPage.__payloadSkipHydrationWait = false - - if (noAutoLogin) { - if (browser) { - await page.close() - } - return - } - await expect(() => expect(page.locator('.template-default')).toBeVisible()).toPass({ - timeout: POLL_TOPASS_TIMEOUT, - }) - - await expect(page.locator('.dashboard__label').first()).toBeVisible() - - if (browser) { - await page.close() - } -} - /** * CPU throttling & 2 different kinds of network throttling */ diff --git a/test/__setup/catchConsoleErrors.ts b/test/__setup/catchConsoleErrors.ts index 72c7291a8ce..6132f3cec70 100644 --- a/test/__setup/catchConsoleErrors.ts +++ b/test/__setup/catchConsoleErrors.ts @@ -55,7 +55,7 @@ export function catchConsoleErrors(page: Page, options?: { ignoreCORS?: boolean // "Failed to fetch RSC payload for" happens seemingly randomly. There are lots of issues in the next.js repository for this. Causes e2e tests to fail and flake. Will ignore for now // the the server responded with a status of error happens frequently. Will ignore it for now. // Most importantly, this should catch react errors. - const { url, lineNumber, columnNumber } = msg.location() || {} + const { columnNumber, lineNumber, url } = msg.location() || {} const locationSuffix = url ? `\n at ${url}:${lineNumber ?? 0}:${columnNumber ?? 0}` : '' throw new Error(`Browser console error: ${msg.text()}${locationSuffix}`) } @@ -88,26 +88,9 @@ export function catchConsoleErrors(page: Page, options?: { ignoreCORS?: boolean } }) - // Capture uncaught errors that do not appear in the console - page.on('pageerror', (error) => { - const message = error?.message ?? String(error) - - if (message.includes('Hydration failed because the server rendered HTML')) { - return - } - - if (shouldCollectErrors) { - const stack = error?.stack - consoleErrors.push(`Page error: ${message}${stack ? `\n${stack}` : ''}`) - } else { - // Rethrow the original error to preserve stack, name, and other metadata - throw error - } - }) - return { - consoleErrors, collectErrors: () => (shouldCollectErrors = true), // Enable collection of errors for specific tests + consoleErrors, stopCollectingErrors: () => (shouldCollectErrors = false), // Disable collection of errors after the test } } diff --git a/test/__setup/ensureCompilationIsDone.ts b/test/__setup/ensureCompilationIsDone.ts new file mode 100644 index 00000000000..ba2e92435e4 --- /dev/null +++ b/test/__setup/ensureCompilationIsDone.ts @@ -0,0 +1,133 @@ +import type { Browser, Page } from '@playwright/test' + +import { expect } from '@playwright/test' +import { type Config } from 'payload' +import { formatAdminURL, wait } from 'payload/shared' + +import type { AdminRoutes } from '../__helpers/e2e/helpers.js' + +import { getRoutes } from '../__helpers/e2e/helpers.js' +import { hideNextDevTools } from '../__helpers/e2e/hideNextDevTools.js' +import { POLL_TOPASS_TIMEOUT } from '../playwright.config.js' + +/** + * Ensure admin panel is loaded before running tests + * @param page + * @param serverURL + */ +export async function ensureCompilationIsDone({ + browser, + customAdminRoutes, + customRoutes, + noAutoLogin, + page: pageFromArgs, + readyURL, + serverURL, +}: { + /** + * Provide a browser if you need this utility to create and close a temporary page for you. + */ + browser?: Browser + customAdminRoutes?: AdminRoutes + customRoutes?: Config['routes'] + noAutoLogin?: boolean + page?: Page + readyURL?: string + serverURL: string +}): Promise { + if (!pageFromArgs && !browser) { + throw new Error('Either page or browser must be provided') + } + if (pageFromArgs && browser) { + throw new Error('Either page or browser must be provided, not both') + } + + const page = pageFromArgs ?? (await browser!.newPage()) + + // Hide Next.js dev tools to prevent them from blocking interactions + await hideNextDevTools(page) + + const { routes: { admin: adminRoute } = {} } = getRoutes({ customAdminRoutes, customRoutes }) + + const adminURL = formatAdminURL({ adminRoute, path: '', serverURL }) + + // Disable the hydration wait during compilation polling — the page won't + // have the React tree mounted yet, so waiting 15s per attempt for the + // hydration marker would exhaust the beforeAll hook timeout. + const patchedPage = page as unknown as { __payloadSkipHydrationWait?: boolean } + patchedPage.__payloadSkipHydrationWait = true + + const maxAttempts = 15 + let attempt = 1 + + while (attempt <= maxAttempts) { + try { + console.log( + `Checking if compilation is done (attempt ${attempt}/${maxAttempts})...`, + readyURL ?? + (noAutoLogin ? `${adminURL + (adminURL.endsWith('/') ? '' : '/')}login` : adminURL), + ) + + // Commit is faster than waiting for the default waitUntil: load + await page.goto(adminURL, { waitUntil: 'commit' }) + + if (readyURL) { + await page.waitForURL(readyURL, { waitUntil: 'commit' }) + } else { + await expect + .poll( + () => { + if (noAutoLogin) { + const baseAdminURL = adminURL + (adminURL.endsWith('/') ? '' : '/') + return ( + page.url() === `${baseAdminURL}create-first-user` || + page.url() === `${baseAdminURL}login` + ) + } else { + return page.url() === adminURL + } + }, + { timeout: POLL_TOPASS_TIMEOUT }, + ) + .toBe(true) + } + + console.log('Successfully compiled') + patchedPage.__payloadSkipHydrationWait = false + if (browser) { + await page.close() + } + return + } catch (error) { + if (attempt === maxAttempts) { + patchedPage.__payloadSkipHydrationWait = false + console.error( + 'Compilation not done yet. Giving up. The dev server is probably not running or crashed.', + ) + throw error + } + + console.log('Compilation not done yet. Retrying in 2 seconds...') + await wait(2000) + attempt++ + } + } + + patchedPage.__payloadSkipHydrationWait = false + + if (noAutoLogin) { + if (browser) { + await page.close() + } + return + } + await expect(() => expect(page.locator('.template-default')).toBeVisible()).toPass({ + timeout: POLL_TOPASS_TIMEOUT, + }) + + await expect(page.locator('.dashboard__label').first()).toBeVisible() + + if (browser) { + await page.close() + } +} diff --git a/test/__setup/initPage.ts b/test/__setup/initPage.ts index 0ffe4209474..b69c4de11ad 100644 --- a/test/__setup/initPage.ts +++ b/test/__setup/initPage.ts @@ -1,20 +1,29 @@ import type { BrowserContext, Page } from '@playwright/test' +import type { Config } from 'payload' + +import type { AdminRoutes } from '../__helpers/e2e/helpers.js' import { catchConsoleErrors } from './catchConsoleErrors.js' +import { ensureCompilationIsDone } from './ensureCompilationIsDone.js' import { patchPageMethods } from './patchPageMethods.js' type InitPageArgs = { /** Creates the page. Ignored when `page` is supplied. */ context?: BrowserContext + customAdminRoutes?: AdminRoutes + customRoutes?: Config['routes'] /** Whether to ignore CORS errors in the console. */ ignoreCORS?: boolean + noAutoLogin?: boolean /** An existing page to wire up, i.e. Playwright's `{ page }` fixture. */ page?: Page + readyURL?: string + serverURL: string } /** - * Returns a page wired up for e2e use: navigation waits for the admin view to be - * interactive, and browser console errors fail the test. + * Returns a page wired up for e2e use, once the admin panel has compiled: navigation + * waits for the admin view to be interactive, and browser console errors fail the test. * * Pass `context` to have the page created for you, so there is no way to end up with a * page that skipped this setup. Pass `page` when it comes from somewhere you don't @@ -22,8 +31,18 @@ type InitPageArgs = { * * @see {@link patchPageMethods} * @see {@link catchConsoleErrors} + * @see {@link ensureCompilationIsDone} */ -export async function initPage({ context, ignoreCORS = false, page: incomingPage }: InitPageArgs) { +export async function initPage({ + context, + customAdminRoutes, + customRoutes, + ignoreCORS = false, + noAutoLogin, + page: incomingPage, + readyURL, + serverURL, +}: InitPageArgs) { if (!context && !incomingPage) { throw new Error('initPage requires either a `context` to create a page from, or a `page`.') } @@ -36,5 +55,14 @@ export async function initPage({ context, ignoreCORS = false, page: incomingPage ignoreCORS, }) + await ensureCompilationIsDone({ + customAdminRoutes, + customRoutes, + noAutoLogin, + page, + readyURL, + serverURL, + }) + return { collectErrors, consoleErrors, page, stopCollectingErrors } } diff --git a/test/__helpers/shared/initPayloadInt.ts b/test/__setup/initPayloadInt.ts similarity index 86% rename from test/__helpers/shared/initPayloadInt.ts rename to test/__setup/initPayloadInt.ts index a4f557fb2f0..148936993ca 100644 --- a/test/__helpers/shared/initPayloadInt.ts +++ b/test/__setup/initPayloadInt.ts @@ -4,9 +4,9 @@ import type { GeneratedTypes, Payload, SanitizedConfig } from 'payload' import path from 'path' import { getPayload } from 'payload' -import { runInit } from '../../runInit.js' -import { getSDK } from './getSDK.js' -import { NextRESTClient } from './NextRESTClient.js' +import { getSDK } from '../__helpers/shared/getSDK.js' +import { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import { runInit } from '../runInit.js' /** * Initialize Payload configured for integration tests @@ -43,5 +43,5 @@ export async function initPayloadInt { url = new AdminUrlUtil(serverURL, 'posts') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test('example test', async () => { diff --git a/test/_community/int.spec.ts b/test/_community/int.spec.ts index c540c4eabce..ed45fcd4729 100644 --- a/test/_community/int.spec.ts +++ b/test/_community/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { postsSlug } from './collections/Posts/index.js' let payload: Payload diff --git a/test/a11y/e2e.spec.ts b/test/a11y/e2e.spec.ts index 2b942e5f420..65dd05a468e 100644 --- a/test/a11y/e2e.spec.ts +++ b/test/a11y/e2e.spec.ts @@ -12,7 +12,6 @@ import { assertNoHorizontalOverflow, checkHorizontalOverflow, } from '../__helpers/e2e/checkHorizontalOverflow.js' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { runAxeScan } from '../__helpers/e2e/runAxeScan.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' @@ -39,8 +38,7 @@ test.describe.skip('A11y', () => { mediaUrl = new AdminUrlUtil(serverURL, 'media') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) // Reset viewport before each test to ensure consistent starting state diff --git a/test/a11y/focus-indicators.e2e.spec.ts b/test/a11y/focus-indicators.e2e.spec.ts index ecef4c796d5..30df1a4b55f 100644 --- a/test/a11y/focus-indicators.e2e.spec.ts +++ b/test/a11y/focus-indicators.e2e.spec.ts @@ -6,10 +6,7 @@ import { formatAdminURL } from 'payload/shared' import { fileURLToPath } from 'url' import { checkFocusIndicators } from '../__helpers/e2e/checkFocusIndicators.js' -import { - ensureCompilationIsDone, - getRoutes, -} from '../__helpers/e2e/helpers.js' +import { getRoutes } from '../__helpers/e2e/helpers.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' @@ -38,9 +35,7 @@ describe('Focus Indicators Test Page', () => { adminRoute = adminRouteFromConfig const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) describe('Full Page Scan', () => { diff --git a/test/access-control/e2e.spec.ts b/test/access-control/e2e.spec.ts index a4cf717f0cb..7133124d494 100644 --- a/test/access-control/e2e.spec.ts +++ b/test/access-control/e2e.spec.ts @@ -14,11 +14,7 @@ import { login } from '../__helpers/e2e/auth/login.js' import { getColumnSelectorItem, openListColumns } from '../__helpers/e2e/columns/index.js' import { openListFilters } from '../__helpers/e2e/filters/index.js' import { openGroupBy } from '../__helpers/e2e/groupBy/index.js' -import { - ensureCompilationIsDone, - exactText, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { exactText, saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { openDocControls } from '../__helpers/e2e/openDocControls.js' import { getSelectMenu } from '../__helpers/e2e/selectInput.js' import { closeNav, openNav } from '../__helpers/e2e/toggleNav.js' @@ -110,9 +106,7 @@ describe('Access Control', () => { restrictedTrashUrl = new AdminUrlUtil(serverURL, restrictedTrashSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) + ;({ page } = await initPage({ context, noAutoLogin: true, serverURL })) await login({ page, serverURL }) }) diff --git a/test/access-control/int.spec.ts b/test/access-control/int.spec.ts index 2b152985e4f..c113c19d2c9 100644 --- a/test/access-control/int.spec.ts +++ b/test/access-control/int.spec.ts @@ -16,7 +16,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it, vitest } from 'v import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { FullyRestricted, Post } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { requestHeaders } from './getConfig.js' import { asyncParentSlug, diff --git a/test/access-control/postgres-logs.int.spec.ts b/test/access-control/postgres-logs.int.spec.ts index 0840e59d1d7..b82d19a63f3 100644 --- a/test/access-control/postgres-logs.int.spec.ts +++ b/test/access-control/postgres-logs.int.spec.ts @@ -7,7 +7,7 @@ import { getEntityPermissions } from 'payload/internal' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it, vitest } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { whereCacheSameSlug, whereCacheUniqueSlug } from './shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/admin-bar/e2e.spec.ts b/test/admin-bar/e2e.spec.ts index 12513286aff..6a8ef3e203a 100644 --- a/test/admin-bar/e2e.spec.ts +++ b/test/admin-bar/e2e.spec.ts @@ -5,7 +5,6 @@ import * as path from 'path' import { formatAdminURL } from 'payload/shared' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' @@ -27,8 +26,7 @@ test.describe('Admin Bar', () => { serverURL = incomingServerURL const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL: incomingServerURL }) + ;({ page } = await initPage({ context, serverURL: incomingServerURL })) }) test('should render admin bar', async () => { diff --git a/test/admin-root/e2e.spec.ts b/test/admin-root/e2e.spec.ts index 06a09d778ec..96f5faada6e 100644 --- a/test/admin-root/e2e.spec.ts +++ b/test/admin-root/e2e.spec.ts @@ -6,12 +6,12 @@ import { fileURLToPath } from 'url' import { login } from '../__helpers/e2e/auth/login.js' import { - ensureCompilationIsDone, saveDocAndAssert, // throttleTest, } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { adminRoute } from './shared.js' @@ -43,16 +43,14 @@ test.describe('Admin Panel (Root)', () => { }) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ + ;({ page } = await initPage({ + context, customRoutes: { admin: adminRoute, }, noAutoLogin: true, - page, serverURL, - }) + })) await login({ customRoutes: { admin: adminRoute }, page, serverURL }) diff --git a/test/admin-root/int.spec.ts b/test/admin-root/int.spec.ts index 027e96751da..48084ea7256 100644 --- a/test/admin-root/int.spec.ts +++ b/test/admin-root/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { postsSlug } from './collections/Posts/index.js' let payload: Payload diff --git a/test/admin/e2e/command-palette/e2e.spec.ts b/test/admin/e2e/command-palette/e2e.spec.ts index 447d6931794..7262b5749ba 100644 --- a/test/admin/e2e/command-palette/e2e.spec.ts +++ b/test/admin/e2e/command-palette/e2e.spec.ts @@ -6,12 +6,10 @@ import { fileURLToPath } from 'url' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, - getRoutes, -} from '../../../__helpers/e2e/helpers.js' +import { getRoutes } from '../../../__helpers/e2e/helpers.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { BASE_PATH, customAdminRoutes } from '../../shared.js' @@ -54,9 +52,7 @@ test.describe('Command Palette', () => { })) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ customAdminRoutes, page, serverURL }) + ;({ page } = await initPage({ context, customAdminRoutes, serverURL })) const adminRoutes = getRoutes({ customAdminRoutes }) adminRoute = adminRoutes.routes.admin diff --git a/test/admin/e2e/document-view/e2e.spec.ts b/test/admin/e2e/document-view/e2e.spec.ts index fab854a7c31..f193cdccf72 100644 --- a/test/admin/e2e/document-view/e2e.spec.ts +++ b/test/admin/e2e/document-view/e2e.spec.ts @@ -8,13 +8,13 @@ import type { Config, Post } from '../../payload-types.js' import { checkBreadcrumb, checkPageTitle, - ensureCompilationIsDone, exactText, saveDocAndAssert, } from '../../../__helpers/e2e/helpers.js' import { test } from '../../../__helpers/e2e/playwright.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { BASE_PATH, @@ -103,9 +103,7 @@ describe('Document View', () => { localizedURL = new AdminUrlUtil(serverURL, localizedCollectionSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ customAdminRoutes, page, serverURL }) + ;({ page } = await initPage({ context, customAdminRoutes, serverURL })) }) beforeEach(async () => { diff --git a/test/admin/e2e/general/e2e.spec.ts b/test/admin/e2e/general/e2e.spec.ts index 162f1652a70..806f9ecbf0b 100644 --- a/test/admin/e2e/general/e2e.spec.ts +++ b/test/admin/e2e/general/e2e.spec.ts @@ -6,7 +6,6 @@ import { formatAdminURL, wait } from 'payload/shared' import type { Config, Geo, Post } from '../../payload-types.js' import { - ensureCompilationIsDone, getRoutes, openLocaleSelector, saveDocAndAssert, @@ -16,6 +15,7 @@ import { import { test } from '../../../__helpers/e2e/playwright.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { BASE_PATH, @@ -104,9 +104,7 @@ describe('General', () => { uploadsTwo = new AdminUrlUtil(serverURL, uploadTwoCollectionSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ customAdminRoutes, page, serverURL }) + ;({ page } = await initPage({ context, customAdminRoutes, serverURL })) adminRoutes = getRoutes({ customAdminRoutes }) adminRoute = adminRoutes.routes.admin diff --git a/test/admin/e2e/list-view/e2e.spec.ts b/test/admin/e2e/list-view/e2e.spec.ts index 7d25479d039..8ad4e67f5b3 100644 --- a/test/admin/e2e/list-view/e2e.spec.ts +++ b/test/admin/e2e/list-view/e2e.spec.ts @@ -6,14 +6,10 @@ import * as qs from 'qs-esm' import type { Config, Geo, Post, Virtual } from '../../payload-types.js' -import { - ensureCompilationIsDone, - exactText, - getRoutes, - openColumnControls, -} from '../../../__helpers/e2e/helpers.js' +import { exactText, getRoutes, openColumnControls } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { BASE_PATH, customAdminRoutes } from '../../shared.js' import { @@ -116,9 +112,7 @@ describe('List View', () => { noTimestampsUrl = new AdminUrlUtil(serverURL, noTimestampsSlug) customFieldsUrl = new AdminUrlUtil(serverURL, customFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ customAdminRoutes, page, serverURL }) + ;({ page } = await initPage({ context, customAdminRoutes, serverURL })) adminRoutes = getRoutes({ customAdminRoutes }) diff --git a/test/admin/e2e/sidebar-tabs/e2e.spec.ts b/test/admin/e2e/sidebar-tabs/e2e.spec.ts index c060bb2a8f7..970fd66cd7e 100644 --- a/test/admin/e2e/sidebar-tabs/e2e.spec.ts +++ b/test/admin/e2e/sidebar-tabs/e2e.spec.ts @@ -6,7 +6,6 @@ import { fileURLToPath } from 'url' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { openNav } from '../../../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' @@ -34,9 +33,7 @@ describe('Sidebar Tabs', () => { adminUrl = new AdminUrlUtil(serverURL, 'admin') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) describe('Custom Tabs', () => { diff --git a/test/admin/e2e/tooltip/e2e.spec.ts b/test/admin/e2e/tooltip/e2e.spec.ts index 8b3224853b7..6713d90e207 100644 --- a/test/admin/e2e/tooltip/e2e.spec.ts +++ b/test/admin/e2e/tooltip/e2e.spec.ts @@ -6,9 +6,6 @@ import { fileURLToPath } from 'url' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../../../__setup/initPage.js' @@ -30,9 +27,7 @@ test.describe('Tooltip', () => { url = new AdminUrlUtil(serverURL, 'posts') context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.afterAll(async () => { diff --git a/test/array-update/int.spec.ts b/test/array-update/int.spec.ts index 349128ab95e..7b7ed4dfde0 100644 --- a/test/array-update/int.spec.ts +++ b/test/array-update/int.spec.ts @@ -4,7 +4,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { arraySlug, complexSlug } from './shared.js' let payload: Payload diff --git a/test/auth-basic/e2e.spec.ts b/test/auth-basic/e2e.spec.ts index f917256f26e..350aa774a71 100644 --- a/test/auth-basic/e2e.spec.ts +++ b/test/auth-basic/e2e.spec.ts @@ -9,13 +9,11 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' -import { - ensureCompilationIsDone, - getRoutes, -} from '../__helpers/e2e/helpers.js' +import { getRoutes } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -82,19 +80,18 @@ describe('Auth (Basic)', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) url = new AdminUrlUtil(serverURL, 'users') - const context = await browser.newContext() - ;({ page } = await initPage({ context })) const { routes: { admin }, } = getRoutes({}) adminRoute = admin - await ensureCompilationIsDone({ + const context = await browser.newContext() + ;({ page } = await initPage({ + context, noAutoLogin: true, - page, readyURL: formatAdminURL({ adminRoute, path: '/**', serverURL }), serverURL, - }) + })) // Undo onInit seeding, as we need to test this without having a user created, or testing create-first-user await reInitializeDB({ diff --git a/test/auth/custom-strategy/int.spec.ts b/test/auth/custom-strategy/int.spec.ts index 058a7fbc5fa..713fca02268 100644 --- a/test/auth/custom-strategy/int.spec.ts +++ b/test/auth/custom-strategy/int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/initPayloadInt.js' import { usersSlug } from './shared.js' let payload: Payload diff --git a/test/auth/e2e.spec.ts b/test/auth/e2e.spec.ts index ccf0fdc7f6b..e96c8c3e27d 100644 --- a/test/auth/e2e.spec.ts +++ b/test/auth/e2e.spec.ts @@ -11,14 +11,11 @@ import type { Config } from './payload-types.js' import { login } from '../__helpers/e2e/auth/login.js' import { logout } from '../__helpers/e2e/auth/logout.js' -import { - ensureCompilationIsDone, - getRoutes, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { getRoutes, saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -56,9 +53,7 @@ describe('Auth', () => { adminRoute = adminRouteFromConfig context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) + ;({ page } = await initPage({ context, noAutoLogin: true, serverURL })) }) describe('create first user', () => { diff --git a/test/auth/forgot-password-localized/int.spec.ts b/test/auth/forgot-password-localized/int.spec.ts index 5cb3e24b697..17ef5944438 100644 --- a/test/auth/forgot-password-localized/int.spec.ts +++ b/test/auth/forgot-password-localized/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' import { devUser } from '../../credentials.js' -import { initPayloadInt } from '../../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/initPayloadInt.js' import { collectionSlug } from './config.js' let restClient: NextRESTClient | undefined diff --git a/test/auth/int.spec.ts b/test/auth/int.spec.ts index 51776359aed..f8a7450e492 100644 --- a/test/auth/int.spec.ts +++ b/test/auth/int.spec.ts @@ -19,7 +19,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it, vitest } from 'v import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { ApiKey } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { apiKeysSlug, diff --git a/test/auth/removed-token/int.spec.ts b/test/auth/removed-token/int.spec.ts index 3824403428b..048b952c405 100644 --- a/test/auth/removed-token/int.spec.ts +++ b/test/auth/removed-token/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' import { devUser } from '../../credentials.js' -import { initPayloadInt } from '../../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/initPayloadInt.js' import { collectionSlug } from './config.js' let restClient: NextRESTClient diff --git a/test/base-path/e2e.spec.ts b/test/base-path/e2e.spec.ts index 8432dea52eb..54a04a0d2e4 100644 --- a/test/base-path/e2e.spec.ts +++ b/test/base-path/e2e.spec.ts @@ -7,10 +7,7 @@ import { fileURLToPath } from 'url' import { login } from '../__helpers/e2e/auth/login.js' import { goToListDoc } from '../__helpers/e2e/goToListDoc.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' @@ -37,13 +34,7 @@ test.describe('Base Path', () => { url = new AdminUrlUtil(serverURL, 'posts') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ - noAutoLogin: true, - page, - serverURL, - }) + ;({ page } = await initPage({ context, noAutoLogin: true, serverURL })) }) test('should submit forgot-password form with correct basePath in action', async () => { diff --git a/test/bulk-edit/e2e.spec.ts b/test/bulk-edit/e2e.spec.ts index 9138f9a6bca..aac646a0cfe 100644 --- a/test/bulk-edit/e2e.spec.ts +++ b/test/bulk-edit/e2e.spec.ts @@ -12,7 +12,6 @@ import type { Config, Post } from './payload-types.js' import { addArrayRow } from '../__helpers/e2e/fields/array/index.js' import { addListFilter } from '../__helpers/e2e/filters/index.js' import { - ensureCompilationIsDone, exactText, findTableCell, selectTableRow, @@ -46,8 +45,7 @@ test.describe('Bulk Edit', () => { tabsUrl = new AdminUrlUtil(serverURL, tabsSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.beforeEach(async () => { diff --git a/test/collections-graphql/int.spec.ts b/test/collections-graphql/int.spec.ts index d28ac487608..3e2926044d7 100644 --- a/test/collections-graphql/int.spec.ts +++ b/test/collections-graphql/int.spec.ts @@ -10,7 +10,7 @@ import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { Post } from './payload-types.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { errorOnHookSlug, pointSlug, relationSlug, slug } from './config.js' const formatID = (id: number | string) => (typeof id === 'number' ? id : `"${id}"`) diff --git a/test/collections-rest/int.spec.ts b/test/collections-rest/int.spec.ts index a3b9ada3171..c568b4cdf2b 100644 --- a/test/collections-rest/int.spec.ts +++ b/test/collections-rest/int.spec.ts @@ -12,7 +12,7 @@ import type { Relation } from './config.js' import type { Post } from './payload-types.js' import { getFormDataSize } from '../__helpers/shared/getFormDataSize.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { largeDocumentsCollectionSlug } from './collections/LargeDocuments.js' import { customIdNumberSlug, diff --git a/test/config/int.spec.ts b/test/config/int.spec.ts index 87139193bf5..39e62de4cfc 100644 --- a/test/config/int.spec.ts +++ b/test/config/int.spec.ts @@ -8,7 +8,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { testFilePath } from './testFilePath.js' let restClient: NextRESTClient diff --git a/test/custom-graphql/int.spec.ts b/test/custom-graphql/int.spec.ts index 109436ba8e1..607269812b7 100644 --- a/test/custom-graphql/int.spec.ts +++ b/test/custom-graphql/int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let restClient: NextRESTClient let payload: Payload diff --git a/test/dashboard/e2e.spec.ts b/test/dashboard/e2e.spec.ts index 4e7cc9d8747..e276d6a407a 100644 --- a/test/dashboard/e2e.spec.ts +++ b/test/dashboard/e2e.spec.ts @@ -3,10 +3,10 @@ import { expect, test } from '@playwright/test' import path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { DashboardHelper } from './utils.js' diff --git a/test/database/int.spec.ts b/test/database/int.spec.ts index b5819beb20f..c3726c04a8d 100644 --- a/test/database/int.spec.ts +++ b/test/database/int.spec.ts @@ -36,7 +36,7 @@ import type { Global2, Post } from './payload-types.js' import { sanitizeQueryValue } from '../../packages/db-mongodb/src/queries/sanitizeQueryValue.js' import { describe, it } from '../__helpers/int/vitest.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { removeFiles } from '../__helpers/shared/removeFiles.js' import { devUser } from '../credentials.js' import { seed } from './seed.js' diff --git a/test/database/postgres-logs.int.spec.ts b/test/database/postgres-logs.int.spec.ts index 10167c742b5..61c146a9d32 100644 --- a/test/database/postgres-logs.int.spec.ts +++ b/test/database/postgres-logs.int.spec.ts @@ -8,7 +8,7 @@ import { afterAll, beforeAll, describe, expect, it, vitest } from 'vitest' import type { Post } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/database/sqlite-bound-parameters-limit.int.spec.ts b/test/database/sqlite-bound-parameters-limit.int.spec.ts index f184c56fafa..83ed6227ca5 100644 --- a/test/database/sqlite-bound-parameters-limit.int.spec.ts +++ b/test/database/sqlite-bound-parameters-limit.int.spec.ts @@ -4,7 +4,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { describe } from '../__helpers/int/vitest.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/dataloader/int.spec.ts b/test/dataloader/int.spec.ts index 50e07b3c136..0703cefddd7 100644 --- a/test/dataloader/int.spec.ts +++ b/test/dataloader/int.spec.ts @@ -8,7 +8,7 @@ import { afterAll, beforeAll, describe, expect, it, vitest } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { postDoc } from './config.js' diff --git a/test/email-nodemailer/int.spec.ts b/test/email-nodemailer/int.spec.ts index 8e2a38ccfd5..f3bedf5f1ba 100644 --- a/test/email-nodemailer/int.spec.ts +++ b/test/email-nodemailer/int.spec.ts @@ -6,7 +6,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it, type Mock, vi } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload let mockedSendEmail: Mock diff --git a/test/embed/e2e.spec.ts b/test/embed/e2e.spec.ts index 23f4e174652..ed6de78444c 100644 --- a/test/embed/e2e.spec.ts +++ b/test/embed/e2e.spec.ts @@ -4,7 +4,6 @@ import { expect, test } from '@playwright/test' import * as path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' @@ -31,9 +30,7 @@ test.describe('embed mode', () => { url = new AdminUrlUtil(serverURL, 'users') context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test('toggles embed mode via the ?embed param and persists it in a cookie', async () => { diff --git a/test/endpoints/int.spec.ts b/test/endpoints/int.spec.ts index 268108f3d6d..c8dfa41e653 100644 --- a/test/endpoints/int.spec.ts +++ b/test/endpoints/int.spec.ts @@ -5,7 +5,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { applicationEndpoint, collectionSlug, diff --git a/test/evals/runCodegenDataset.ts b/test/evals/runCodegenDataset.ts index db93527e165..a12125fadf7 100644 --- a/test/evals/runCodegenDataset.ts +++ b/test/evals/runCodegenDataset.ts @@ -466,7 +466,7 @@ function createLazyPayload({ } try { - const { initPayloadInt } = await import('../__helpers/shared/initPayloadInt.js') + const { initPayloadInt } = await import('../__setup/initPayloadInt.js') payload = ( await initPayloadInt(configDir, suiteName, undefined, configFile, { payloadKey: configFile, diff --git a/test/field-access-context/int.spec.ts b/test/field-access-context/int.spec.ts index b6afc10fed7..97043f0fc18 100644 --- a/test/field-access-context/int.spec.ts +++ b/test/field-access-context/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { childrenSlug, globalSlug, parentsSlug, readAccessLog, resetAccessLog } from './shared.js' let payload: Payload diff --git a/test/field-error-states/e2e.spec.ts b/test/field-error-states/e2e.spec.ts index 96ebf020c71..ab726271b6a 100644 --- a/test/field-error-states/e2e.spec.ts +++ b/test/field-error-states/e2e.spec.ts @@ -9,15 +9,11 @@ import type { Config } from './payload-types.js' import { addArrayRow, removeArrayRow } from '../__helpers/e2e/fields/array/index.js' import { addBlock } from '../__helpers/e2e/fields/blocks/index.js' -import { - ensureCompilationIsDone, - getRoutes, - saveDocAndAssert, - waitForFormReady, -} from '../__helpers/e2e/helpers.js' +import { getRoutes, saveDocAndAssert, waitForFormReady } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { collectionSlugs } from './shared.js' @@ -55,19 +51,15 @@ describe('Field Error States', () => { routes: { admin: adminRouteFromConfig }, } = getRoutes({}) adminRoute = adminRouteFromConfig - - await ensureCompilationIsDone({ browser, serverURL }) }) beforeEach(async ({ page }) => { - await initPage({ page }) + await initPage({ page, serverURL }) await reInitializeDB({ serverURL, snapshotKey: 'fielderrorstates', }) - - await ensureCompilationIsDone({ page, serverURL }) }) test('Remove row should remove error states from parent fields', async ({ page }) => { diff --git a/test/field-paths/e2e.spec.ts b/test/field-paths/e2e.spec.ts index e0d5f2866c6..540714bc98c 100644 --- a/test/field-paths/e2e.spec.ts +++ b/test/field-paths/e2e.spec.ts @@ -7,10 +7,8 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' -import { - ensureCompilationIsDone, - // throttleTest, -} from '../__helpers/e2e/helpers.js' +import {} from // throttleTest, +'../__helpers/e2e/helpers.js' import { navigateToDiffVersionView } from '../__helpers/e2e/navigateToDiffVersionView.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' @@ -36,8 +34,7 @@ test.describe('Field Paths', () => { fieldPathsUrl = new AdminUrlUtil(serverURL, fieldPathsSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.beforeEach(async () => { diff --git a/test/field-paths/int.spec.ts b/test/field-paths/int.spec.ts index f26dc019d5e..b5739d462fa 100644 --- a/test/field-paths/int.spec.ts +++ b/test/field-paths/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' // eslint-disable-next-line payload/no-relative-monorepo-imports import { buildFieldSchemaMap } from '../../packages/ui/src/utilities/buildFieldSchemaMap/index.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { fieldPathsSlug } from './shared.js' import { testDoc } from './testDoc.js' diff --git a/test/fields-relationship/e2e.spec.ts b/test/fields-relationship/e2e.spec.ts index 1e81231a24d..d024b91dff6 100644 --- a/test/fields-relationship/e2e.spec.ts +++ b/test/fields-relationship/e2e.spec.ts @@ -24,7 +24,6 @@ import { openCreateDocDrawer } from '../__helpers/e2e/fields/relationship/openCr import { addListFilter } from '../__helpers/e2e/filters/index.js' import { goToNextPage } from '../__helpers/e2e/goToNextPage.js' import { - ensureCompilationIsDone, saveDocAndAssert, // throttleTest, } from '../__helpers/e2e/helpers.js' @@ -34,6 +33,7 @@ import { openDocDrawer } from '../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../__helpers/shared/assertToastErrors.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { @@ -88,9 +88,7 @@ describe('Relationship Field', () => { versionedRelationshipFieldURL = new AdminUrlUtil(serverURL, versionedRelationshipFieldSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields-relationship/int.spec.ts b/test/fields-relationship/int.spec.ts index eafbf5c7b7b..5c8cc80da87 100644 --- a/test/fields-relationship/int.spec.ts +++ b/test/fields-relationship/int.spec.ts @@ -8,7 +8,7 @@ import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { Collection1 } from './payload-types.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { collection1Slug, versionedRelationshipFieldSlug } from './slugs.js' let payload: Payload diff --git a/test/fields/collections/Array/e2e.spec.ts b/test/fields/collections/Array/e2e.spec.ts index a8c734df0f5..04501c9b083 100644 --- a/test/fields/collections/Array/e2e.spec.ts +++ b/test/fields/collections/Array/e2e.spec.ts @@ -14,15 +14,13 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' @@ -48,9 +46,7 @@ describe('Array', () => { })) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/Blocks/e2e.spec.ts b/test/fields/collections/Blocks/e2e.spec.ts index 629d06fe257..c4d93a9cc3a 100644 --- a/test/fields/collections/Blocks/e2e.spec.ts +++ b/test/fields/collections/Blocks/e2e.spec.ts @@ -19,7 +19,6 @@ import { fileURLToPath } from 'url' import { assertNetworkRequests } from '../../../__helpers/e2e/assertNetworkRequests.js' import { - ensureCompilationIsDone, saveDocAndAssert, // throttleTest, } from '../../../__helpers/e2e/helpers.js' @@ -28,6 +27,7 @@ import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.j import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' @@ -54,9 +54,7 @@ describe('Block fields', () => { })) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Checkbox/e2e.spec.ts b/test/fields/collections/Checkbox/e2e.spec.ts index b867068ed70..9b3ca5801de 100644 --- a/test/fields/collections/Checkbox/e2e.spec.ts +++ b/test/fields/collections/Checkbox/e2e.spec.ts @@ -6,14 +6,12 @@ import { fileURLToPath } from 'url' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { addListFilter } from '../../../__helpers/e2e/filters/index.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { checkboxFieldsSlug } from '../../slugs.js' @@ -41,9 +39,7 @@ describe('Checkboxes', () => { url = new AdminUrlUtil(serverURL, checkboxFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Code/e2e.spec.ts b/test/fields/collections/Code/e2e.spec.ts index 00e129f0959..fcecf735478 100644 --- a/test/fields/collections/Code/e2e.spec.ts +++ b/test/fields/collections/Code/e2e.spec.ts @@ -6,13 +6,11 @@ import { fileURLToPath } from 'url' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { codeFieldsSlug } from '../../slugs.js' @@ -37,9 +35,7 @@ test.describe('Code', () => { url = new AdminUrlUtil(serverURL, codeFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.beforeEach(async () => { diff --git a/test/fields/collections/Collapsible/e2e.spec.ts b/test/fields/collections/Collapsible/e2e.spec.ts index 3f9a845c2de..44895fe618e 100644 --- a/test/fields/collections/Collapsible/e2e.spec.ts +++ b/test/fields/collections/Collapsible/e2e.spec.ts @@ -10,14 +10,12 @@ import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { addArrayRow } from '../../../__helpers/e2e/fields/array/index.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { collapsibleFieldsSlug } from '../../slugs.js' @@ -46,9 +44,7 @@ describe('Collapsibles', () => { url = new AdminUrlUtil(serverURL, collapsibleFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { @@ -85,7 +81,10 @@ describe('Collapsibles', () => { }) test('should render CollapsibleLabel using a component', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const label = 'custom row label as component' await page.goto(url.create) diff --git a/test/fields/collections/ConditionalLogic/e2e.spec.ts b/test/fields/collections/ConditionalLogic/e2e.spec.ts index 748234eabc3..7070f0b7494 100644 --- a/test/fields/collections/ConditionalLogic/e2e.spec.ts +++ b/test/fields/collections/ConditionalLogic/e2e.spec.ts @@ -11,7 +11,6 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { - ensureCompilationIsDone, saveDocAndAssert, // throttleTest, } from '../../../__helpers/e2e/helpers.js' @@ -19,6 +18,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { conditionalLogicSlug } from '../../slugs.js' @@ -62,9 +62,7 @@ describe('Conditional Logic', () => { url = new AdminUrlUtil(serverURL, conditionalLogicSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/CustomID/e2e.spec.ts b/test/fields/collections/CustomID/e2e.spec.ts index 36b69b7ea16..82122007ae6 100644 --- a/test/fields/collections/CustomID/e2e.spec.ts +++ b/test/fields/collections/CustomID/e2e.spec.ts @@ -7,14 +7,12 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { navigateToDoc } from '../../../__helpers/e2e/navigateToDoc.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { customIDSlug, customRowIDSlug, customTabIDSlug } from '../../slugs.js' @@ -48,9 +46,7 @@ describe('Custom IDs', () => { customRowIDURL = new AdminUrlUtil(serverURL, customRowIDSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Date/e2e.spec.ts b/test/fields/collections/Date/e2e.spec.ts index f114a000988..fc599716f01 100644 --- a/test/fields/collections/Date/e2e.spec.ts +++ b/test/fields/collections/Date/e2e.spec.ts @@ -10,15 +10,13 @@ import type { Config } from '../../payload-types.js' import { getColumnSelectorItem } from '../../../__helpers/e2e/columns/index.js' import { addListFilter } from '../../../__helpers/e2e/filters/addListFilter.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { dateFieldsSlug } from '../../slugs.js' @@ -68,9 +66,7 @@ describe('Date', () => { url = new AdminUrlUtil(serverURL, dateFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ @@ -607,7 +603,6 @@ describe('Date', () => { const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { @@ -621,7 +616,6 @@ describe('Date', () => { }, }) - expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) }) @@ -762,9 +756,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => url = new AdminUrlUtil(serverURL, dateFieldsSlug) const context = await browser.newContext({ timezoneId }) - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { @@ -888,7 +880,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { @@ -902,7 +893,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) }) @@ -930,7 +920,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { @@ -944,7 +933,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) }) @@ -972,7 +960,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { @@ -986,7 +973,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedUTCValue) }) @@ -1025,7 +1011,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { @@ -1039,7 +1024,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedDateTimeUTCValue) expect(existingDoc?.defaultWithTimezone).toEqual(expectedDateOnlyUTCValue) }) @@ -1079,7 +1063,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { @@ -1093,7 +1076,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - expect(existingDoc?.dayAndTimeWithTimezone).toEqual(expectedDateTimeUTCValue) expect(existingDoc?.defaultWithTimezone).toEqual(expectedDateOnlyUTCValue) }) @@ -1214,7 +1196,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { @@ -1229,7 +1210,7 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }) // The UTC value should be identical regardless of browser timezone context - + expect(existingDoc?.dateWithOffsetTimezone).toEqual(expectedUTCValue) expect(existingDoc?.dateWithOffsetTimezone_tz).toEqual(expectedTimezone) }) @@ -1273,7 +1254,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { @@ -1287,7 +1267,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => }, }) - expect(existingDoc?.dateWithOffsetTimezone).toEqual(expectedUTCValue) expect(existingDoc?.dateWithOffsetTimezone_tz).toEqual(expectedTimezone) }) @@ -1336,7 +1315,6 @@ const createTimezoneContextTests = (contextName: string, timezoneId: string) => const docID = page.url().split('/').pop() - expect(docID).toBeTruthy() const { diff --git a/test/fields/collections/Email/e2e.spec.ts b/test/fields/collections/Email/e2e.spec.ts index 46525858852..1dfd1221652 100644 --- a/test/fields/collections/Email/e2e.spec.ts +++ b/test/fields/collections/Email/e2e.spec.ts @@ -8,14 +8,12 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { emailFieldsSlug } from '../../slugs.js' @@ -45,9 +43,7 @@ describe('Email', () => { url = new AdminUrlUtil(serverURL, emailFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/Group/e2e.spec.ts b/test/fields/collections/Group/e2e.spec.ts index 15950c0a18e..06e17c93de4 100644 --- a/test/fields/collections/Group/e2e.spec.ts +++ b/test/fields/collections/Group/e2e.spec.ts @@ -7,14 +7,12 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { groupFieldsSlug } from '../../slugs.js' @@ -44,9 +42,7 @@ describe('Group', () => { url = new AdminUrlUtil(serverURL, groupFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Indexed/e2e.spec.ts b/test/fields/collections/Indexed/e2e.spec.ts index 62dc910928f..87a14363a5a 100644 --- a/test/fields/collections/Indexed/e2e.spec.ts +++ b/test/fields/collections/Indexed/e2e.spec.ts @@ -8,15 +8,13 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, - gotoAndWaitForForm, -} from '../../../__helpers/e2e/helpers.js' +import { gotoAndWaitForForm } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { indexedFieldsSlug } from '../../slugs.js' @@ -45,9 +43,7 @@ describe('Radio', () => { url = new AdminUrlUtil(serverURL, indexedFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/JSON/e2e.spec.ts b/test/fields/collections/JSON/e2e.spec.ts index 449bf44c02f..98f99a39348 100644 --- a/test/fields/collections/JSON/e2e.spec.ts +++ b/test/fields/collections/JSON/e2e.spec.ts @@ -8,15 +8,13 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { openListFilters } from '../../../__helpers/e2e/filters/openListFilters.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { jsonFieldsSlug } from '../../slugs.js' @@ -46,9 +44,7 @@ describe('JSON', () => { url = new AdminUrlUtil(serverURL, jsonFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Number/e2e.spec.ts b/test/fields/collections/Number/e2e.spec.ts index 4155d752809..00bc0072b0e 100644 --- a/test/fields/collections/Number/e2e.spec.ts +++ b/test/fields/collections/Number/e2e.spec.ts @@ -10,16 +10,14 @@ import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { addListFilter } from '../../../__helpers/e2e/filters/index.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { numberDoc } from './shared.js' @@ -48,9 +46,7 @@ describe('Number', () => { url = new AdminUrlUtil(serverURL, 'number-fields') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Point/e2e.spec.ts b/test/fields/collections/Point/e2e.spec.ts index 153bbd6b820..fa015de89f9 100644 --- a/test/fields/collections/Point/e2e.spec.ts +++ b/test/fields/collections/Point/e2e.spec.ts @@ -8,15 +8,13 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { pointFieldsSlug } from '../../slugs.js' @@ -46,9 +44,7 @@ describe('Point', () => { url = new AdminUrlUtil(serverURL, pointFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/Radio/e2e.spec.ts b/test/fields/collections/Radio/e2e.spec.ts index 9a4890cd3bc..236f0d9914a 100644 --- a/test/fields/collections/Radio/e2e.spec.ts +++ b/test/fields/collections/Radio/e2e.spec.ts @@ -8,14 +8,12 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { radioFieldsSlug } from '../../slugs.js' @@ -44,9 +42,7 @@ describe('Radio', () => { url = new AdminUrlUtil(serverURL, radioFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Relationship/e2e.spec.ts b/test/fields/collections/Relationship/e2e.spec.ts index c1d74ffb164..ac4a92a2299 100644 --- a/test/fields/collections/Relationship/e2e.spec.ts +++ b/test/fields/collections/Relationship/e2e.spec.ts @@ -12,7 +12,6 @@ import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicator import { openCreateDocDrawer } from '../../../__helpers/e2e/fields/relationship/openCreateDocDrawer.js' import { addListFilter, openListFilters } from '../../../__helpers/e2e/filters/index.js' import { - ensureCompilationIsDone, exactText, saveDocAndAssert, saveDocHotkeyAndAssert, @@ -30,6 +29,7 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { relationshipFieldsSlug, textFieldsSlug } from '../../slugs.js' @@ -54,9 +54,7 @@ describe('relationship', () => { })) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/Row/e2e.spec.ts b/test/fields/collections/Row/e2e.spec.ts index 789d67b19e8..7d135f9f0c7 100644 --- a/test/fields/collections/Row/e2e.spec.ts +++ b/test/fields/collections/Row/e2e.spec.ts @@ -8,13 +8,11 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { rowFieldsSlug } from '../../slugs.js' @@ -43,9 +41,7 @@ describe('Row', () => { url = new AdminUrlUtil(serverURL, rowFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Select/e2e.spec.ts b/test/fields/collections/Select/e2e.spec.ts index 31d73af281d..e5f4bcd3f8b 100644 --- a/test/fields/collections/Select/e2e.spec.ts +++ b/test/fields/collections/Select/e2e.spec.ts @@ -10,16 +10,13 @@ import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' import { clickColumnSelectorItem, openListColumns } from '../../../__helpers/e2e/columns/index.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, - waitForFormReady, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert, waitForFormReady } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { selectFieldsSlug } from '../../slugs.js' @@ -48,9 +45,7 @@ describe('Select', () => { url = new AdminUrlUtil(serverURL, selectFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/SlugField/e2e.spec.ts b/test/fields/collections/SlugField/e2e.spec.ts index d574d0f8ff9..6b1ad936e70 100644 --- a/test/fields/collections/SlugField/e2e.spec.ts +++ b/test/fields/collections/SlugField/e2e.spec.ts @@ -8,16 +8,13 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' -import { - changeLocale, - ensureCompilationIsDone, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { changeLocale, saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { slugFieldsSlug } from '../../slugs.js' @@ -60,9 +57,7 @@ describe('SlugField', () => { url = new AdminUrlUtil(serverURL, slugFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Tabs/e2e.spec.ts b/test/fields/collections/Tabs/e2e.spec.ts index 442627bcc99..fbf85af4cc5 100644 --- a/test/fields/collections/Tabs/e2e.spec.ts +++ b/test/fields/collections/Tabs/e2e.spec.ts @@ -9,17 +9,14 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, - switchTab, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert, switchTab } from '../../../__helpers/e2e/helpers.js' import { navigateToDoc } from '../../../__helpers/e2e/navigateToDoc.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { tabsFieldsSlug } from '../../slugs.js' @@ -48,9 +45,7 @@ describe('Tabs', () => { url = new AdminUrlUtil(serverURL, tabsFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/Tabs2/e2e.spec.ts b/test/fields/collections/Tabs2/e2e.spec.ts index f03fb46f3ec..1256c3aa4c4 100644 --- a/test/fields/collections/Tabs2/e2e.spec.ts +++ b/test/fields/collections/Tabs2/e2e.spec.ts @@ -8,14 +8,12 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { addArrayRow } from '../../../__helpers/e2e/fields/array/index.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { tabsFields2Slug } from '../../slugs.js' @@ -44,9 +42,7 @@ describe('Tabs', () => { url = new AdminUrlUtil(serverURL, tabsFields2Slug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/Text/e2e.spec.ts b/test/fields/collections/Text/e2e.spec.ts index 44cd39d1557..465d01b8855 100644 --- a/test/fields/collections/Text/e2e.spec.ts +++ b/test/fields/collections/Text/e2e.spec.ts @@ -15,18 +15,14 @@ import { toggleColumn, } from '../../../__helpers/e2e/columns/index.js' import { addListFilter } from '../../../__helpers/e2e/filters/index.js' -import { - ensureCompilationIsDone, - exactText, - saveDocAndAssert, - selectTableRow, -} from '../../../__helpers/e2e/helpers.js' +import { exactText, saveDocAndAssert, selectTableRow } from '../../../__helpers/e2e/helpers.js' import { upsertPreferences } from '../../../__helpers/e2e/preferences.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { textFieldsSlug } from '../../slugs.js' @@ -56,9 +52,7 @@ describe('Text', () => { url = new AdminUrlUtil(serverURL, textFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/Textarea/e2e.spec.ts b/test/fields/collections/Textarea/e2e.spec.ts index 27e42fd9716..6b86d5150cf 100644 --- a/test/fields/collections/Textarea/e2e.spec.ts +++ b/test/fields/collections/Textarea/e2e.spec.ts @@ -16,18 +16,14 @@ import { toggleColumn, } from '../../../__helpers/e2e/columns/index.js' import { addListFilter } from '../../../__helpers/e2e/filters/index.js' -import { - ensureCompilationIsDone, - exactText, - saveDocAndAssert, - selectTableRow, -} from '../../../__helpers/e2e/helpers.js' +import { exactText, saveDocAndAssert, selectTableRow } from '../../../__helpers/e2e/helpers.js' import { upsertPreferences } from '../../../__helpers/e2e/preferences.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { textareaFieldsSlug } from '../../slugs.js' @@ -57,9 +53,7 @@ describe('Textarea', () => { url = new AdminUrlUtil(serverURL, textareaFieldsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/UI/e2e.spec.ts b/test/fields/collections/UI/e2e.spec.ts index 34c87fb8ba5..7c77b629add 100644 --- a/test/fields/collections/UI/e2e.spec.ts +++ b/test/fields/collections/UI/e2e.spec.ts @@ -8,13 +8,11 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uiSlug } from '../../slugs.js' @@ -43,9 +41,7 @@ describe('Radio', () => { url = new AdminUrlUtil(serverURL, uiSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/fields/collections/Upload/e2e.spec.ts b/test/fields/collections/Upload/e2e.spec.ts index d116d2f5b86..d2f43cf1a76 100644 --- a/test/fields/collections/Upload/e2e.spec.ts +++ b/test/fields/collections/Upload/e2e.spec.ts @@ -9,15 +9,13 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import { checkFocusIndicators } from '../../../__helpers/e2e/checkFocusIndicators.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { runAxeScan } from '../../../__helpers/e2e/runAxeScan.js' import { openDocDrawer } from '../../../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsSlug } from '../../slugs.js' @@ -45,9 +43,7 @@ describe('Upload', () => { url = new AdminUrlUtil(serverURL, uploadsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/UploadMulti/e2e.spec.ts b/test/fields/collections/UploadMulti/e2e.spec.ts index f14b54ff6c3..46cb6c8d547 100644 --- a/test/fields/collections/UploadMulti/e2e.spec.ts +++ b/test/fields/collections/UploadMulti/e2e.spec.ts @@ -8,15 +8,12 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, - exactText, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { exactText, saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { openDocDrawer } from '../../../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsMulti } from '../../slugs.js' @@ -44,9 +41,7 @@ describe('Upload with hasMany', () => { url = new AdminUrlUtil(serverURL, uploadsMulti) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/UploadMultiPoly/e2e.spec.ts b/test/fields/collections/UploadMultiPoly/e2e.spec.ts index 9b7a6955a0f..34928d89747 100644 --- a/test/fields/collections/UploadMultiPoly/e2e.spec.ts +++ b/test/fields/collections/UploadMultiPoly/e2e.spec.ts @@ -7,7 +7,6 @@ import type { Config } from '../../payload-types.js' import { closeAllToasts, - ensureCompilationIsDone, exactText, saveDocAndAssert, waitForFormReady, @@ -16,6 +15,7 @@ import { getSelectMenu } from '../../../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsMultiPoly } from '../../slugs.js' @@ -37,8 +37,6 @@ describe('Upload polymorphic with hasMany', () => { 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 initPayloadE2ENoConfig({ dirname })) url = new AdminUrlUtil(serverURL, uploadsMultiPoly) - - await ensureCompilationIsDone({ browser, serverURL }) }) beforeEach(async ({ page }) => { await reInitializeDB({ @@ -46,9 +44,7 @@ describe('Upload polymorphic with hasMany', () => { snapshotKey: 'fieldsTest', uploadsDir: path.resolve(dirname, './collections/Upload/uploads'), }) - await initPage({ page }) - - await ensureCompilationIsDone({ page, serverURL }) + await initPage({ page, serverURL }) }) test('should upload in new doc', async ({ page }) => { diff --git a/test/fields/collections/UploadPoly/e2e.spec.ts b/test/fields/collections/UploadPoly/e2e.spec.ts index bc19d3d9cc2..e19933468e2 100644 --- a/test/fields/collections/UploadPoly/e2e.spec.ts +++ b/test/fields/collections/UploadPoly/e2e.spec.ts @@ -10,15 +10,11 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, - exactText, - gotoAndWaitForForm, - saveDocAndAssert, -} from '../../../__helpers/e2e/helpers.js' +import { exactText, gotoAndWaitForForm, saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsPoly } from '../../slugs.js' @@ -46,9 +42,7 @@ describe('Upload polymorphic', () => { url = new AdminUrlUtil(serverURL, uploadsPoly) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/collections/UploadRestricted/e2e.spec.ts b/test/fields/collections/UploadRestricted/e2e.spec.ts index 00175e0eee0..ae495db4193 100644 --- a/test/fields/collections/UploadRestricted/e2e.spec.ts +++ b/test/fields/collections/UploadRestricted/e2e.spec.ts @@ -7,13 +7,11 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { - ensureCompilationIsDone, -} from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { initPage } from '../../../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsRestricted } from '../../slugs.js' @@ -43,9 +41,7 @@ describe('Upload with restrictions', () => { url = new AdminUrlUtil(serverURL, uploadsRestricted) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/fields/int.spec.ts b/test/fields/int.spec.ts index 11f483f4bc2..8bdd838f27e 100644 --- a/test/fields/int.spec.ts +++ b/test/fields/int.spec.ts @@ -12,7 +12,7 @@ import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { BlockField, GroupField } from './payload-types.js' import { it } from '../__helpers/int/vitest.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { isMongoose } from '../__helpers/shared/isMongoose.js' import { devUser } from '../credentials.js' import { arrayDefaultValue } from './collections/Array/index.js' diff --git a/test/folders/int.spec.ts b/test/folders/int.spec.ts index 699c9dc2ae9..b59d245aabe 100644 --- a/test/folders/int.spec.ts +++ b/test/folders/int.spec.ts @@ -4,7 +4,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { folderSlug, postSlug } from './shared.js' let payload: Payload diff --git a/test/form-state/e2e.spec.ts b/test/form-state/e2e.spec.ts index c0eac4c81d3..0e3825dec31 100644 --- a/test/form-state/e2e.spec.ts +++ b/test/form-state/e2e.spec.ts @@ -19,12 +19,7 @@ import { removeArrayRow, } from '../__helpers/e2e/fields/array/index.js' import { addBlock } from '../__helpers/e2e/fields/blocks/index.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, - throttleTest, - waitForFormReady, -} from '../__helpers/e2e/helpers.js' +import { saveDocAndAssert, throttleTest, waitForFormReady } from '../__helpers/e2e/helpers.js' import { currentFramework, test } from '../__helpers/e2e/playwright.js' import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSaveToRunAndComplete.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' @@ -56,8 +51,7 @@ test.describe('Form State', () => { autosavePostsUrl = new AdminUrlUtil(serverURL, autosavePostsSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.beforeEach(async () => { @@ -77,18 +71,14 @@ test.describe('Form State', () => { await expect(page.locator('#field-title')).toBeDisabled() }) - test( - 'should render the create form ready to edit', - { framework: 'tanstack-start' }, - async () => { - await page.goto(postsUrl.create) - // No client-init disabled phase: the RSC payload arrives with form state - // already initialized, so the field is immediately enabled and editable. - await expect(page.locator('#field-title')).toBeEnabled() - await page.locator('#field-title').fill(title) - await expect(page.locator('#field-title')).toHaveValue(title) - }, - ) + test('should render the create form ready to edit', { framework: 'tanstack-start' }, async () => { + await page.goto(postsUrl.create) + // No client-init disabled phase: the RSC payload arrives with form state + // already initialized, so the field is immediately enabled and editable. + await expect(page.locator('#field-title')).toBeEnabled() + await page.locator('#field-title').fill(title) + await expect(page.locator('#field-title')).toHaveValue(title) + }) test('should disable fields while processing', async () => { const doc = await createPost() diff --git a/test/form-state/int.spec.ts b/test/form-state/int.spec.ts index 45293b20d77..f95372a281b 100644 --- a/test/form-state/int.spec.ts +++ b/test/form-state/int.spec.ts @@ -9,7 +9,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { conditionsSlug } from './collections/Conditions/index.js' import { postsSlug } from './collections/Posts/index.js' diff --git a/test/globals/int.spec.ts b/test/globals/int.spec.ts index ad8ab58c1e1..e341da44540 100644 --- a/test/globals/int.spec.ts +++ b/test/globals/int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { accessControlSlug, arraySlug, diff --git a/test/graphql/int.spec.ts b/test/graphql/int.spec.ts index 915eda331dd..2a1fb8f217a 100644 --- a/test/graphql/int.spec.ts +++ b/test/graphql/int.spec.ts @@ -10,7 +10,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload let restClient: NextRESTClient diff --git a/test/group-by/e2e.spec.ts b/test/group-by/e2e.spec.ts index 509f2020f68..0b2efc00228 100644 --- a/test/group-by/e2e.spec.ts +++ b/test/group-by/e2e.spec.ts @@ -16,12 +16,7 @@ import { closeGroupBy, openGroupBy, } from '../__helpers/e2e/groupBy/index.js' -import { - ensureCompilationIsDone, - exactText, - saveDocAndAssert, - selectTableRow, -} from '../__helpers/e2e/helpers.js' +import { exactText, saveDocAndAssert, selectTableRow } from '../__helpers/e2e/helpers.js' import { navigateToListView } from '../__helpers/e2e/navigateToListView.js' import { deletePreferences } from '../__helpers/e2e/preferences.js' import { getSelectMenu } from '../__helpers/e2e/selectInput.js' @@ -29,6 +24,7 @@ import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -61,8 +57,7 @@ test.describe('Group By', () => { noGroupableUrl = new AdminUrlUtil(serverURL, noGroupableSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) user = await payload.login({ collection: 'users', diff --git a/test/hierarchy/e2e.spec.ts b/test/hierarchy/e2e.spec.ts index 20d4b6ac815..8e776c5873b 100644 --- a/test/hierarchy/e2e.spec.ts +++ b/test/hierarchy/e2e.spec.ts @@ -7,7 +7,6 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config, Organization } from './payload-types.js' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' @@ -70,8 +69,7 @@ test.describe('Hierarchy Sidebar', () => { organizationsURL = new AdminUrlUtil(serverURL, 'organizations') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.afterAll(async () => { diff --git a/test/hierarchy/int.spec.ts b/test/hierarchy/int.spec.ts index b40cfca75f8..bbb18950b03 100644 --- a/test/hierarchy/int.spec.ts +++ b/test/hierarchy/int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from import type { Organization } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/hooks/e2e.spec.ts b/test/hooks/e2e.spec.ts index f53471048f9..28e38ec7179 100644 --- a/test/hooks/e2e.spec.ts +++ b/test/hooks/e2e.spec.ts @@ -8,12 +8,10 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { beforeValidateSlug } from './shared.js' @@ -42,9 +40,7 @@ describe('Hooks', () => { beforeDeleteURL = new AdminUrlUtil(serverURL, 'before-delete-hooks') beforeDelete2URL = new AdminUrlUtil(serverURL, 'before-delete-2-hooks') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { diff --git a/test/hooks/int.spec.ts b/test/hooks/int.spec.ts index d293a1dae4f..509d8ead2c4 100644 --- a/test/hooks/int.spec.ts +++ b/test/hooks/int.spec.ts @@ -8,7 +8,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { devUser, regularUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { isMongoose } from '../__helpers/shared/isMongoose.js' import { afterOperationSlug } from './collections/AfterOperation/index.js' import { diff --git a/test/i18n/e2e.spec.ts b/test/i18n/e2e.spec.ts index 81f3f0b0dc8..ed1d91d3ae5 100644 --- a/test/i18n/e2e.spec.ts +++ b/test/i18n/e2e.spec.ts @@ -15,10 +15,10 @@ import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import { assertNetworkRequests } from '../__helpers/e2e/assertNetworkRequests.js' import { getColumnSelectorItem } from '../__helpers/e2e/columns/index.js' import { openListFilters } from '../__helpers/e2e/filters/index.js' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -47,9 +47,7 @@ describe('i18n', () => { collection1URL = new AdminUrlUtil(serverURL, 'collection1') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { await reInitializeDB({ diff --git a/test/joins/e2e.spec.ts b/test/joins/e2e.spec.ts index 9973a782af7..803bfd4c52e 100644 --- a/test/joins/e2e.spec.ts +++ b/test/joins/e2e.spec.ts @@ -10,7 +10,6 @@ import type { Config } from './payload-types.js' import { reorderColumns } from '../__helpers/e2e/columns/index.js' import { changeLocale, - ensureCompilationIsDone, exactText, saveDocAndAssert, // throttleTest, @@ -67,8 +66,7 @@ describe('Join Field', () => { versionsURL = new AdminUrlUtil(serverURL, versionsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) //await throttleTest({ context, delay: 'Slow 4G', page }) }) @@ -350,9 +348,9 @@ describe('Join Field', () => { const innerText = await thead.innerText() // expect the order of columns to be 'ID', 'Created At', 'Title' - + expect(innerText.indexOf('ID')).toBeLessThan(innerText.indexOf('Created At')) - + expect(innerText.indexOf('Created At')).toBeLessThan(innerText.indexOf('Title')) }) diff --git a/test/joins/int.spec.ts b/test/joins/int.spec.ts index cb1932bb8e9..94a1608d22b 100644 --- a/test/joins/int.spec.ts +++ b/test/joins/int.spec.ts @@ -9,7 +9,7 @@ import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { Category, Config, DepthJoins1, DepthJoins3, Post, Singular } from './payload-types.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { categoriesJoinRestrictedSlug, diff --git a/test/kv/int.spec.ts b/test/kv/int.spec.ts index 5023ebaacfc..33e76c5eaa8 100644 --- a/test/kv/int.spec.ts +++ b/test/kv/int.spec.ts @@ -6,7 +6,7 @@ import { inMemoryKVAdapter } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload diff --git a/test/lexical-mdx/int.spec.ts b/test/lexical-mdx/int.spec.ts index 59ac6ed0d8f..052730ba362 100644 --- a/test/lexical-mdx/int.spec.ts +++ b/test/lexical-mdx/int.spec.ts @@ -12,7 +12,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { postsSlug } from './collections/Posts/index.js' import { editorJSONToMDX, mdxToEditorJSON } from './mdx/hooks.js' import { codeTest1 } from './tests/code1.test.js' diff --git a/test/lexical/benchmarks/perf.spec.ts b/test/lexical/benchmarks/perf.spec.ts index c270400d96f..e1b449e7d02 100644 --- a/test/lexical/benchmarks/perf.spec.ts +++ b/test/lexical/benchmarks/perf.spec.ts @@ -7,9 +7,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../__helpers/shared/sdk/index.js' import type { Config } from '../payload-types.js' -import { ensureCompilationIsDone } from '../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../playwright.config.js' import { LexicalHelpers } from '../collections/utils.js' import { lexicalBenchmarkSlug } from '../slugs.js' @@ -50,8 +50,8 @@ async function setupPerfInstrumentation(page: Page): Promise { } const perfData = { - inputLag: [] as { charIndex: number; lagMs: number }[], domMutationCount: 0, + inputLag: [] as { charIndex: number; lagMs: number }[], longTaskCount: 0, longTaskTotalMs: 0, } @@ -77,10 +77,10 @@ async function setupPerfInstrumentation(page: Page): Promise { }) observer.observe(contentEditable, { + attributes: true, + characterData: true, childList: true, subtree: true, - characterData: true, - attributes: true, }) if ('PerformanceObserver' in window) { @@ -157,10 +157,10 @@ function printSummary(label: string, allMetrics: IterationMetrics[]): void { lines.push(` ${separator}`) const stats: Record number> = { + Max: (v) => Math.max(...v), Mean: mean, - StdDev: stddev, Min: (v) => Math.min(...v), - Max: (v) => Math.max(...v), + StdDev: stddev, } for (const [statLabel, fn] of Object.entries(stats)) { @@ -188,7 +188,7 @@ describe('Lexical Performance Benchmarks', () => { testInfo.setTimeout(TEST_TIMEOUT_LONG) ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) url = new AdminUrlUtil(serverURL, lexicalBenchmarkSlug) - await ensureCompilationIsDone({ serverURL, browser }) + await ensureCompilationIsDone({ browser, serverURL }) }) beforeEach(async ({ browser }) => { diff --git a/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts b/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts index ceb5f7e7666..d8de6db5de4 100644 --- a/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts +++ b/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts @@ -21,7 +21,6 @@ import type { Config, LexicalField, Upload } from '../../../../payload-types.js' import { assertNetworkRequests } from '../../../../../__helpers/e2e/assertNetworkRequests.js' import { - ensureCompilationIsDone, saveDocAndAssert, waitForFormReady, waitForLexicalReady, @@ -64,10 +63,7 @@ describe('lexicalBlocks', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { // await throttleTest({ diff --git a/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts b/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts index f5efad404e2..ae58a39fa44 100644 --- a/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts +++ b/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts @@ -16,7 +16,6 @@ import type { Config, LexicalField } from '../../../../payload-types.js' import { closeAllToasts, - ensureCompilationIsDone, saveDocAndAssert, saveDocHotkeyAndAssert, waitForFormReady, @@ -83,10 +82,7 @@ describe('lexicalMain', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { /*await throttleTest({ diff --git a/test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts b/test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts index 15a3f1c7e2f..9294f66dccd 100644 --- a/test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts +++ b/test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts @@ -5,9 +5,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalAutosaveBlockSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts b/test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts index e110e5d2332..88ffc8068f4 100644 --- a/test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts +++ b/test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts @@ -2,9 +2,9 @@ import { expect, test } from '@playwright/test' import path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalHeadingFeatureSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalJSXConverter/e2e.spec.ts b/test/lexical/collections/LexicalJSXConverter/e2e.spec.ts index 3efade618b1..e0be616cf70 100644 --- a/test/lexical/collections/LexicalJSXConverter/e2e.spec.ts +++ b/test/lexical/collections/LexicalJSXConverter/e2e.spec.ts @@ -5,9 +5,9 @@ import { reInitializeDB } from '__helpers/shared/clearAndSeed/reInitializeDB.js' import path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalJSXConverterSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalLinkFeature/e2e.spec.ts b/test/lexical/collections/LexicalLinkFeature/e2e.spec.ts index 49f84662137..71331b777c8 100644 --- a/test/lexical/collections/LexicalLinkFeature/e2e.spec.ts +++ b/test/lexical/collections/LexicalLinkFeature/e2e.spec.ts @@ -2,9 +2,10 @@ import { expect, test } from '@playwright/test' import path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone, waitForFormReady } from '../../../__helpers/e2e/helpers.js' +import { waitForFormReady } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalLinkFeatureSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' @@ -111,9 +112,9 @@ describe('Lexical Link Feature', () => { new MouseEvent('mouseover', { bubbles: true, cancelable: true, - view: window, clientX: rect.left + rect.width / 2, clientY: rect.top + rect.height / 2, + view: window, }), ) } @@ -179,9 +180,9 @@ describe('Lexical Link Feature', () => { new MouseEvent('mouseover', { bubbles: true, cancelable: true, - view: window, clientX: rect.left + rect.width / 2, clientY: rect.top + rect.height / 2, + view: window, }), ) } @@ -244,9 +245,9 @@ describe('Lexical Link Feature', () => { new MouseEvent('mouseover', { bubbles: true, cancelable: true, - view: window, clientX: rect.left + rect.width / 2, clientY: rect.top + rect.height / 2, + view: window, }), ) } @@ -313,9 +314,9 @@ describe('Lexical Link Feature', () => { new MouseEvent('mouseover', { bubbles: true, cancelable: true, - view: window, clientX: rect.left + rect.width / 2, clientY: rect.top + rect.height / 2, + view: window, }), ) } diff --git a/test/lexical/collections/LexicalListsFeature/e2e.spec.ts b/test/lexical/collections/LexicalListsFeature/e2e.spec.ts index cd8f22c7a81..7e4d27fd8a5 100644 --- a/test/lexical/collections/LexicalListsFeature/e2e.spec.ts +++ b/test/lexical/collections/LexicalListsFeature/e2e.spec.ts @@ -5,9 +5,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalListsFeatureSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts b/test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts index 5ba0e7a0878..445ba85ac59 100644 --- a/test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts +++ b/test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts @@ -5,9 +5,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalSlugFieldNameCollisionSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts b/test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts index 60ffd2a6de8..388014c7a2b 100644 --- a/test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts @@ -7,9 +7,9 @@ import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' import type { LexicalViewsFrontendNodes } from './index.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsFrontendSlug, lexicalViewsSlug } from '../../slugs.js' @@ -165,8 +165,8 @@ describe('Lexical Views', () => { ).toHaveAttribute('data-lexical-view', 'frontend') } finally { await _payload.delete({ - collection: lexicalViewsFrontendSlug, id: doc.id, + collection: lexicalViewsFrontendSlug, }) } }) @@ -242,8 +242,8 @@ describe('Lexical Views', () => { await expect(blockDecorator.locator('.custom-banner-block-component')).toBeVisible() } finally { await _payload.delete({ - collection: lexicalViewsFrontendSlug, id: doc.id, + collection: lexicalViewsFrontendSlug, }) } }) @@ -316,8 +316,8 @@ describe('Lexical Views', () => { await expect(bannerBlock).toHaveAttribute('data-banner-type', 'important') } finally { await _payload.delete({ - collection: lexicalViewsFrontendSlug, id: doc.id, + collection: lexicalViewsFrontendSlug, }) } }) diff --git a/test/lexical/collections/LexicalViewsNested/e2e.spec.ts b/test/lexical/collections/LexicalViewsNested/e2e.spec.ts index 7394f3fd3de..4a85a0c6778 100644 --- a/test/lexical/collections/LexicalViewsNested/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsNested/e2e.spec.ts @@ -5,9 +5,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsNestedSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalViewsProvider/e2e.spec.ts b/test/lexical/collections/LexicalViewsProvider/e2e.spec.ts index 02217778f73..2972302b3a5 100644 --- a/test/lexical/collections/LexicalViewsProvider/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsProvider/e2e.spec.ts @@ -6,9 +6,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsProviderSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' @@ -161,8 +161,8 @@ describe('Lexical Views Provider', () => { await expect(toggleBlockButton).toHaveCount(0) } finally { await _payload.delete({ - collection: lexicalViewsProviderSlug, id: doc.id, + collection: lexicalViewsProviderSlug, }) } }) diff --git a/test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts b/test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts index 51b0a41212e..d28ae4e7cb7 100644 --- a/test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts @@ -5,9 +5,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsProviderDefaultSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalViewsProviderFallback/e2e.spec.ts b/test/lexical/collections/LexicalViewsProviderFallback/e2e.spec.ts index 6cd33904f92..34e8cfebeb7 100644 --- a/test/lexical/collections/LexicalViewsProviderFallback/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsProviderFallback/e2e.spec.ts @@ -5,9 +5,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsProviderFallbackSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/OnDemandForm/e2e.spec.ts b/test/lexical/collections/OnDemandForm/e2e.spec.ts index 924728ccff9..cb66d9d8728 100644 --- a/test/lexical/collections/OnDemandForm/e2e.spec.ts +++ b/test/lexical/collections/OnDemandForm/e2e.spec.ts @@ -3,10 +3,11 @@ import path from 'path' import { wait } from 'payload/shared' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone, saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/_LexicalFullyFeatured/db/e2e.spec.ts b/test/lexical/collections/_LexicalFullyFeatured/db/e2e.spec.ts index 8e01dc7050e..e3a04993e88 100644 --- a/test/lexical/collections/_LexicalFullyFeatured/db/e2e.spec.ts +++ b/test/lexical/collections/_LexicalFullyFeatured/db/e2e.spec.ts @@ -11,10 +11,11 @@ import type { PayloadTestSDK } from '../../../../__helpers/shared/sdk/index.js' import type { Config, InlineBlockWithSelect } from '../../../payload-types.js' import { assertNetworkRequests } from '../../../../__helpers/e2e/assertNetworkRequests.js' -import { ensureCompilationIsDone, saveDocAndAssert } from '../../../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../../playwright.config.js' import { lexicalFullyFeaturedSlug } from '../../../slugs.js' import { LexicalHelpers, type PasteMode } from '../../utils.js' @@ -154,8 +155,8 @@ describe('Lexical Fully Featured - database', () => { await lexical.editor.locator('#field-someText').first().fill('Testing 123') }, { - minimumNumberOfRequests: 2, allowedNumberOfRequests: 3, + minimumNumberOfRequests: 2, }, ) @@ -175,8 +176,8 @@ describe('Lexical Fully Featured - database', () => { await lexical.editor.locator('#field-someText').first().fill('Updated text') }, { - minimumNumberOfRequests: 2, allowedNumberOfRequests: 2, + minimumNumberOfRequests: 2, }, ) await expect(lexical.editor.locator('#field-someText')).toHaveValue('Updated text') @@ -199,27 +200,27 @@ describe('Lexical Fully Featured - database', () => { nodes: [ { type: 'inlineBlock', - version: 1, fields: { - blockType: 'inlineBlockWithSelect', id: '1', + blockType: 'inlineBlockWithSelect', }, + version: 1, }, { type: 'inlineBlock', - version: 1, fields: { - blockType: 'inlineBlockWithSelect', id: '2', + blockType: 'inlineBlockWithSelect', }, + version: 1, }, { type: 'inlineBlock', - version: 1, fields: { - blockType: 'inlineBlockWithSelect', id: '3', + blockType: 'inlineBlockWithSelect', }, + version: 1, }, ], }), @@ -238,8 +239,8 @@ describe('Lexical Fully Featured - database', () => { await lexical.editor.first().focus() }, { - minimumNumberOfRequests: 0, allowedNumberOfRequests: 0, + minimumNumberOfRequests: 0, requestFilter: (request) => { // Ensure it's a form state request if (request.method() === 'POST') { @@ -273,8 +274,8 @@ describe('Lexical Fully Featured - database', () => { await blockNameInput.fill('Testing 123') }, { - minimumNumberOfRequests: 2, allowedNumberOfRequests: 3, + minimumNumberOfRequests: 2, }, ) @@ -294,8 +295,8 @@ describe('Lexical Fully Featured - database', () => { await blockNameInput.fill('Updated blockname') }, { - minimumNumberOfRequests: 2, allowedNumberOfRequests: 2, + minimumNumberOfRequests: 2, }, ) await expect(blockNameInput).toHaveValue('Updated blockname') diff --git a/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts b/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts index c3235ce43d9..3478226c3d3 100644 --- a/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts +++ b/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts @@ -5,9 +5,9 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js' import type { Config } from '../../payload-types.js' -import { ensureCompilationIsDone } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' import { lexicalFullyFeaturedSlug } from '../../../lexical/slugs.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/utils.ts b/test/lexical/collections/utils.ts index f2c17627b11..fd69bf96115 100644 --- a/test/lexical/collections/utils.ts +++ b/test/lexical/collections/utils.ts @@ -5,7 +5,7 @@ import fs from 'fs' import path from 'path' import { wait } from 'payload/shared' -import { patchPageGoToWithHydrationMarker } from '../../__setup/patchPageGoToWithHydrationMarker.js' +import { patchPageMethods } from '../../__setup/patchPageMethods.js' export type PasteMode = 'blob' | 'html' @@ -36,7 +36,7 @@ export class LexicalHelpers { page: Page constructor(page: Page) { this.page = page - patchPageGoToWithHydrationMarker(page) + patchPageMethods(page) } async addLine( diff --git a/test/lexical/lexical.int.spec.ts b/test/lexical/lexical.int.spec.ts index 7816718e951..e436641528b 100644 --- a/test/lexical/lexical.int.spec.ts +++ b/test/lexical/lexical.int.spec.ts @@ -48,7 +48,7 @@ import { // Diff converter import { LinkDiffHTMLConverterAsync } from '../../packages/richtext-lexical/src/field/Diff/converters/link.js' import { it } from '../__helpers/int/vitest.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { devUser } from '../credentials.js' import { lexicalDocData } from './collections/Lexical/data.js' diff --git a/test/live-preview/e2e.spec.ts b/test/live-preview/e2e.spec.ts index edf6fda3483..31e4be177ca 100644 --- a/test/live-preview/e2e.spec.ts +++ b/test/live-preview/e2e.spec.ts @@ -9,7 +9,6 @@ import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' import { - ensureCompilationIsDone, saveDocAndAssert, // throttleTest, } from '../__helpers/e2e/helpers.js' @@ -29,6 +28,7 @@ import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSav import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -81,9 +81,7 @@ describe('Live Preview', () => { ssrAutosavePagesURLUtil = new AdminUrlUtil(serverURL, ssrAutosavePagesSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) user = await payload .login({ @@ -667,13 +665,12 @@ describe('Live Preview', () => { await expect(frame.locator(renderedPageTitleLocator)).toHaveText('For Testing: SSR Home') const newTitleValue = 'SSR Home (Edited)' - + await wait(1000) await titleField.clear() await titleField.pressSequentially(newTitleValue) - await wait(1000) await waitForAutoSaveToRunAndComplete(page) diff --git a/test/live-preview/int.spec.ts b/test/live-preview/int.spec.ts index 0c25a284c52..1d12ad48a06 100644 --- a/test/live-preview/int.spec.ts +++ b/test/live-preview/int.spec.ts @@ -23,7 +23,7 @@ let restClient: NextRESTClient import type { CollectionPopulationRequestHandler } from '../../packages/live-preview/src/types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' const requestHandler: CollectionPopulationRequestHandler = ({ data, endpoint }) => { const url = `/${endpoint}` diff --git a/test/localization/e2e.spec.ts b/test/localization/e2e.spec.ts index 61c60f7be4d..81cb19ba1b9 100644 --- a/test/localization/e2e.spec.ts +++ b/test/localization/e2e.spec.ts @@ -15,7 +15,6 @@ import { changeLocale, closeAllToasts, closeLocaleSelector, - ensureCompilationIsDone, findTableRow, openLocaleSelector, saveDocAndAssert, @@ -109,9 +108,7 @@ describe('Localization', () => { urlLocaleRestricted = new AdminUrlUtil(serverURL, localeRestrictedSlug) context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) client = new RESTClient({ defaultSlug: 'users', serverURL }) await client.login() @@ -786,7 +783,7 @@ describe('Localization', () => { locale: 'all', where: { id: { equals: docID } }, }) - + expect(doc.docs).toHaveLength(1) }) }) diff --git a/test/localization/int.spec.ts b/test/localization/int.spec.ts index 487ec51e490..8da3c488790 100644 --- a/test/localization/int.spec.ts +++ b/test/localization/int.spec.ts @@ -20,7 +20,7 @@ import { devUser } from '../credentials.js' // eslint-disable-next-line payload/no-relative-monorepo-imports import { copyDataFromLocaleHandler } from '../../packages/ui/src/utilities/copyDataFromLocale.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { arrayCollectionSlug } from './collections/Array/index.js' import { groupSlug } from './collections/Group/index.js' import { nestedToArrayAndBlockCollectionSlug } from './collections/NestedToArrayAndBlock/index.js' diff --git a/test/localization/localizeStatus.int.spec.ts b/test/localization/localizeStatus.int.spec.ts index 283113f6d19..758b361ac2f 100644 --- a/test/localization/localizeStatus.int.spec.ts +++ b/test/localization/localizeStatus.int.spec.ts @@ -11,7 +11,7 @@ import { wait } from 'payload/shared' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/localization/testMigration.ts b/test/localization/testMigration.ts index 954e1e67b8c..3e8c8a2862f 100755 --- a/test/localization/testMigration.ts +++ b/test/localization/testMigration.ts @@ -17,7 +17,7 @@ import { Types } from 'mongoose' import path from 'path' import { fileURLToPath } from 'url' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/locked-documents/e2e.spec.ts b/test/locked-documents/e2e.spec.ts index 757143f293a..a2f00bc025a 100644 --- a/test/locked-documents/e2e.spec.ts +++ b/test/locked-documents/e2e.spec.ts @@ -21,11 +21,7 @@ import type { } from './payload-types.js' import { goToNextPage } from '../__helpers/e2e/goToNextPage.js' -import { - ensureCompilationIsDone, - exactText, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { exactText, saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { getSelectMenu } from '../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' @@ -67,10 +63,7 @@ describe('Locked Documents', () => { autosaveUrl = new AdminUrlUtil(serverURL, 'autosave') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) beforeEach(async () => { @@ -89,7 +82,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - await wait(500) const lockedDocs = await payload.find({ @@ -193,7 +185,7 @@ describe('Locked Documents', () => { await page.goto(testsUrl.list) // Need to wait for lock duration to expire (lockDuration: 5 seconds) - + await wait(5000) await page.reload() @@ -405,7 +397,6 @@ describe('Locked Documents', () => { await expect(page.locator('.table .row-2 .locked svg.icon--lock')).toBeVisible() await expect(page.locator('.table .row-3 .locked svg.icon--lock')).toBeVisible() - await wait(5000) await page.reload() @@ -425,7 +416,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('some test doc') - await wait(500) const lockedDocs = await payload.find({ @@ -442,7 +432,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - await wait(500) const lockedDocs = await payload.find({ @@ -463,7 +452,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - await wait(500) const lockedDocs = await payload.find({ @@ -479,7 +467,6 @@ describe('Locked Documents', () => { await saveDocAndAssert(page) - await wait(500) const unlockedDocs = await payload.find({ @@ -500,7 +487,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('testing tab navigation...') - await wait(500) const lockedDocs = await payload.find({ @@ -523,7 +509,6 @@ describe('Locked Documents', () => { // Click the "Leave anyway" button await page.locator('#leave-without-saving .dialog__footer .btn--style-primary').click() - await wait(500) const unlockedDocs = await payload.find({ @@ -551,7 +536,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - await wait(1000) const lockedDocs = await payload.find({ @@ -574,7 +558,6 @@ describe('Locked Documents', () => { // Click the "Leave anyway" button await page.locator('#leave-without-saving .dialog__footer .btn--style-primary').click() - await wait(500) expect(page.url()).toContain(postsUrl.list) @@ -697,7 +680,6 @@ describe('Locked Documents', () => { test('should show Document Locked modal for incoming user when entering locked document', async () => { await page.goto(postsUrl.list) - await wait(500) await page.goto(postsUrl.edit(postDoc.id)) @@ -714,7 +696,6 @@ describe('Locked Documents', () => { test('should properly close modal and allow re-opening after clicking Go Back', async () => { await page.goto(postsUrl.list) - await wait(500) // First time: navigate to locked document @@ -744,7 +725,7 @@ describe('Locked Documents', () => { await page.goto(testsUrl.list) // Need to wait for lock duration to expire (lockDuration: 5 seconds) - + await wait(5000) await page.reload() @@ -886,7 +867,6 @@ describe('Locked Documents', () => { // Click take-over button to take over editing rights of locked doc await page.locator('#document-locked-confirm').click() - await wait(1000) const lockedDoc = await payload.find({ @@ -898,7 +878,6 @@ describe('Locked Documents', () => { }, }) - await wait(500) expect(lockedDoc.docs.length).toBe(1) @@ -998,7 +977,6 @@ describe('Locked Documents', () => { await page.locator('#take-over').click() - await wait(500) const lockedDoc = await payload.find({ @@ -1010,7 +988,6 @@ describe('Locked Documents', () => { }, }) - await wait(500) expect(lockedDoc.docs.length).toBe(1) @@ -1041,7 +1018,6 @@ describe('Locked Documents', () => { await page.locator('#take-over').click() - await wait(500) await expect(page.locator('#field-customTextServer')).toBeEnabled() @@ -1079,7 +1055,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - await wait(500) // Retrieve document id from payload locks collection @@ -1092,7 +1067,6 @@ describe('Locked Documents', () => { }, }) - await wait(500) // Update payload-locks collection document with different user @@ -1107,7 +1081,6 @@ describe('Locked Documents', () => { }, }) - await wait(1000) // Try to edit the document again as the "old" user @@ -1129,7 +1102,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - await wait(500) // Retrieve document id from payload locks collection @@ -1142,7 +1114,6 @@ describe('Locked Documents', () => { }, }) - await wait(500) // Update payload-locks collection document with different user @@ -1157,7 +1128,6 @@ describe('Locked Documents', () => { }, }) - await wait(1000) // Try to edit the document again as the "old" user @@ -1184,7 +1154,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-text') await textInput.fill('hello world') - await wait(500) // Retrieve document id from payload locks collection @@ -1197,7 +1166,6 @@ describe('Locked Documents', () => { }, }) - await wait(500) // Update payload-locks collection document with different user @@ -1212,7 +1180,6 @@ describe('Locked Documents', () => { }, }) - await wait(500) // Try to edit the document again as the "old" user @@ -1239,7 +1206,6 @@ describe('Locked Documents', () => { const textInput = page.locator('#field-customTextServer') await textInput.fill('hello world') - await wait(500) // Retrieve document id from payload locks collection @@ -1252,7 +1218,6 @@ describe('Locked Documents', () => { }, }) - await wait(500) // Update payload-locks collection document with different user @@ -1267,7 +1232,6 @@ describe('Locked Documents', () => { }, }) - await wait(500) // Try to edit the document again as the "old" user @@ -1339,7 +1303,6 @@ describe('Locked Documents', () => { collection: lockedDocumentCollection, }) - await wait(500) await page.goto(postsUrl.admin) @@ -1373,7 +1336,7 @@ describe('Locked Documents', () => { ).toBeVisible() // Need to wait for lock duration to expire (lockDuration: 10 seconds) - + await wait(10000) await page.reload() @@ -1406,7 +1369,7 @@ describe('Locked Documents', () => { ).toBeVisible() // Need to wait for lock duration to expire (lockDuration: 10 seconds) - + await wait(10000) await page.reload() @@ -1473,14 +1436,12 @@ describe('Locked Documents', () => { await user1FieldA.fill('User 1 Change') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit (should trigger stale data check) const user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('User 2 Change') - await wait(500) // Stale data modal should appear for user 2 @@ -1501,20 +1462,17 @@ describe('Locked Documents', () => { await user1FieldA.fill('User 1 Updated Value') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit const user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Should be discarded') - await wait(500) // User 2 clicks reload button in modal await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) const modalContainer = user2Page.locator('.payload__modal-container') @@ -1534,14 +1492,12 @@ describe('Locked Documents', () => { await user1FieldA.fill('Cycle 1 - User 1') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit and sees modal let user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Cycle 1 - User 2 attempt') - await wait(500) let modalContainer = user2Page.locator('.payload__modal-container') @@ -1550,7 +1506,6 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 2: User 2 now saves @@ -1558,14 +1513,12 @@ describe('Locked Documents', () => { await user2FieldA.fill('Cycle 2 - User 2') await saveDocAndAssert(user2Page) - await wait(500) // User 1 tries to edit and should see modal again user1FieldA = page.locator('#field-fieldA') await user1FieldA.fill('Cycle 2 - User 1 attempt') - await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -1574,7 +1527,6 @@ describe('Locked Documents', () => { // User 1 reloads await page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 3: User 1 now saves @@ -1582,14 +1534,12 @@ describe('Locked Documents', () => { await user1FieldA.fill('Cycle 3 - User 1') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit and should see modal again user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Cycle 3 - User 2 attempt') - await wait(500) modalContainer = user2Page.locator('.payload__modal-container') @@ -1598,7 +1548,6 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 4: User 2 now saves @@ -1606,14 +1555,12 @@ describe('Locked Documents', () => { await user2FieldA.fill('Cycle 4 - User 2') await saveDocAndAssert(user2Page) - await wait(500) // User 1 tries to edit and should see modal again user1FieldA = page.locator('#field-fieldA') await user1FieldA.fill('Cycle 4 - User 1 attempt') - await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -1630,14 +1577,12 @@ describe('Locked Documents', () => { await user1FieldA.fill('Cycle 1 - User 1') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit and sees modal let user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Cycle 1 - User 2 attempt') - await wait(500) let modalContainer = user2Page.locator('.payload__modal-container') @@ -1646,7 +1591,6 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 2: User 2 now saves @@ -1654,14 +1598,12 @@ describe('Locked Documents', () => { await user2FieldA.fill('Cycle 2 - User 2') await saveDocAndAssert(user2Page) - await wait(500) // User 1 tries to edit and should see modal again user1FieldA = page.locator('#field-fieldA') await user1FieldA.fill('Cycle 2 - User 1 attempt') - await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -1670,7 +1612,6 @@ describe('Locked Documents', () => { // User 1 reloads await page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 3: User 1 now saves @@ -1678,14 +1619,12 @@ describe('Locked Documents', () => { await user1FieldA.fill('Cycle 3 - User 1') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit and should see modal again user2FieldA = user2Page.locator('#field-fieldA') await user2FieldA.fill('Cycle 3 - User 2 attempt') - await wait(500) modalContainer = user2Page.locator('.payload__modal-container') @@ -1694,7 +1633,6 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 4: User 2 now saves @@ -1702,14 +1640,12 @@ describe('Locked Documents', () => { await user2FieldA.fill('Cycle 4 - User 2') await saveDocAndAssert(user2Page) - await wait(500) // User 1 tries to edit and should see modal again user1FieldA = page.locator('#field-fieldA') await user1FieldA.fill('Cycle 4 - User 1 attempt') - await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -1724,13 +1660,11 @@ describe('Locked Documents', () => { await user1FieldA.fill('My First Change') await page.locator('#action-save-draft').click() - await wait(500) // User 1 edits again (their own save) await user1FieldA.fill('My Second Change') - await wait(500) // Modal should NOT appear @@ -1740,13 +1674,11 @@ describe('Locked Documents', () => { // User 1 saves draft again await page.locator('#action-save-draft').click() - await wait(500) // User 1 edits a third time await user1FieldA.fill('My Third Change') - await wait(500) // Modal should still NOT appear @@ -1780,17 +1712,17 @@ describe('Locked Documents', () => { // Make many rapid edits to create multiple queued autosaves for (let i = 1; i <= 10; i++) { await fieldA.fill(`Edit ${i}`) - + await wait(30) } // Wait for all autosaves to process - + await wait(2000) // Make one more edit to trigger stale data check await fieldA.fill('Final Edit') - + await wait(500) // Modal should NOT appear because it's the same user @@ -1834,7 +1766,7 @@ describe('Locked Documents', () => { await page.route(editUrl, async (route) => { if (route.request().method() === 'POST' && !firstPostDelayed) { firstPostDelayed = true - + await wait(3000) } try { @@ -1857,7 +1789,7 @@ describe('Locked Documents', () => { await expect(page.locator('.payload-toast-container')).toContainText('successfully') await page.unroute(editUrl) - + await wait(4000) await expect(modalContainer).toBeHidden() @@ -1872,7 +1804,6 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Initial Global State') await saveDocAndAssert(page) - await wait(500) // Both users now open the same global @@ -1884,14 +1815,12 @@ describe('Locked Documents', () => { await user1GlobalText.fill('User 1 Global Change') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit (should trigger stale data check) const user2GlobalText = user2Page.locator('#field-globalText') await user2GlobalText.fill('User 2 Global Change') - await wait(500) // Stale data modal should appear for user 2 @@ -1909,7 +1838,6 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Initial Global State') await saveDocAndAssert(page) - await wait(500) // Both users now open the same global @@ -1921,20 +1849,17 @@ describe('Locked Documents', () => { await user1GlobalText.fill('User 1 Updated Global Value') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit const user2GlobalText = user2Page.locator('#field-globalText') await user2GlobalText.fill('Should be discarded') - await wait(500) // User 2 clicks reload button in modal await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) const modalContainer = user2Page.locator('.payload__modal-container') @@ -1951,7 +1876,6 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Initial Global State') await saveDocAndAssert(page) - await wait(500) // Both users now open the same global @@ -1963,14 +1887,12 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Cycle 1 - User 1') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit and sees modal let user2GlobalText = user2Page.locator('#field-globalText') await user2GlobalText.fill('Cycle 1 - User 2 attempt') - await wait(500) let modalContainer = user2Page.locator('.payload__modal-container') @@ -1979,7 +1901,6 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 2: User 2 now saves @@ -1987,14 +1908,12 @@ describe('Locked Documents', () => { await user2GlobalText.fill('Cycle 2 - User 2') await saveDocAndAssert(user2Page) - await wait(500) // User 1 tries to edit and should see modal again user1GlobalText = page.locator('#field-globalText') await user1GlobalText.fill('Cycle 2 - User 1 attempt') - await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -2003,7 +1922,6 @@ describe('Locked Documents', () => { // User 1 reloads await page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 3: User 1 now saves @@ -2011,14 +1929,12 @@ describe('Locked Documents', () => { await user1GlobalText.fill('Cycle 3 - User 1') await saveDocAndAssert(page) - await wait(500) // User 2 tries to edit and should see modal again user2GlobalText = user2Page.locator('#field-globalText') await user2GlobalText.fill('Cycle 3 - User 2 attempt') - await wait(500) modalContainer = user2Page.locator('.payload__modal-container') @@ -2027,7 +1943,6 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 4: User 2 now saves @@ -2035,14 +1950,12 @@ describe('Locked Documents', () => { await user2GlobalText.fill('Cycle 4 - User 2') await saveDocAndAssert(user2Page) - await wait(500) // User 1 tries to edit and should see modal again user1GlobalText = page.locator('#field-globalText') await user1GlobalText.fill('Cycle 4 - User 1 attempt') - await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -2056,7 +1969,6 @@ describe('Locked Documents', () => { await user1TextField.fill('Initial Published Version') await saveDocAndAssert(page) - await wait(500) // Both users now open the same global @@ -2069,20 +1981,17 @@ describe('Locked Documents', () => { const user2TextField = user2Page.locator('#field-text') await expect(user2TextField).toBeVisible() - await wait(500) // User 1 makes a change and saves as draft await user1TextField.fill('User 1 Draft Change') await page.locator('#action-save-draft').click() - await wait(500) // User 2 tries to edit (should trigger stale data check) await user2TextField.fill('User 2 Draft Change') - await wait(500) // Stale data modal should appear for user 2 @@ -2100,7 +2009,6 @@ describe('Locked Documents', () => { await user1TextField.fill('Initial Published Version') await saveDocAndAssert(page) - await wait(500) // Both users now open the same global @@ -2113,20 +2021,17 @@ describe('Locked Documents', () => { let user2TextField = user2Page.locator('#field-text') await expect(user2TextField).toBeVisible() - await wait(500) // Cycle 1: User 1 saves draft await user1TextField.fill('Cycle 1 - User 1') await page.locator('#action-save-draft').click() - await wait(500) // User 2 tries to edit and sees modal await user2TextField.fill('Cycle 1 - User 2 attempt') - await wait(500) let modalContainer = user2Page.locator('.payload__modal-container') @@ -2135,7 +2040,6 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 2: User 2 now saves draft @@ -2143,14 +2047,12 @@ describe('Locked Documents', () => { await user2TextField.fill('Cycle 2 - User 2') await user2Page.locator('#action-save-draft').click() - await wait(500) // User 1 tries to edit and should see modal again user1TextField = page.locator('#field-text') await user1TextField.fill('Cycle 2 - User 1 attempt') - await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -2159,7 +2061,6 @@ describe('Locked Documents', () => { // User 1 reloads await page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 3: User 1 now saves draft @@ -2167,14 +2068,12 @@ describe('Locked Documents', () => { await user1TextField.fill('Cycle 3 - User 1') await page.locator('#action-save-draft').click() - await wait(500) // User 2 tries to edit and should see modal again user2TextField = user2Page.locator('#field-text') await user2TextField.fill('Cycle 3 - User 2 attempt') - await wait(500) modalContainer = user2Page.locator('.payload__modal-container') @@ -2183,7 +2082,6 @@ describe('Locked Documents', () => { // User 2 reloads await user2Page.locator('#document-stale-data-confirm').click() - await wait(500) // Cycle 4: User 2 now saves draft @@ -2191,14 +2089,12 @@ describe('Locked Documents', () => { await user2TextField.fill('Cycle 4 - User 2') await user2Page.locator('#action-save-draft').click() - await wait(500) // User 1 tries to edit and should see modal again user1TextField = page.locator('#field-text') await user1TextField.fill('Cycle 4 - User 1 attempt') - await wait(500) modalContainer = page.locator('.payload__modal-container') @@ -2219,17 +2115,17 @@ describe('Locked Documents', () => { // Make many rapid edits to create multiple queued autosaves for (let i = 1; i <= 10; i++) { await textField.fill(`Edit ${i}`) - + await wait(30) } // Wait for all autosaves to process - + await wait(2000) // Make one more edit to trigger stale data check await textField.fill('Final Edit') - + await wait(500) // Modal should NOT appear because stale check is disabled for autosave-enabled globals diff --git a/test/locked-documents/int.spec.ts b/test/locked-documents/int.spec.ts index b35ff828e5a..77006d2a540 100644 --- a/test/locked-documents/int.spec.ts +++ b/test/locked-documents/int.spec.ts @@ -9,7 +9,7 @@ import { fileURLToPath } from 'url' import type { Post, User } from './payload-types.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { menuSlug } from './globals/Menu/index.js' import { pagesSlug, postsSlug } from './slugs.js' diff --git a/test/login-with-username/int.spec.ts b/test/login-with-username/int.spec.ts index 3c25a2e4a69..f65dcffea1c 100644 --- a/test/login-with-username/int.spec.ts +++ b/test/login-with-username/int.spec.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload diff --git a/test/payload-cloud/int.spec.ts b/test/payload-cloud/int.spec.ts index 34bfbfe8d56..a1cb07e3be0 100644 --- a/test/payload-cloud/int.spec.ts +++ b/test/payload-cloud/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { createStreamableFile } from '../uploads/createStreamableFile.js' const stat = promisify(fs.stat) diff --git a/test/plugin-cloud-storage/e2e.spec.ts b/test/plugin-cloud-storage/e2e.spec.ts index e799cc02d7f..21183e1209d 100644 --- a/test/plugin-cloud-storage/e2e.spec.ts +++ b/test/plugin-cloud-storage/e2e.spec.ts @@ -4,9 +4,10 @@ import { expect, test } from '@playwright/test' import * as path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone, saveDocAndAssert } from '../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { mediaSlug } from './shared.js' diff --git a/test/plugin-cloud-storage/int.compositePrefixes.int.spec.ts b/test/plugin-cloud-storage/int.compositePrefixes.int.spec.ts index 32b8086cc8b..721b10dd2de 100644 --- a/test/plugin-cloud-storage/int.compositePrefixes.int.spec.ts +++ b/test/plugin-cloud-storage/int.compositePrefixes.int.spec.ts @@ -7,7 +7,7 @@ import shelljs from 'shelljs' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { collectionPrefix, mediaWithCompositePrefixesSlug } from './shared.js' import { clearTestBucket, createTestBucket } from './utils.js' diff --git a/test/plugin-cloud-storage/int.spec.ts b/test/plugin-cloud-storage/int.spec.ts index 1d56040d5aa..f8e9cc3394e 100644 --- a/test/plugin-cloud-storage/int.spec.ts +++ b/test/plugin-cloud-storage/int.spec.ts @@ -14,7 +14,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { Config } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { mediaSlug, mediaWithCustomURLSlug, diff --git a/test/plugin-ecommerce/e2e.spec.ts b/test/plugin-ecommerce/e2e.spec.ts index 88c7d559a26..3b73e917d60 100644 --- a/test/plugin-ecommerce/e2e.spec.ts +++ b/test/plugin-ecommerce/e2e.spec.ts @@ -7,12 +7,10 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -45,8 +43,7 @@ test.describe('Ecommerce Plugin', () => { variantsUrl = new AdminUrlUtil(serverURL, 'variants') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) // Create a product with USD and EUR prices const productWithPrice = await payload.create({ diff --git a/test/plugin-ecommerce/int.spec.ts b/test/plugin-ecommerce/int.spec.ts index b1ca613b878..dc7010353e9 100644 --- a/test/plugin-ecommerce/int.spec.ts +++ b/test/plugin-ecommerce/int.spec.ts @@ -5,7 +5,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload let restClient: NextRESTClient diff --git a/test/plugin-form-builder/e2e.spec.ts b/test/plugin-form-builder/e2e.spec.ts index 7113461e756..93db62cf64a 100644 --- a/test/plugin-form-builder/e2e.spec.ts +++ b/test/plugin-form-builder/e2e.spec.ts @@ -8,10 +8,7 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { selectInput } from '../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' @@ -46,9 +43,7 @@ test.describe('Form Builder Plugin', () => { payload = payloadFromInit const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.describe('Forms collection', () => { @@ -632,7 +627,10 @@ test.describe('Form Builder Plugin', () => { }) test('Upload Form: submits with valid image and shows upload result', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) await page.goto(`${serverURL}${uploadFormTestPath}`) const uploadFormSection = page.locator(`[data-testid="form-section-${uploadFormId}"]`) @@ -663,7 +661,10 @@ test.describe('Form Builder Plugin', () => { }) test('Upload Form: submission is visible in admin with submissionUploads image', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) await page.goto(`${serverURL}${uploadFormTestPath}`) const uploadFormSection = page.locator(`[data-testid="form-section-${uploadFormId}"]`) @@ -699,7 +700,10 @@ test.describe('Form Builder Plugin', () => { }) test('Image Upload Form: shows MIME type error when uploading PDF', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) await page.goto(`${serverURL}${uploadFormTestPath}`) const imageFormSection = page.locator(`[data-testid="form-section-${imageFormId}"]`) @@ -713,7 +717,10 @@ test.describe('Form Builder Plugin', () => { }) test('Image Upload Form: accepts valid PNG and shows upload result', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) await page.goto(`${serverURL}${uploadFormTestPath}`) const imageFormSection = page.locator(`[data-testid="form-section-${imageFormId}"]`) @@ -743,7 +750,10 @@ test.describe('Form Builder Plugin', () => { }) test('Multi-File Upload Form: submits two images + one document and shows both collections in result', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) await page.goto(`${serverURL}${uploadFormTestPath}`) const multiFormSection = page.locator(`[data-testid="form-section-${multiFileFormId}"]`) diff --git a/test/plugin-form-builder/int.spec.ts b/test/plugin-form-builder/int.spec.ts index 61e249cf5e3..6d6563cce31 100644 --- a/test/plugin-form-builder/int.spec.ts +++ b/test/plugin-form-builder/int.spec.ts @@ -12,7 +12,7 @@ import { handleUploads } from '../../packages/plugin-form-builder/src/collection import { keyValuePairToHtmlTable } from '../../packages/plugin-form-builder/src/utilities/keyValuePairToHtmlTable.js' import { serializeLexical } from '../../packages/plugin-form-builder/src/utilities/lexical/serializeLexical.js' import { replaceDoubleCurlys } from '../../packages/plugin-form-builder/src/utilities/replaceDoubleCurlys.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { createStreamableFile } from '../uploads/createStreamableFile.js' import { documentsSlug, formsSlug, formSubmissionsSlug, mediaSlug } from './shared.js' diff --git a/test/plugin-import-export/e2e.spec.ts b/test/plugin-import-export/e2e.spec.ts index 319d15bf6cf..f29c0e7189c 100644 --- a/test/plugin-import-export/e2e.spec.ts +++ b/test/plugin-import-export/e2e.spec.ts @@ -12,11 +12,7 @@ const __dirname = path.dirname(__filename) import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' -import { - ensureCompilationIsDone, - runJobsQueue, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { runJobsQueue, saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { getSelectMenu } from '../__helpers/e2e/selectInput.js' import { setPerPageLimit } from '../__helpers/e2e/setPerPageLimit.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' @@ -59,9 +55,7 @@ test.describe('Import Export Plugin', () => { payload = payloadFromInit const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.describe('Export', () => { @@ -665,7 +659,10 @@ test.describe('Import Export Plugin', () => { }) test('should import a CSV file successfully', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const csvContent = 'title,excerpt\n"E2E Import Test 1","Test excerpt 1"\n"E2E Import Test 2","Test excerpt 2"' const csvPath = path.join(__dirname, 'uploads', 'e2e-test-import.csv') @@ -703,7 +700,10 @@ test.describe('Import Export Plugin', () => { }) test('should import a JSON file successfully', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const jsonContent = JSON.stringify([ { excerpt: 'JSON excerpt 1', title: 'E2E JSON Import 1' }, { excerpt: 'JSON excerpt 2', title: 'E2E JSON Import 2' }, @@ -823,9 +823,12 @@ test.describe('Import Export Plugin', () => { // one-shot native event with no auto-retry. await expect(async () => { await page.setInputFiles('input[type="file"]', csvPath) - await expect(page.locator('#field-filemanager-filename')).toHaveValue('e2e-update-test.csv', { - timeout: 2000, - }) + await expect(page.locator('#field-filemanager-filename')).toHaveValue( + 'e2e-update-test.csv', + { + timeout: 2000, + }, + ) }).toPass({ timeout: POLL_TOPASS_TIMEOUT }) const collectionField = page.locator('#field-collectionSlug') @@ -857,7 +860,10 @@ test.describe('Import Export Plugin', () => { }) test('should import documents as published by default', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const csvContent = 'title,excerpt\n"E2E Published Status Test 1","Test excerpt 1"\n"E2E Published Status Test 2","Test excerpt 2"' const csvPath = path.join(__dirname, 'uploads', 'e2e-published-status-test.csv') @@ -901,7 +907,10 @@ test.describe('Import Export Plugin', () => { }) test('should respect explicit _status column values in CSV', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const csvContent = 'title,excerpt,_status\n"E2E Explicit Draft Test","Draft excerpt","draft"\n"E2E Explicit Published Test","Published excerpt","published"' const csvPath = path.join(__dirname, 'uploads', 'e2e-explicit-status-test.csv') @@ -1077,7 +1086,10 @@ test.describe('Import Export Plugin', () => { test.describe('S3 Storage', () => { test('should import CSV file stored in S3 via jobs queue', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const uniqueId = Date.now() const csvFilename = `s3-e2e-import-${uniqueId}.csv` const csvPath = path.join(__dirname, 'uploads', csvFilename) @@ -1671,7 +1683,10 @@ test.describe('Import Export Plugin', () => { }) test('should import a CSV with foreign column headers through the admin UI', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const csvContent = '"Post Title","Summary","View Count"\n' + '"E2E Foreign A","e2e summary a","11"\n' + diff --git a/test/plugin-import-export/field-hooks.int.spec.ts b/test/plugin-import-export/field-hooks.int.spec.ts index 50393329d76..20f96262d5a 100644 --- a/test/plugin-import-export/field-hooks.int.spec.ts +++ b/test/plugin-import-export/field-hooks.int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { readCSV, readJSON } from './helpers.js' import { postsWithFieldHooksSlug } from './shared.js' diff --git a/test/plugin-import-export/hooks.int.spec.ts b/test/plugin-import-export/hooks.int.spec.ts index 29ec4eb2243..e2d9e87716b 100644 --- a/test/plugin-import-export/hooks.int.spec.ts +++ b/test/plugin-import-export/hooks.int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { readCSV, readJSON } from './helpers.js' import { hookCalls, resetHookSpies } from './hookSpies.js' diff --git a/test/plugin-import-export/int.spec.ts b/test/plugin-import-export/int.spec.ts index 97ab2f1348d..82e9d729c5f 100644 --- a/test/plugin-import-export/int.spec.ts +++ b/test/plugin-import-export/int.spec.ts @@ -9,7 +9,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser, regularUser } from '../credentials.js' import { clearTestBucket, createTestBucket } from '../storage-s3/test-utils.js' import { readCSV, readJSON } from './helpers.js' diff --git a/test/plugin-mcp/e2e.spec.ts b/test/plugin-mcp/e2e.spec.ts index af763119d40..09a3317665e 100644 --- a/test/plugin-mcp/e2e.spec.ts +++ b/test/plugin-mcp/e2e.spec.ts @@ -5,7 +5,6 @@ import { randomUUID } from 'crypto' import path from 'path' import { fileURLToPath } from 'url' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' import { devUser } from '../credentials.js' @@ -26,9 +25,7 @@ test.describe('MCP Plugin', () => { serverURL = serverFromInit const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) // Login as dev user to get a JWT token for API key creation const loginRes = await request.post(`${serverURL}/api/users/login`, { diff --git a/test/plugin-mcp/helpers/mcpFixtures.ts b/test/plugin-mcp/helpers/mcpFixtures.ts index 905292b6028..55e5103826d 100644 --- a/test/plugin-mcp/helpers/mcpFixtures.ts +++ b/test/plugin-mcp/helpers/mcpFixtures.ts @@ -10,7 +10,7 @@ import type { TestRBAC } from '../../__helpers/plugins/rbac/index.js' import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' import type { McpClient } from './mcpClient.js' -import { initPayloadInt } from '../../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/initPayloadInt.js' import { devUser } from '../../credentials.js' import { createMcpClient } from './mcpClient.js' diff --git a/test/plugin-multi-tenant/e2e.spec.ts b/test/plugin-multi-tenant/e2e.spec.ts index 894908cb668..4eb7600ea9a 100644 --- a/test/plugin-multi-tenant/e2e.spec.ts +++ b/test/plugin-multi-tenant/e2e.spec.ts @@ -11,12 +11,7 @@ import type { Config } from './payload-types.js' import { loginClientSide } from '../__helpers/e2e/auth/login.js' import { openRelationshipFieldDrawer } from '../__helpers/e2e/fields/relationship/openRelationshipFieldDrawer.js' import { goToListDoc } from '../__helpers/e2e/goToListDoc.js' -import { - changeLocale, - ensureCompilationIsDone, - saveDocAndAssert, - waitForFormReady, -} from '../__helpers/e2e/helpers.js' +import { changeLocale, saveDocAndAssert, waitForFormReady } from '../__helpers/e2e/helpers.js' import { clearSelectInput, getSelectInputOptions, @@ -73,9 +68,7 @@ test.describe('Multi Tenant', () => { autosaveGlobalURL = new AdminUrlUtil(serverURL, autosaveGlobalSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) + ;({ page } = await initPage({ context, noAutoLogin: true, serverURL })) }) test.beforeEach(async () => { diff --git a/test/plugin-multi-tenant/int.spec.ts b/test/plugin-multi-tenant/int.spec.ts index 3808f307f04..5f0d7fd5e07 100644 --- a/test/plugin-multi-tenant/int.spec.ts +++ b/test/plugin-multi-tenant/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { Relationship } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { menuSlug, diff --git a/test/plugin-nested-docs/e2e.spec.ts b/test/plugin-nested-docs/e2e.spec.ts index 593b04bb86c..c50165ed7a9 100644 --- a/test/plugin-nested-docs/e2e.spec.ts +++ b/test/plugin-nested-docs/e2e.spec.ts @@ -6,7 +6,6 @@ import { fileURLToPath } from 'url' import type { Config, Page as PayloadPage } from './payload-types.js' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' @@ -29,9 +28,7 @@ describe('Nested Docs Plugin', () => { const { payload, serverURL } = await initPayloadE2ENoConfig({ dirname }) url = new AdminUrlUtil(serverURL, 'pages') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) async function createPage({ slug, diff --git a/test/plugin-nested-docs/int.spec.ts b/test/plugin-nested-docs/int.spec.ts index 3d7661eb224..0705b942c1c 100644 --- a/test/plugin-nested-docs/int.spec.ts +++ b/test/plugin-nested-docs/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { Page } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload diff --git a/test/plugin-redirects/e2e.spec.ts b/test/plugin-redirects/e2e.spec.ts index 82726dfe752..f2244400ea6 100644 --- a/test/plugin-redirects/e2e.spec.ts +++ b/test/plugin-redirects/e2e.spec.ts @@ -7,10 +7,7 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' -import { - ensureCompilationIsDone, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' @@ -36,9 +33,7 @@ test.describe('Redirects Plugin', () => { payload = payloadFromInit const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.describe('Redirects collection', () => { diff --git a/test/plugin-redirects/int.spec.ts b/test/plugin-redirects/int.spec.ts index 481c9f5e2fd..975f2669f8e 100644 --- a/test/plugin-redirects/int.spec.ts +++ b/test/plugin-redirects/int.spec.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'url' import type { Page } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { pagesSlug } from './shared.js' let payload: Payload diff --git a/test/plugin-search/int.spec.ts b/test/plugin-search/int.spec.ts index 2f614517db0..ded49508dfe 100644 --- a/test/plugin-search/int.spec.ts +++ b/test/plugin-search/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { pagesSlug, postsSlug } from './shared.js' diff --git a/test/plugin-sentry/int.spec.ts b/test/plugin-sentry/int.spec.ts index 1d4c4894ddc..33c9a2dbb97 100644 --- a/test/plugin-sentry/int.spec.ts +++ b/test/plugin-sentry/int.spec.ts @@ -4,7 +4,7 @@ import { describe, beforeAll, afterAll, it } from 'vitest' import path from 'path' import { fileURLToPath } from 'url' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload diff --git a/test/plugin-seo/e2e.spec.ts b/test/plugin-seo/e2e.spec.ts index 50d767ceb7c..0b0b4f40979 100644 --- a/test/plugin-seo/e2e.spec.ts +++ b/test/plugin-seo/e2e.spec.ts @@ -9,14 +9,11 @@ import { fileURLToPath } from 'url' import type { Config, Page as PayloadPage } from './payload-types.js' import { checkFocusIndicators } from '../__helpers/e2e/checkFocusIndicators.js' -import { - ensureCompilationIsDone, - switchTab, - waitForFormReady, -} from '../__helpers/e2e/helpers.js' +import { switchTab, waitForFormReady } from '../__helpers/e2e/helpers.js' import { runAxeScan } from '../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { mediaSlug } from './shared.js' @@ -41,8 +38,7 @@ describe('SEO Plugin', () => { url = new AdminUrlUtil(serverURL, 'pages') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) const filePath = path.resolve(dirname, './image-1.jpg') const file = await getFileByPath(filePath) diff --git a/test/plugin-seo/int.spec.ts b/test/plugin-seo/int.spec.ts index 4b819bee42b..1b59639d952 100644 --- a/test/plugin-seo/int.spec.ts +++ b/test/plugin-seo/int.spec.ts @@ -5,7 +5,7 @@ import { getFileByPath } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { removeFiles } from '../__helpers/shared/removeFiles.js' import { mediaSlug } from './shared.js' diff --git a/test/plugin-stripe/int.spec.ts b/test/plugin-stripe/int.spec.ts index 50e3adb2a63..d4bd8afd6e2 100644 --- a/test/plugin-stripe/int.spec.ts +++ b/test/plugin-stripe/int.spec.ts @@ -4,7 +4,7 @@ import { describe, beforeAll, afterAll, it, expect } from 'vitest' import path from 'path' import { fileURLToPath } from 'url' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload diff --git a/test/plugins/int.spec.ts b/test/plugins/int.spec.ts index 78597b5e774..72ecf4661e3 100644 --- a/test/plugins/int.spec.ts +++ b/test/plugins/int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { ReaderPluginOptions } from './config.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { pagesSlug } from './config.js' let payload: Payload diff --git a/test/query-presets/e2e.spec.ts b/test/query-presets/e2e.spec.ts index 5f33fd16fef..236db450843 100644 --- a/test/query-presets/e2e.spec.ts +++ b/test/query-presets/e2e.spec.ts @@ -9,16 +9,13 @@ import type { Config, PayloadQueryPreset } from './payload-types.js' import { clickColumnSelectorItem, toggleColumn } from '../__helpers/e2e/columns/index.js' import { addListFilter, openListFilters } from '../__helpers/e2e/filters/index.js' import { addGroupBy, clearGroupBy } from '../__helpers/e2e/groupBy/index.js' -import { - ensureCompilationIsDone, - exactText, - saveDocAndAssert, -} from '../__helpers/e2e/helpers.js' +import { exactText, saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { navigateToListView } from '../__helpers/e2e/navigateToListView.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { assertURLParams } from './helpers/assertURLParams.js' @@ -57,20 +54,16 @@ describe('Query Presets', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) pagesUrl = new AdminUrlUtil(serverURL, pagesSlug) - - await ensureCompilationIsDone({ browser, serverURL }) }) beforeEach(async ({ page }) => { - await initPage({ page }) + await initPage({ page, serverURL }) await reInitializeDB({ serverURL, snapshotKey: 'querypresets', }) - await ensureCompilationIsDone({ page, serverURL }) - const allDocs = ( await payload.find({ collection: 'payload-query-presets', diff --git a/test/query-presets/int.spec.ts b/test/query-presets/int.spec.ts index dbb6166b8e1..e01a81080d6 100644 --- a/test/query-presets/int.spec.ts +++ b/test/query-presets/int.spec.ts @@ -5,7 +5,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { devUser, regularUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' const queryPresetsCollectionSlug = 'payload-query-presets' diff --git a/test/queues/cli.int.spec.ts b/test/queues/cli.int.spec.ts index a11865a46aa..786f3e58c27 100644 --- a/test/queues/cli.int.spec.ts +++ b/test/queues/cli.int.spec.ts @@ -10,7 +10,7 @@ import { wait } from 'payload/shared' import { fileURLToPath } from 'url' import { beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { waitUntilAutorunIsDone } from './utilities.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/queues/e2e.spec.ts b/test/queues/e2e.spec.ts index 5f392852f7d..0d0228af95b 100644 --- a/test/queues/e2e.spec.ts +++ b/test/queues/e2e.spec.ts @@ -8,7 +8,6 @@ import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' import { login } from '../__helpers/e2e/auth/login.js' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -30,12 +29,11 @@ describe('Queues', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) const context = await browser.newContext() - ;({ page } = await initPage({ context })) + ;({ page } = await initPage({ context, noAutoLogin: true, serverURL })) // This suite logs in explicitly (no auto-login), so `/admin` redirects to // `/admin/login`. Pass `noAutoLogin` so the compilation poll waits for the // login URL instead of the dashboard URL that never loads — otherwise it // loops until the beforeAll times out on TanStack (server-side 307 redirect). - await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) await login({ page, serverURL }) diff --git a/test/queues/int.spec.ts b/test/queues/int.spec.ts index 120e2eb14cc..17c2472f5f9 100644 --- a/test/queues/int.spec.ts +++ b/test/queues/int.spec.ts @@ -16,7 +16,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect } from 'vi import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { it } from '../__helpers/int/vitest.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { clearAndSeedEverything } from './seed.js' import { waitUntilAutorunIsDone } from './utilities.js' diff --git a/test/queues/postgres-logs.int.spec.ts b/test/queues/postgres-logs.int.spec.ts index ec8bdd14e96..88631018d89 100644 --- a/test/queues/postgres-logs.int.spec.ts +++ b/test/queues/postgres-logs.int.spec.ts @@ -5,7 +5,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it, vitest } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { withoutAutoRun } from './utilities.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/queues/schedules-autocron.int.spec.ts b/test/queues/schedules-autocron.int.spec.ts index 2962a26fb99..d5fa2ced9ee 100644 --- a/test/queues/schedules-autocron.int.spec.ts +++ b/test/queues/schedules-autocron.int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { clearAndSeedEverything } from './seed.js' let payload: Payload diff --git a/test/queues/schedules.int.spec.ts b/test/queues/schedules.int.spec.ts index 646f561ce2a..483f15a546b 100644 --- a/test/queues/schedules.int.spec.ts +++ b/test/queues/schedules.int.spec.ts @@ -7,7 +7,7 @@ import { fileURLToPath } from 'url' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { clearAndSeedEverything } from './seed.js' import { timeFreeze, timeTravel, waitUntilAutorunIsDone, withoutAutoRun } from './utilities.js' diff --git a/test/relationships/int.spec.ts b/test/relationships/int.spec.ts index a446538e14f..8f7babdd160 100644 --- a/test/relationships/int.spec.ts +++ b/test/relationships/int.spec.ts @@ -17,7 +17,7 @@ import type { Relation, } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { mongooseList } from '../__helpers/shared/isMongoose.js' import { chainedRelSlug, diff --git a/test/sdk/int.spec.ts b/test/sdk/int.spec.ts index cd1518cb983..bda26047cf0 100644 --- a/test/sdk/int.spec.ts +++ b/test/sdk/int.spec.ts @@ -9,7 +9,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { TypedPayloadSDK } from '../__helpers/shared/getSDK.js' import type { Email, Post } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { createStreamableFile } from '../uploads/createStreamableFile.js' import { emailsSlug } from './collections/Emails.js' diff --git a/test/select/int.spec.ts b/test/select/int.spec.ts index d3e405ed155..cc52d244660 100644 --- a/test/select/int.spec.ts +++ b/test/select/int.spec.ts @@ -19,7 +19,7 @@ import type { VersionedPost, } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' let payload: Payload diff --git a/test/select/postgreslogs.int.spec.ts b/test/select/postgreslogs.int.spec.ts index a17fa574be8..c9745f722cc 100644 --- a/test/select/postgreslogs.int.spec.ts +++ b/test/select/postgreslogs.int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vites import type { Point, Post } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' let payload: Payload diff --git a/test/server-functions/e2e.spec.ts b/test/server-functions/e2e.spec.ts index a9b9cecca42..bc4c3504b2c 100644 --- a/test/server-functions/e2e.spec.ts +++ b/test/server-functions/e2e.spec.ts @@ -8,10 +8,7 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' -import { - ensureCompilationIsDone, - getRoutes, -} from '../__helpers/e2e/helpers.js' +import { getRoutes } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' @@ -42,13 +39,7 @@ describe('Server Functions', () => { adminRoute = adminRouteFromConfig const context = await browser.newContext() - ;({ page } = await initPage({ context })) - - await ensureCompilationIsDone({ - noAutoLogin: true, - page, - serverURL, - }) + ;({ page } = await initPage({ context, noAutoLogin: true, serverURL })) }) describe('Auth functions', () => { diff --git a/test/server-url/e2e.spec.ts b/test/server-url/e2e.spec.ts index 73c5180250d..5ce89a77a40 100644 --- a/test/server-url/e2e.spec.ts +++ b/test/server-url/e2e.spec.ts @@ -6,7 +6,6 @@ import { fileURLToPath } from 'url' import { login } from '../__helpers/e2e/auth/login.js' import { logoutViaNav } from '../__helpers/e2e/auth/logout.js' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { initPage } from '../__setup/initPage.js' @@ -26,8 +25,7 @@ test.describe('serverURL', () => { url = new AdminUrlUtil(serverURL, 'posts') const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ noAutoLogin: true, page, serverURL }) + ;({ page } = await initPage({ context, noAutoLogin: true, serverURL })) }) test('can load admin panel', async () => { diff --git a/test/sort/e2e.spec.ts b/test/sort/e2e.spec.ts index 84eb2826e24..f9ef7102a10 100644 --- a/test/sort/e2e.spec.ts +++ b/test/sort/e2e.spec.ts @@ -8,10 +8,8 @@ import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config } from './payload-types.js' import { goToListDoc } from '../__helpers/e2e/goToListDoc.js' -import { - ensureCompilationIsDone, - // throttleTest -} from '../__helpers/e2e/helpers.js' +import {} from // throttleTest +'../__helpers/e2e/helpers.js' import { scrollEntirePage } from '../__helpers/e2e/scrollEntirePage.js' import { moveRow } from '../__helpers/e2e/sort/moveRow.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' @@ -39,13 +37,11 @@ describe('Sort functionality', () => { ;({ payload, serverURL } = await initPayloadE2ENoConfig({ dirname })) context = await browser.newContext() - ;({ page } = await initPage({ context })) - + ;({ page } = await initPage({ context, serverURL })) // Wait for the server to be ready before the node-side REST login: on the // slower TanStack prod cold-start, `client.login()` (a direct fetch, no retry) // can hit the server before it accepts connections → `TypeError: fetch failed`. - await ensureCompilationIsDone({ page, serverURL }) client = new RESTClient({ defaultSlug: 'users', serverURL }) await client.login() diff --git a/test/sort/int.spec.ts b/test/sort/int.spec.ts index 3e3a3cf2366..caef7fe6637 100644 --- a/test/sort/int.spec.ts +++ b/test/sort/int.spec.ts @@ -8,7 +8,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { Draft, Orderable, OrderableJoin } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { draftsSlug } from './collections/Drafts/index.js' import { nonUniqueSortSlug } from './collections/NonUniqueSort/index.js' import { orderableSlug } from './collections/Orderable/index.js' diff --git a/test/storage-azure/client-uploads/e2e.spec.ts b/test/storage-azure/client-uploads/e2e.spec.ts index 0b40f9136ee..c19f5dc5692 100644 --- a/test/storage-azure/client-uploads/e2e.spec.ts +++ b/test/storage-azure/client-uploads/e2e.spec.ts @@ -9,9 +9,10 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../../__helpers/shared/sdk/index.js' -import { ensureCompilationIsDone, saveDocAndAssert } from '../../__helpers/e2e/helpers.js' +import { saveDocAndAssert } from '../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../playwright.config.js' import { mediaWithDocPrefixSlug } from './collections/MediaWithDocPrefix.js' @@ -69,7 +70,10 @@ test.describe('storage-azure client uploads E2E', () => { * the plugin no longer clobbers the user's callback (see getFields.ts). */ test('respects user-defined prefix.defaultValue when creating a doc via clientUploads', async () => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) await page.goto(mediaWithDocPrefixURL.create) await page.setInputFiles('input[type="file"]', path.resolve(dirname, '../../uploads/image.png')) await saveDocAndAssert(page) diff --git a/test/storage-azure/client-uploads/int.spec.ts b/test/storage-azure/client-uploads/int.spec.ts index 54f9bcb454a..4230b7ac172 100644 --- a/test/storage-azure/client-uploads/int.spec.ts +++ b/test/storage-azure/client-uploads/int.spec.ts @@ -9,7 +9,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/initPayloadInt.js' import { mediaSlug } from '../shared.js' import { mediaWithDocPrefixSlug } from './collections/MediaWithDocPrefix.js' diff --git a/test/storage-azure/int.spec.ts b/test/storage-azure/int.spec.ts index ce97e7c091b..918742ef7e0 100644 --- a/test/storage-azure/int.spec.ts +++ b/test/storage-azure/int.spec.ts @@ -9,7 +9,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { mediaSlug, mediaWithPrefixSlug, prefix } from './shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/storage-azure/streamingUploads.int.spec.ts b/test/storage-azure/streamingUploads.int.spec.ts index f3b4b1891e8..48df903dc20 100644 --- a/test/storage-azure/streamingUploads.int.spec.ts +++ b/test/storage-azure/streamingUploads.int.spec.ts @@ -9,7 +9,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { mediaSlug, mediaWithPrefixSlug, prefix } from './shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/storage-s3/client-uploads/e2e.spec.ts b/test/storage-s3/client-uploads/e2e.spec.ts index 0a80d565fe2..854d45d6cfb 100644 --- a/test/storage-s3/client-uploads/e2e.spec.ts +++ b/test/storage-s3/client-uploads/e2e.spec.ts @@ -5,14 +5,10 @@ import dotenv from 'dotenv' import * as path from 'path' import { fileURLToPath } from 'url' -import { - ensureCompilationIsDone, - exactText, - gotoAndWaitForForm, - saveDocAndAssert, -} from '../../__helpers/e2e/helpers.js' +import { exactText, gotoAndWaitForForm, saveDocAndAssert } from '../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../playwright.config.js' import { mediaSlug } from '../shared.js' @@ -62,7 +58,10 @@ test.describe('storage-s3 client uploads E2E', () => { }) test('should upload file directly to S3, not through the Payload server', async ({ browser }) => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const context = await browser.newContext() const testPage = await context.newPage() @@ -104,7 +103,10 @@ test.describe('storage-s3 client uploads E2E', () => { test('should bulk upload multiple files directly to S3, not through Payload', async ({ browser, }) => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const context = await browser.newContext() const testPage = await context.newPage() @@ -163,7 +165,10 @@ test.describe('storage-s3 client uploads E2E', () => { test('should bulk upload files from the list view directly to S3, not through Payload', async ({ browser, }) => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const context = await browser.newContext() const testPage = await context.newPage() diff --git a/test/storage-s3/client-uploads/int.spec.ts b/test/storage-s3/client-uploads/int.spec.ts index 09f5616ff30..0868f4d14cb 100644 --- a/test/storage-s3/client-uploads/int.spec.ts +++ b/test/storage-s3/client-uploads/int.spec.ts @@ -8,7 +8,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/initPayloadInt.js' import { clearTestBucket, createTestBucket, diff --git a/test/storage-s3/int.spec.ts b/test/storage-s3/int.spec.ts index b76ed7a0bb4..1c729dfd3a5 100644 --- a/test/storage-s3/int.spec.ts +++ b/test/storage-s3/int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { mediaSlug, mediaWithAlwaysInsertFieldsSlug, diff --git a/test/storage-s3/searchBeforeS3.int.spec.ts b/test/storage-s3/searchBeforeS3.int.spec.ts index c05eed87b4d..2b468998611 100644 --- a/test/storage-s3/searchBeforeS3.int.spec.ts +++ b/test/storage-s3/searchBeforeS3.int.spec.ts @@ -4,7 +4,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { mediaSlug } from './shared.js' import { clearTestBucket, createTestBucket, verifyUploads } from './test-utils.js' diff --git a/test/storage-vercel-blob/client-uploads/compositePrefixes.int.spec.ts b/test/storage-vercel-blob/client-uploads/compositePrefixes.int.spec.ts index 3eabd545d0d..5e95e2f77ed 100644 --- a/test/storage-vercel-blob/client-uploads/compositePrefixes.int.spec.ts +++ b/test/storage-vercel-blob/client-uploads/compositePrefixes.int.spec.ts @@ -10,7 +10,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/initPayloadInt.js' import { collectionPrefix, mediaWithCompositePrefixesSlug } from '../shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/storage-vercel-blob/client-uploads/e2e.spec.ts b/test/storage-vercel-blob/client-uploads/e2e.spec.ts index 25bc6584d83..0b1215a355c 100644 --- a/test/storage-vercel-blob/client-uploads/e2e.spec.ts +++ b/test/storage-vercel-blob/client-uploads/e2e.spec.ts @@ -5,14 +5,10 @@ import dotenv from 'dotenv' import * as path from 'path' import { fileURLToPath } from 'url' -import { - ensureCompilationIsDone, - exactText, - gotoAndWaitForForm, - saveDocAndAssert, -} from '../../__helpers/e2e/helpers.js' +import { exactText, gotoAndWaitForForm, saveDocAndAssert } from '../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../../__setup/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../playwright.config.js' import { mediaSlug } from '../shared.js' @@ -79,7 +75,10 @@ test.describe('storage-vercel-blob client uploads E2E', () => { test('should upload file directly to Vercel Blob, not through the Payload server', async ({ browser, }) => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const context = await browser.newContext() const testPage = await context.newPage() @@ -121,7 +120,10 @@ test.describe('storage-vercel-blob client uploads E2E', () => { test('should bulk upload multiple files directly to Vercel Blob, not through Payload', async ({ browser, }) => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const context = await browser.newContext() const testPage = await context.newPage() @@ -183,7 +185,10 @@ test.describe('storage-vercel-blob client uploads E2E', () => { test('should bulk upload files from the list view directly to Vercel Blob, not through Payload', async ({ browser, }) => { - test.skip(process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.') + test.skip( + process.env.PAYLOAD_FRAMEWORK === 'tanstack-start', + 'TanStack: known post-hydration RSC view remount detaches the view mid-interaction (see framework adapter notes); re-enable when the TanStack RSC hydration is fixed.', + ) const context = await browser.newContext() const testPage = await context.newPage() diff --git a/test/storage-vercel-blob/client-uploads/int.spec.ts b/test/storage-vercel-blob/client-uploads/int.spec.ts index b4e54fa87ca..bc0cde69a66 100644 --- a/test/storage-vercel-blob/client-uploads/int.spec.ts +++ b/test/storage-vercel-blob/client-uploads/int.spec.ts @@ -10,7 +10,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/initPayloadInt.js' import { prefix } from '../shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/storage-vercel-blob/int.spec.ts b/test/storage-vercel-blob/int.spec.ts index 0439d532324..091624f8793 100644 --- a/test/storage-vercel-blob/int.spec.ts +++ b/test/storage-vercel-blob/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { mediaSlug, mediaWithAlwaysInsertFieldsSlug, diff --git a/test/tags/e2e.spec.ts b/test/tags/e2e.spec.ts index 94451bacdea..915fdfdea95 100644 --- a/test/tags/e2e.spec.ts +++ b/test/tags/e2e.spec.ts @@ -7,7 +7,6 @@ import { fileURLToPath } from 'url' import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config, Tag } from './payload-types.js' -import { ensureCompilationIsDone } from '../__helpers/e2e/helpers.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' @@ -112,8 +111,7 @@ test.describe('Tags', () => { tagsURL = new AdminUrlUtil(serverURL, tagsSlug) const context = await browser.newContext() - ;({ page } = await initPage({ context })) - await ensureCompilationIsDone({ page, serverURL }) + ;({ page } = await initPage({ context, serverURL })) }) test.afterAll(async () => { diff --git a/test/tags/int.spec.ts b/test/tags/int.spec.ts index da3cfc687cd..63a296cc6d1 100644 --- a/test/tags/int.spec.ts +++ b/test/tags/int.spec.ts @@ -6,7 +6,7 @@ import { renderToStaticMarkup } from 'react-dom/server' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/trash/e2e.spec.ts b/test/trash/e2e.spec.ts index 972bb61fd74..9b168b14f89 100644 --- a/test/trash/e2e.spec.ts +++ b/test/trash/e2e.spec.ts @@ -8,14 +8,11 @@ import type { PayloadTestSDK } from '../__helpers/shared/sdk/index.js' import type { Config, Post } from './payload-types.js' import { addListFilter } from '../__helpers/e2e/filters/index.js' -import { - changeLocale, - closeAllToasts, - ensureCompilationIsDone, -} from '../__helpers/e2e/helpers.js' +import { changeLocale, closeAllToasts } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { pagesSlug } from './collections/Pages/index.js' @@ -45,8 +42,6 @@ describe('Trash', () => { postsUrl = new AdminUrlUtil(serverURL, postsSlug) pagesUrl = new AdminUrlUtil(serverURL, pagesSlug) usersUrl = new AdminUrlUtil(serverURL, usersSlug) - - await ensureCompilationIsDone({ browser, serverURL }) }) beforeEach(async ({ context, page }) => { @@ -88,10 +83,8 @@ describe('Trash', () => { }, }) ).docs[0]!.id - await initPage({ page }) + await initPage({ page, serverURL }) //await throttleTest({ page, context, delay: 'Slow 4G' }) - - await ensureCompilationIsDone({ page, serverURL }) }) describe('Collection view', () => { diff --git a/test/trash/int.spec.ts b/test/trash/int.spec.ts index 19d759b4206..7dcd294e498 100644 --- a/test/trash/int.spec.ts +++ b/test/trash/int.spec.ts @@ -8,7 +8,7 @@ import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { DifferentiatedTrashCollection, Post, RestrictedCollection } from './payload-types.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser, regularUser } from '../credentials.js' import { differentiatedTrashCollectionSlug } from './collections/DifferentiatedTrashCollection/index.js' import { pagesSlug } from './collections/Pages/index.js' diff --git a/test/tsconfig.json b/test/tsconfig.json index 6e769d11dd0..23a674f6ddb 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -49,6 +49,8 @@ "./*.tsx", "./__helpers/**/*.ts", "./__helpers/**/*.tsx", + "./__setup/**/*.ts", + "./__setup/**/*.tsx", "./app/**/*.ts", "./app/**/*.tsx", "./evals/**/*.ts", diff --git a/test/uploads/e2e.spec.ts b/test/uploads/e2e.spec.ts index 951e6455714..e7f8b3f3b68 100644 --- a/test/uploads/e2e.spec.ts +++ b/test/uploads/e2e.spec.ts @@ -18,7 +18,6 @@ import { import { openListFilters } from '../__helpers/e2e/filters/index.js' import { closeAllToasts, - ensureCompilationIsDone, exactText, gotoAndWaitForForm, saveDocAndAssert, @@ -32,6 +31,7 @@ import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB. import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' import { startTestFileServer } from '../__helpers/shared/startTestFileServer.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { @@ -183,14 +183,12 @@ describe('Uploads', () => { const context = await browser.newContext() await context.grantPermissions(['clipboard-read', 'clipboard-write']) - const initialized = await initPage({ context, ignoreCORS: true }) + const initialized = await initPage({ context, ignoreCORS: true, serverURL }) page = initialized.page consoleErrorsFromPage = initialized.consoleErrors collectErrorsFromPage = initialized.collectErrors stopCollectingErrorsFromPage = initialized.stopCollectingErrors - - await ensureCompilationIsDone({ page, serverURL }) }) beforeEach(async () => { diff --git a/test/uploads/int.spec.ts b/test/uploads/int.spec.ts index 3cc8e9d024e..0408efb23cb 100644 --- a/test/uploads/int.spec.ts +++ b/test/uploads/int.spec.ts @@ -20,7 +20,7 @@ import { checkFileRestrictions } from '../../packages/payload/src/uploads/checkF import { getExternalFile } from '../../packages/payload/src/uploads/getExternalFile.js' // eslint-disable-next-line payload/no-relative-monorepo-imports import { tempFileHandler } from '../../packages/payload/src/uploads/fetchAPI-multipart/handlers.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { createStreamableFile } from './createStreamableFile.js' import { adminThumbnailSizeSlug, diff --git a/test/uuid-v7/int.spec.ts b/test/uuid-v7/int.spec.ts index c427747bb58..60ff65910f5 100644 --- a/test/uuid-v7/int.spec.ts +++ b/test/uuid-v7/int.spec.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url' import { validate as uuidValidate } from 'uuid' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/versions/e2e.spec.ts b/test/versions/e2e.spec.ts index 679fa9c571e..434e751234d 100644 --- a/test/versions/e2e.spec.ts +++ b/test/versions/e2e.spec.ts @@ -38,7 +38,6 @@ import { assertNetworkRequests } from '../__helpers/e2e/assertNetworkRequests.js import { checkFocusIndicators } from '../__helpers/e2e/checkFocusIndicators.js' import { changeLocale, - ensureCompilationIsDone, exactText, getRoutes, openDocDrawer, @@ -54,6 +53,7 @@ import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSav import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' +import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' import { initPage } from '../__setup/initPage.js' import { postsCollectionSlug } from '../admin/slugs.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' @@ -120,14 +120,12 @@ describe('Versions', () => { 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 initPayloadE2ENoConfig({ dirname })) context = await browser.newContext() - ;({ page } = await initPage({ context })) + ;({ page } = await initPage({ context, serverURL })) const { routes: { admin: adminRouteFromConfig }, } = getRoutes({}) adminRoute = adminRouteFromConfig - - await ensureCompilationIsDone({ page, serverURL }) }) beforeEach(async () => { @@ -1677,10 +1675,8 @@ describe('Versions', () => { }, }) - expect(createdJob).toBeTruthy() - expect(createdJob?.waitUntil).toEqual('2049-01-01T17:00:00.000Z') }) }) diff --git a/test/versions/int.spec.ts b/test/versions/int.spec.ts index 56739fc9c73..123c1e9e535 100644 --- a/test/versions/int.spec.ts +++ b/test/versions/int.spec.ts @@ -12,7 +12,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' import type { AutosaveMultiSelectPost, DraftPost } from './payload-types.js' -import { initPayloadInt } from '../__helpers/shared/initPayloadInt.js' +import { initPayloadInt } from '../__setup/initPayloadInt.js' import { devUser } from '../credentials.js' import { cloudStorageDeletedFilenames } from './collections/DraftsWithUploadCloudStorage.js' import { From 3d217be6884c01bc9f1d1c5692343b9efb818bd3 Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 17:58:32 -0400 Subject: [PATCH 05/16] chore: split test/__setup into e2e and int Separates the page/browser setup used by Playwright specs from the Payload bootstrapping used by vitest specs, so a spec only reaches into the half it needs. `getSDK` and `NextRESTClient` move out of `__helpers/shared` alongside `initPayloadInt`, which is their only non-int consumer. `runInit` stays at the test root, since `dev.ts` shares it and it is not test-specific. --- test/__setup/{ => e2e}/catchConsoleErrors.ts | 0 test/__setup/{ => e2e}/ensureCompilationIsDone.ts | 8 ++++---- test/__setup/{ => e2e}/initPage.ts | 2 +- test/__setup/{ => e2e}/patchPageMethods.ts | 0 test/{__helpers/shared => __setup/int}/NextRESTClient.ts | 0 test/{__helpers/shared => __setup/int}/getSDK.ts | 4 ++-- test/__setup/{ => int}/initPayloadInt.ts | 6 +++--- test/_community/e2e.spec.ts | 2 +- test/_community/int.spec.ts | 4 ++-- test/a11y/e2e.spec.ts | 2 +- test/a11y/focus-indicators.e2e.spec.ts | 2 +- test/access-control/e2e.spec.ts | 2 +- test/access-control/int.spec.ts | 4 ++-- test/access-control/postgres-logs.int.spec.ts | 2 +- test/admin-bar/e2e.spec.ts | 2 +- test/admin-root/e2e.spec.ts | 4 ++-- test/admin-root/int.spec.ts | 4 ++-- test/admin/e2e/command-palette/e2e.spec.ts | 4 ++-- test/admin/e2e/document-view/e2e.spec.ts | 4 ++-- test/admin/e2e/general/e2e.spec.ts | 4 ++-- test/admin/e2e/list-view/e2e.spec.ts | 4 ++-- test/admin/e2e/sidebar-tabs/e2e.spec.ts | 2 +- test/admin/e2e/tooltip/e2e.spec.ts | 2 +- test/array-update/int.spec.ts | 2 +- test/auth-basic/e2e.spec.ts | 4 ++-- test/auth/custom-strategy/int.spec.ts | 4 ++-- test/auth/e2e.spec.ts | 4 ++-- test/auth/forgot-password-localized/int.spec.ts | 4 ++-- test/auth/int.spec.ts | 4 ++-- test/auth/removed-token/int.spec.ts | 4 ++-- test/base-path/e2e.spec.ts | 2 +- test/bulk-edit/e2e.spec.ts | 2 +- test/collections-graphql/int.spec.ts | 4 ++-- test/collections-rest/int.spec.ts | 4 ++-- test/config/int.spec.ts | 4 ++-- test/custom-graphql/int.spec.ts | 4 ++-- test/dashboard/e2e.spec.ts | 2 +- test/database/int.spec.ts | 4 ++-- test/database/postgres-logs.int.spec.ts | 2 +- test/database/sqlite-bound-parameters-limit.int.spec.ts | 2 +- test/dataloader/int.spec.ts | 4 ++-- test/email-nodemailer/int.spec.ts | 2 +- test/embed/e2e.spec.ts | 2 +- test/endpoints/int.spec.ts | 4 ++-- test/evals/runCodegenDataset.ts | 2 +- test/field-access-context/int.spec.ts | 4 ++-- test/field-error-states/e2e.spec.ts | 4 ++-- test/field-paths/e2e.spec.ts | 2 +- test/field-paths/int.spec.ts | 2 +- test/fields-relationship/e2e.spec.ts | 4 ++-- test/fields-relationship/int.spec.ts | 4 ++-- test/fields/collections/Array/e2e.spec.ts | 4 ++-- test/fields/collections/Blocks/e2e.spec.ts | 4 ++-- test/fields/collections/Checkbox/e2e.spec.ts | 4 ++-- test/fields/collections/Code/e2e.spec.ts | 4 ++-- test/fields/collections/Collapsible/e2e.spec.ts | 4 ++-- test/fields/collections/ConditionalLogic/e2e.spec.ts | 4 ++-- test/fields/collections/CustomID/e2e.spec.ts | 4 ++-- test/fields/collections/Date/e2e.spec.ts | 4 ++-- test/fields/collections/Email/e2e.spec.ts | 4 ++-- test/fields/collections/Group/e2e.spec.ts | 4 ++-- test/fields/collections/Indexed/e2e.spec.ts | 4 ++-- test/fields/collections/JSON/e2e.spec.ts | 4 ++-- test/fields/collections/Number/e2e.spec.ts | 4 ++-- test/fields/collections/Point/e2e.spec.ts | 4 ++-- test/fields/collections/Radio/e2e.spec.ts | 4 ++-- test/fields/collections/Relationship/e2e.spec.ts | 4 ++-- test/fields/collections/Row/e2e.spec.ts | 4 ++-- test/fields/collections/Select/e2e.spec.ts | 4 ++-- test/fields/collections/SlugField/e2e.spec.ts | 4 ++-- test/fields/collections/Tabs/e2e.spec.ts | 4 ++-- test/fields/collections/Tabs2/e2e.spec.ts | 4 ++-- test/fields/collections/Text/e2e.spec.ts | 4 ++-- test/fields/collections/Textarea/e2e.spec.ts | 4 ++-- test/fields/collections/UI/e2e.spec.ts | 4 ++-- test/fields/collections/Upload/e2e.spec.ts | 4 ++-- test/fields/collections/UploadMulti/e2e.spec.ts | 4 ++-- test/fields/collections/UploadMultiPoly/e2e.spec.ts | 4 ++-- test/fields/collections/UploadPoly/e2e.spec.ts | 4 ++-- test/fields/collections/UploadRestricted/e2e.spec.ts | 4 ++-- test/fields/int.spec.ts | 4 ++-- test/folders/int.spec.ts | 2 +- test/form-state/e2e.spec.ts | 2 +- test/form-state/int.spec.ts | 4 ++-- test/globals/int.spec.ts | 4 ++-- test/graphql/int.spec.ts | 4 ++-- test/group-by/e2e.spec.ts | 4 ++-- test/hierarchy/e2e.spec.ts | 2 +- test/hierarchy/int.spec.ts | 2 +- test/hooks/e2e.spec.ts | 4 ++-- test/hooks/int.spec.ts | 4 ++-- test/i18n/e2e.spec.ts | 4 ++-- test/joins/e2e.spec.ts | 2 +- test/joins/int.spec.ts | 4 ++-- test/kv/int.spec.ts | 2 +- test/lexical-mdx/int.spec.ts | 2 +- test/lexical/benchmarks/perf.spec.ts | 2 +- test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts | 2 +- test/lexical/collections/Lexical/e2e/main/e2e.spec.ts | 2 +- test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts | 2 +- .../lexical/collections/LexicalHeadingFeature/e2e.spec.ts | 2 +- test/lexical/collections/LexicalJSXConverter/e2e.spec.ts | 2 +- test/lexical/collections/LexicalLinkFeature/e2e.spec.ts | 2 +- test/lexical/collections/LexicalListsFeature/e2e.spec.ts | 2 +- .../collections/LexicalSlugFieldNameCollision/e2e.spec.ts | 2 +- test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts | 2 +- test/lexical/collections/LexicalViewsNested/e2e.spec.ts | 2 +- test/lexical/collections/LexicalViewsProvider/e2e.spec.ts | 2 +- .../collections/LexicalViewsProviderDefault/e2e.spec.ts | 2 +- .../collections/LexicalViewsProviderFallback/e2e.spec.ts | 2 +- test/lexical/collections/OnDemandForm/e2e.spec.ts | 2 +- .../collections/_LexicalFullyFeatured/db/e2e.spec.ts | 2 +- .../lexical/collections/_LexicalFullyFeatured/e2e.spec.ts | 2 +- test/lexical/collections/utils.ts | 2 +- test/lexical/lexical.int.spec.ts | 4 ++-- test/live-preview/e2e.spec.ts | 4 ++-- test/live-preview/int.spec.ts | 4 ++-- test/localization/e2e.spec.ts | 2 +- test/localization/int.spec.ts | 4 ++-- test/localization/localizeStatus.int.spec.ts | 2 +- test/localization/testMigration.ts | 2 +- test/locked-documents/e2e.spec.ts | 2 +- test/locked-documents/int.spec.ts | 2 +- test/login-with-username/int.spec.ts | 2 +- test/payload-cloud/int.spec.ts | 4 ++-- test/plugin-cloud-storage/e2e.spec.ts | 2 +- .../int.compositePrefixes.int.spec.ts | 2 +- test/plugin-cloud-storage/int.spec.ts | 4 ++-- test/plugin-ecommerce/e2e.spec.ts | 4 ++-- test/plugin-ecommerce/int.spec.ts | 4 ++-- test/plugin-form-builder/e2e.spec.ts | 2 +- test/plugin-form-builder/int.spec.ts | 4 ++-- test/plugin-import-export/e2e.spec.ts | 2 +- test/plugin-import-export/field-hooks.int.spec.ts | 4 ++-- test/plugin-import-export/hooks.int.spec.ts | 4 ++-- test/plugin-import-export/int.spec.ts | 4 ++-- test/plugin-mcp/e2e.spec.ts | 2 +- test/plugin-mcp/helpers/mcpClient.ts | 2 +- test/plugin-mcp/helpers/mcpFixtures.ts | 4 ++-- test/plugin-mcp/helpers/realMcpClient.ts | 2 +- test/plugin-multi-tenant/e2e.spec.ts | 2 +- test/plugin-multi-tenant/int.spec.ts | 4 ++-- test/plugin-nested-docs/e2e.spec.ts | 2 +- test/plugin-nested-docs/int.spec.ts | 2 +- test/plugin-redirects/e2e.spec.ts | 2 +- test/plugin-redirects/int.spec.ts | 2 +- test/plugin-search/int.spec.ts | 4 ++-- test/plugin-sentry/int.spec.ts | 2 +- test/plugin-seo/e2e.spec.ts | 4 ++-- test/plugin-seo/int.spec.ts | 2 +- test/plugin-stripe/int.spec.ts | 2 +- test/plugins/int.spec.ts | 2 +- test/query-presets/e2e.spec.ts | 4 ++-- test/query-presets/int.spec.ts | 2 +- test/queues/cli.int.spec.ts | 2 +- test/queues/e2e.spec.ts | 2 +- test/queues/int.spec.ts | 4 ++-- test/queues/postgres-logs.int.spec.ts | 2 +- test/queues/schedules-autocron.int.spec.ts | 4 ++-- test/queues/schedules.int.spec.ts | 4 ++-- test/relationships/int.spec.ts | 4 ++-- test/sdk/int.spec.ts | 4 ++-- test/select/int.spec.ts | 4 ++-- test/select/postgreslogs.int.spec.ts | 2 +- test/server-functions/e2e.spec.ts | 2 +- test/server-url/e2e.spec.ts | 2 +- test/sort/e2e.spec.ts | 2 +- test/sort/int.spec.ts | 4 ++-- test/storage-azure/client-uploads/e2e.spec.ts | 2 +- test/storage-azure/client-uploads/int.spec.ts | 4 ++-- test/storage-azure/int.spec.ts | 4 ++-- test/storage-azure/streamingUploads.int.spec.ts | 4 ++-- test/storage-s3/client-uploads/e2e.spec.ts | 2 +- test/storage-s3/client-uploads/int.spec.ts | 4 ++-- test/storage-s3/int.spec.ts | 4 ++-- test/storage-s3/searchBeforeS3.int.spec.ts | 2 +- .../client-uploads/compositePrefixes.int.spec.ts | 4 ++-- test/storage-vercel-blob/client-uploads/e2e.spec.ts | 2 +- test/storage-vercel-blob/client-uploads/int.spec.ts | 4 ++-- test/storage-vercel-blob/int.spec.ts | 4 ++-- test/tags/e2e.spec.ts | 2 +- test/tags/int.spec.ts | 2 +- test/trash/e2e.spec.ts | 4 ++-- test/trash/int.spec.ts | 4 ++-- test/uploads/e2e.spec.ts | 4 ++-- test/uploads/int.spec.ts | 4 ++-- test/uuid-v7/int.spec.ts | 2 +- test/versions/e2e.spec.ts | 4 ++-- test/versions/int.spec.ts | 4 ++-- 189 files changed, 293 insertions(+), 293 deletions(-) rename test/__setup/{ => e2e}/catchConsoleErrors.ts (100%) rename test/__setup/{ => e2e}/ensureCompilationIsDone.ts (93%) rename test/__setup/{ => e2e}/initPage.ts (96%) rename test/__setup/{ => e2e}/patchPageMethods.ts (100%) rename test/{__helpers/shared => __setup/int}/NextRESTClient.ts (100%) rename test/{__helpers/shared => __setup/int}/getSDK.ts (100%) rename test/__setup/{ => int}/initPayloadInt.ts (89%) diff --git a/test/__setup/catchConsoleErrors.ts b/test/__setup/e2e/catchConsoleErrors.ts similarity index 100% rename from test/__setup/catchConsoleErrors.ts rename to test/__setup/e2e/catchConsoleErrors.ts diff --git a/test/__setup/ensureCompilationIsDone.ts b/test/__setup/e2e/ensureCompilationIsDone.ts similarity index 93% rename from test/__setup/ensureCompilationIsDone.ts rename to test/__setup/e2e/ensureCompilationIsDone.ts index ba2e92435e4..9694819ba41 100644 --- a/test/__setup/ensureCompilationIsDone.ts +++ b/test/__setup/e2e/ensureCompilationIsDone.ts @@ -4,11 +4,11 @@ import { expect } from '@playwright/test' import { type Config } from 'payload' import { formatAdminURL, wait } from 'payload/shared' -import type { AdminRoutes } from '../__helpers/e2e/helpers.js' +import type { AdminRoutes } from '../../__helpers/e2e/helpers.js' -import { getRoutes } from '../__helpers/e2e/helpers.js' -import { hideNextDevTools } from '../__helpers/e2e/hideNextDevTools.js' -import { POLL_TOPASS_TIMEOUT } from '../playwright.config.js' +import { getRoutes } from '../../__helpers/e2e/helpers.js' +import { hideNextDevTools } from '../../__helpers/e2e/hideNextDevTools.js' +import { POLL_TOPASS_TIMEOUT } from '../../playwright.config.js' /** * Ensure admin panel is loaded before running tests diff --git a/test/__setup/initPage.ts b/test/__setup/e2e/initPage.ts similarity index 96% rename from test/__setup/initPage.ts rename to test/__setup/e2e/initPage.ts index b69c4de11ad..75e97138d9a 100644 --- a/test/__setup/initPage.ts +++ b/test/__setup/e2e/initPage.ts @@ -1,7 +1,7 @@ import type { BrowserContext, Page } from '@playwright/test' import type { Config } from 'payload' -import type { AdminRoutes } from '../__helpers/e2e/helpers.js' +import type { AdminRoutes } from '../../__helpers/e2e/helpers.js' import { catchConsoleErrors } from './catchConsoleErrors.js' import { ensureCompilationIsDone } from './ensureCompilationIsDone.js' diff --git a/test/__setup/patchPageMethods.ts b/test/__setup/e2e/patchPageMethods.ts similarity index 100% rename from test/__setup/patchPageMethods.ts rename to test/__setup/e2e/patchPageMethods.ts diff --git a/test/__helpers/shared/NextRESTClient.ts b/test/__setup/int/NextRESTClient.ts similarity index 100% rename from test/__helpers/shared/NextRESTClient.ts rename to test/__setup/int/NextRESTClient.ts diff --git a/test/__helpers/shared/getSDK.ts b/test/__setup/int/getSDK.ts similarity index 100% rename from test/__helpers/shared/getSDK.ts rename to test/__setup/int/getSDK.ts index a0b969b41a6..051e11cb565 100644 --- a/test/__helpers/shared/getSDK.ts +++ b/test/__setup/int/getSDK.ts @@ -10,10 +10,10 @@ export type TypedPayloadSDK = PayloadSDK */ export const getSDK = (config: SanitizedConfig) => { const api = { + DELETE: REST_DELETE(config), GET: REST_GET(config), - POST: REST_POST(config), PATCH: REST_PATCH(config), - DELETE: REST_DELETE(config), + POST: REST_POST(config), PUT: REST_PUT(config), } diff --git a/test/__setup/initPayloadInt.ts b/test/__setup/int/initPayloadInt.ts similarity index 89% rename from test/__setup/initPayloadInt.ts rename to test/__setup/int/initPayloadInt.ts index 148936993ca..4fe49f44979 100644 --- a/test/__setup/initPayloadInt.ts +++ b/test/__setup/int/initPayloadInt.ts @@ -4,9 +4,9 @@ import type { GeneratedTypes, Payload, SanitizedConfig } from 'payload' import path from 'path' import { getPayload } from 'payload' -import { getSDK } from '../__helpers/shared/getSDK.js' -import { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' -import { runInit } from '../runInit.js' +import { runInit } from '../../runInit.js' +import { getSDK } from './getSDK.js' +import { NextRESTClient } from './NextRESTClient.js' /** * Initialize Payload configured for integration tests diff --git a/test/_community/e2e.spec.ts b/test/_community/e2e.spec.ts index 467627f3306..7a3df697163 100644 --- a/test/_community/e2e.spec.ts +++ b/test/_community/e2e.spec.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'url' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/_community/int.spec.ts b/test/_community/int.spec.ts index ed45fcd4729..5b06d073cc7 100644 --- a/test/_community/int.spec.ts +++ b/test/_community/int.spec.ts @@ -4,10 +4,10 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { postsSlug } from './collections/Posts/index.js' let payload: Payload diff --git a/test/a11y/e2e.spec.ts b/test/a11y/e2e.spec.ts index 65dd05a468e..5ca13d989f4 100644 --- a/test/a11y/e2e.spec.ts +++ b/test/a11y/e2e.spec.ts @@ -16,7 +16,7 @@ import { runAxeScan } from '../__helpers/e2e/runAxeScan.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/a11y/focus-indicators.e2e.spec.ts b/test/a11y/focus-indicators.e2e.spec.ts index 30df1a4b55f..c5f9dd1f479 100644 --- a/test/a11y/focus-indicators.e2e.spec.ts +++ b/test/a11y/focus-indicators.e2e.spec.ts @@ -8,7 +8,7 @@ import { fileURLToPath } from 'url' import { checkFocusIndicators } from '../__helpers/e2e/checkFocusIndicators.js' import { getRoutes } from '../__helpers/e2e/helpers.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' /** * This test suite validates the checkFocusIndicators utility against diff --git a/test/access-control/e2e.spec.ts b/test/access-control/e2e.spec.ts index 7133124d494..d05fc9b9a40 100644 --- a/test/access-control/e2e.spec.ts +++ b/test/access-control/e2e.spec.ts @@ -21,7 +21,7 @@ import { closeNav, openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { readRestrictedSlug } from './collections/ReadRestricted/index.js' diff --git a/test/access-control/int.spec.ts b/test/access-control/int.spec.ts index c113c19d2c9..ef1cae70a85 100644 --- a/test/access-control/int.spec.ts +++ b/test/access-control/int.spec.ts @@ -13,10 +13,10 @@ import { getEntityPermissions } from 'payload/internal' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it, vitest } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { FullyRestricted, Post } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { requestHeaders } from './getConfig.js' import { asyncParentSlug, diff --git a/test/access-control/postgres-logs.int.spec.ts b/test/access-control/postgres-logs.int.spec.ts index b82d19a63f3..10be7d445c4 100644 --- a/test/access-control/postgres-logs.int.spec.ts +++ b/test/access-control/postgres-logs.int.spec.ts @@ -7,7 +7,7 @@ import { getEntityPermissions } from 'payload/internal' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it, vitest } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { whereCacheSameSlug, whereCacheUniqueSlug } from './shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/admin-bar/e2e.spec.ts b/test/admin-bar/e2e.spec.ts index 6a8ef3e203a..8cfcb4dc3fb 100644 --- a/test/admin-bar/e2e.spec.ts +++ b/test/admin-bar/e2e.spec.ts @@ -7,7 +7,7 @@ import { fileURLToPath } from 'url' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/admin-root/e2e.spec.ts b/test/admin-root/e2e.spec.ts index 96f5faada6e..fe29ec811dd 100644 --- a/test/admin-root/e2e.spec.ts +++ b/test/admin-root/e2e.spec.ts @@ -11,8 +11,8 @@ import { } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { adminRoute } from './shared.js' diff --git a/test/admin-root/int.spec.ts b/test/admin-root/int.spec.ts index 48084ea7256..230a1e7f151 100644 --- a/test/admin-root/int.spec.ts +++ b/test/admin-root/int.spec.ts @@ -4,10 +4,10 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { postsSlug } from './collections/Posts/index.js' let payload: Payload diff --git a/test/admin/e2e/command-palette/e2e.spec.ts b/test/admin/e2e/command-palette/e2e.spec.ts index 7262b5749ba..a5a5390012c 100644 --- a/test/admin/e2e/command-palette/e2e.spec.ts +++ b/test/admin/e2e/command-palette/e2e.spec.ts @@ -9,8 +9,8 @@ import type { Config } from '../../payload-types.js' import { getRoutes } from '../../../__helpers/e2e/helpers.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { BASE_PATH, customAdminRoutes } from '../../shared.js' import { globalSlug, postsCollectionSlug } from '../../slugs.js' diff --git a/test/admin/e2e/document-view/e2e.spec.ts b/test/admin/e2e/document-view/e2e.spec.ts index f193cdccf72..a0e0f4623f6 100644 --- a/test/admin/e2e/document-view/e2e.spec.ts +++ b/test/admin/e2e/document-view/e2e.spec.ts @@ -14,8 +14,8 @@ import { import { test } from '../../../__helpers/e2e/playwright.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { BASE_PATH, customAdminRoutes, diff --git a/test/admin/e2e/general/e2e.spec.ts b/test/admin/e2e/general/e2e.spec.ts index 806f9ecbf0b..6e7aec1099c 100644 --- a/test/admin/e2e/general/e2e.spec.ts +++ b/test/admin/e2e/general/e2e.spec.ts @@ -15,8 +15,8 @@ import { import { test } from '../../../__helpers/e2e/playwright.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { BASE_PATH, customAdminRoutes, diff --git a/test/admin/e2e/list-view/e2e.spec.ts b/test/admin/e2e/list-view/e2e.spec.ts index 8ad4e67f5b3..781373e4850 100644 --- a/test/admin/e2e/list-view/e2e.spec.ts +++ b/test/admin/e2e/list-view/e2e.spec.ts @@ -9,8 +9,8 @@ import type { Config, Geo, Post, Virtual } from '../../payload-types.js' import { exactText, getRoutes, openColumnControls } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { BASE_PATH, customAdminRoutes } from '../../shared.js' import { arrayCollectionSlug, diff --git a/test/admin/e2e/sidebar-tabs/e2e.spec.ts b/test/admin/e2e/sidebar-tabs/e2e.spec.ts index 970fd66cd7e..9056d879766 100644 --- a/test/admin/e2e/sidebar-tabs/e2e.spec.ts +++ b/test/admin/e2e/sidebar-tabs/e2e.spec.ts @@ -9,7 +9,7 @@ import type { Config } from '../../payload-types.js' import { openNav } from '../../../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../../../__setup/initPage.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/admin/e2e/tooltip/e2e.spec.ts b/test/admin/e2e/tooltip/e2e.spec.ts index 6713d90e207..475d40c7489 100644 --- a/test/admin/e2e/tooltip/e2e.spec.ts +++ b/test/admin/e2e/tooltip/e2e.spec.ts @@ -8,7 +8,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../../../__setup/initPage.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/array-update/int.spec.ts b/test/array-update/int.spec.ts index 7b7ed4dfde0..b5a8e2a9347 100644 --- a/test/array-update/int.spec.ts +++ b/test/array-update/int.spec.ts @@ -4,7 +4,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { arraySlug, complexSlug } from './shared.js' let payload: Payload diff --git a/test/auth-basic/e2e.spec.ts b/test/auth-basic/e2e.spec.ts index 350aa774a71..7c48cc23b10 100644 --- a/test/auth-basic/e2e.spec.ts +++ b/test/auth-basic/e2e.spec.ts @@ -13,8 +13,8 @@ import { getRoutes } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' diff --git a/test/auth/custom-strategy/int.spec.ts b/test/auth/custom-strategy/int.spec.ts index 713fca02268..110b9f1d42c 100644 --- a/test/auth/custom-strategy/int.spec.ts +++ b/test/auth/custom-strategy/int.spec.ts @@ -4,9 +4,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../../__setup/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/int/initPayloadInt.js' import { usersSlug } from './shared.js' let payload: Payload diff --git a/test/auth/e2e.spec.ts b/test/auth/e2e.spec.ts index e96c8c3e27d..806bc463fe4 100644 --- a/test/auth/e2e.spec.ts +++ b/test/auth/e2e.spec.ts @@ -15,8 +15,8 @@ import { getRoutes, saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { apiKeysSlug, BASE_PATH, slug } from './shared.js' diff --git a/test/auth/forgot-password-localized/int.spec.ts b/test/auth/forgot-password-localized/int.spec.ts index 17ef5944438..a4f4bec07ee 100644 --- a/test/auth/forgot-password-localized/int.spec.ts +++ b/test/auth/forgot-password-localized/int.spec.ts @@ -4,10 +4,10 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' import { devUser } from '../../credentials.js' -import { initPayloadInt } from '../../__setup/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/int/initPayloadInt.js' import { collectionSlug } from './config.js' let restClient: NextRESTClient | undefined diff --git a/test/auth/int.spec.ts b/test/auth/int.spec.ts index f8a7450e492..5c5fce3bd1a 100644 --- a/test/auth/int.spec.ts +++ b/test/auth/int.spec.ts @@ -16,10 +16,10 @@ import { fileURLToPath } from 'url' import { v4 as uuid } from 'uuid' import { afterAll, beforeAll, beforeEach, describe, expect, it, vitest } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { ApiKey } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { apiKeysSlug, diff --git a/test/auth/removed-token/int.spec.ts b/test/auth/removed-token/int.spec.ts index 048b952c405..d42df1c324b 100644 --- a/test/auth/removed-token/int.spec.ts +++ b/test/auth/removed-token/int.spec.ts @@ -4,10 +4,10 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' import { devUser } from '../../credentials.js' -import { initPayloadInt } from '../../__setup/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/int/initPayloadInt.js' import { collectionSlug } from './config.js' let restClient: NextRESTClient diff --git a/test/base-path/e2e.spec.ts b/test/base-path/e2e.spec.ts index 54a04a0d2e4..cdc5af880fe 100644 --- a/test/base-path/e2e.spec.ts +++ b/test/base-path/e2e.spec.ts @@ -10,7 +10,7 @@ import { goToListDoc } from '../__helpers/e2e/goToListDoc.js' import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { BASE_PATH } from './shared.js' diff --git a/test/bulk-edit/e2e.spec.ts b/test/bulk-edit/e2e.spec.ts index aac646a0cfe..d2441b57e33 100644 --- a/test/bulk-edit/e2e.spec.ts +++ b/test/bulk-edit/e2e.spec.ts @@ -22,7 +22,7 @@ import { toggleBlockOrArrayRow } from '../__helpers/e2e/toggleCollapsible.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { postsSlug, tabsSlug } from './shared.js' diff --git a/test/collections-graphql/int.spec.ts b/test/collections-graphql/int.spec.ts index 3e2926044d7..cd07830366a 100644 --- a/test/collections-graphql/int.spec.ts +++ b/test/collections-graphql/int.spec.ts @@ -6,11 +6,11 @@ import { getFileByPath, mapAsync } from 'payload' import { wait } from 'payload/shared' import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Post } from './payload-types.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { errorOnHookSlug, pointSlug, relationSlug, slug } from './config.js' const formatID = (id: number | string) => (typeof id === 'number' ? id : `"${id}"`) diff --git a/test/collections-rest/int.spec.ts b/test/collections-rest/int.spec.ts index c568b4cdf2b..7b84497f5ce 100644 --- a/test/collections-rest/int.spec.ts +++ b/test/collections-rest/int.spec.ts @@ -7,12 +7,12 @@ import { APIError, NotFound } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Relation } from './config.js' import type { Post } from './payload-types.js' import { getFormDataSize } from '../__helpers/shared/getFormDataSize.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { largeDocumentsCollectionSlug } from './collections/LargeDocuments.js' import { customIdNumberSlug, diff --git a/test/config/int.spec.ts b/test/config/int.spec.ts index 39e62de4cfc..c4782ef4b92 100644 --- a/test/config/int.spec.ts +++ b/test/config/int.spec.ts @@ -5,10 +5,10 @@ import { type BlocksField, getPayload, type Payload } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { testFilePath } from './testFilePath.js' let restClient: NextRESTClient diff --git a/test/custom-graphql/int.spec.ts b/test/custom-graphql/int.spec.ts index 607269812b7..99d72ce08d9 100644 --- a/test/custom-graphql/int.spec.ts +++ b/test/custom-graphql/int.spec.ts @@ -4,9 +4,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let restClient: NextRESTClient let payload: Payload diff --git a/test/dashboard/e2e.spec.ts b/test/dashboard/e2e.spec.ts index e276d6a407a..99e983eff43 100644 --- a/test/dashboard/e2e.spec.ts +++ b/test/dashboard/e2e.spec.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'url' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { DashboardHelper } from './utils.js' diff --git a/test/database/int.spec.ts b/test/database/int.spec.ts index c3726c04a8d..98874f94ce6 100644 --- a/test/database/int.spec.ts +++ b/test/database/int.spec.ts @@ -31,12 +31,12 @@ import { assert } from 'ts-essentials' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, expect } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Global2, Post } from './payload-types.js' import { sanitizeQueryValue } from '../../packages/db-mongodb/src/queries/sanitizeQueryValue.js' import { describe, it } from '../__helpers/int/vitest.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { removeFiles } from '../__helpers/shared/removeFiles.js' import { devUser } from '../credentials.js' import { seed } from './seed.js' diff --git a/test/database/postgres-logs.int.spec.ts b/test/database/postgres-logs.int.spec.ts index 61c146a9d32..823244d15aa 100644 --- a/test/database/postgres-logs.int.spec.ts +++ b/test/database/postgres-logs.int.spec.ts @@ -8,7 +8,7 @@ import { afterAll, beforeAll, describe, expect, it, vitest } from 'vitest' import type { Post } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/database/sqlite-bound-parameters-limit.int.spec.ts b/test/database/sqlite-bound-parameters-limit.int.spec.ts index 83ed6227ca5..12907e67852 100644 --- a/test/database/sqlite-bound-parameters-limit.int.spec.ts +++ b/test/database/sqlite-bound-parameters-limit.int.spec.ts @@ -4,7 +4,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { describe } from '../__helpers/int/vitest.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/dataloader/int.spec.ts b/test/dataloader/int.spec.ts index 0703cefddd7..096d72e1f50 100644 --- a/test/dataloader/int.spec.ts +++ b/test/dataloader/int.spec.ts @@ -6,9 +6,9 @@ import { createLocalReq } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it, vitest } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { postDoc } from './config.js' diff --git a/test/email-nodemailer/int.spec.ts b/test/email-nodemailer/int.spec.ts index f3bedf5f1ba..3a0eaa6f9d2 100644 --- a/test/email-nodemailer/int.spec.ts +++ b/test/email-nodemailer/int.spec.ts @@ -6,7 +6,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it, type Mock, vi } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload let mockedSendEmail: Mock diff --git a/test/embed/e2e.spec.ts b/test/embed/e2e.spec.ts index ed6de78444c..c1ab2ddde91 100644 --- a/test/embed/e2e.spec.ts +++ b/test/embed/e2e.spec.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'url' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { embedCookieName, themeCookieName } from './shared.js' diff --git a/test/endpoints/int.spec.ts b/test/endpoints/int.spec.ts index c8dfa41e653..7571f454587 100644 --- a/test/endpoints/int.spec.ts +++ b/test/endpoints/int.spec.ts @@ -3,9 +3,9 @@ import { type Payload } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { applicationEndpoint, collectionSlug, diff --git a/test/evals/runCodegenDataset.ts b/test/evals/runCodegenDataset.ts index a12125fadf7..1680da5c469 100644 --- a/test/evals/runCodegenDataset.ts +++ b/test/evals/runCodegenDataset.ts @@ -466,7 +466,7 @@ function createLazyPayload({ } try { - const { initPayloadInt } = await import('../__setup/initPayloadInt.js') + const { initPayloadInt } = await import('../__setup/int/initPayloadInt.js') payload = ( await initPayloadInt(configDir, suiteName, undefined, configFile, { payloadKey: configFile, diff --git a/test/field-access-context/int.spec.ts b/test/field-access-context/int.spec.ts index 97043f0fc18..1d8be52712d 100644 --- a/test/field-access-context/int.spec.ts +++ b/test/field-access-context/int.spec.ts @@ -5,9 +5,9 @@ import { createLocalReq } from 'payload' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { childrenSlug, globalSlug, parentsSlug, readAccessLog, resetAccessLog } from './shared.js' let payload: Payload diff --git a/test/field-error-states/e2e.spec.ts b/test/field-error-states/e2e.spec.ts index ab726271b6a..86c3043f78d 100644 --- a/test/field-error-states/e2e.spec.ts +++ b/test/field-error-states/e2e.spec.ts @@ -13,8 +13,8 @@ import { getRoutes, saveDocAndAssert, waitForFormReady } from '../__helpers/e2e/ import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { collectionSlugs } from './shared.js' diff --git a/test/field-paths/e2e.spec.ts b/test/field-paths/e2e.spec.ts index 540714bc98c..be535e65caa 100644 --- a/test/field-paths/e2e.spec.ts +++ b/test/field-paths/e2e.spec.ts @@ -12,7 +12,7 @@ import {} from // throttleTest, import { navigateToDiffVersionView } from '../__helpers/e2e/navigateToDiffVersionView.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { fieldPathsSlug } from './shared.js' import { testDoc } from './testDoc.js' diff --git a/test/field-paths/int.spec.ts b/test/field-paths/int.spec.ts index b5739d462fa..cb70ec54cb6 100644 --- a/test/field-paths/int.spec.ts +++ b/test/field-paths/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' // eslint-disable-next-line payload/no-relative-monorepo-imports import { buildFieldSchemaMap } from '../../packages/ui/src/utilities/buildFieldSchemaMap/index.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { fieldPathsSlug } from './shared.js' import { testDoc } from './testDoc.js' diff --git a/test/fields-relationship/e2e.spec.ts b/test/fields-relationship/e2e.spec.ts index d024b91dff6..cd157c6d802 100644 --- a/test/fields-relationship/e2e.spec.ts +++ b/test/fields-relationship/e2e.spec.ts @@ -33,8 +33,8 @@ import { openDocDrawer } from '../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../__helpers/shared/assertToastErrors.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { collection1Slug, diff --git a/test/fields-relationship/int.spec.ts b/test/fields-relationship/int.spec.ts index 5c8cc80da87..2d52fa32e83 100644 --- a/test/fields-relationship/int.spec.ts +++ b/test/fields-relationship/int.spec.ts @@ -4,11 +4,11 @@ import { describe, beforeAll, afterAll, it, expect } from 'vitest' import path from 'path' import { fileURLToPath } from 'url' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Collection1 } from './payload-types.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { collection1Slug, versionedRelationshipFieldSlug } from './slugs.js' let payload: Payload diff --git a/test/fields/collections/Array/e2e.spec.ts b/test/fields/collections/Array/e2e.spec.ts index 04501c9b083..2a568519b42 100644 --- a/test/fields/collections/Array/e2e.spec.ts +++ b/test/fields/collections/Array/e2e.spec.ts @@ -20,8 +20,8 @@ import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.j import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/fields/collections/Blocks/e2e.spec.ts b/test/fields/collections/Blocks/e2e.spec.ts index c4d93a9cc3a..a9b8b161835 100644 --- a/test/fields/collections/Blocks/e2e.spec.ts +++ b/test/fields/collections/Blocks/e2e.spec.ts @@ -27,8 +27,8 @@ import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.j import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/fields/collections/Checkbox/e2e.spec.ts b/test/fields/collections/Checkbox/e2e.spec.ts index 9b3ca5801de..524c293ad73 100644 --- a/test/fields/collections/Checkbox/e2e.spec.ts +++ b/test/fields/collections/Checkbox/e2e.spec.ts @@ -11,8 +11,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { checkboxFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Code/e2e.spec.ts b/test/fields/collections/Code/e2e.spec.ts index fcecf735478..f6ffe88de91 100644 --- a/test/fields/collections/Code/e2e.spec.ts +++ b/test/fields/collections/Code/e2e.spec.ts @@ -10,8 +10,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { codeFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Collapsible/e2e.spec.ts b/test/fields/collections/Collapsible/e2e.spec.ts index 44895fe618e..9f902a2a547 100644 --- a/test/fields/collections/Collapsible/e2e.spec.ts +++ b/test/fields/collections/Collapsible/e2e.spec.ts @@ -15,8 +15,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { collapsibleFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/ConditionalLogic/e2e.spec.ts b/test/fields/collections/ConditionalLogic/e2e.spec.ts index 7070f0b7494..6218b24794e 100644 --- a/test/fields/collections/ConditionalLogic/e2e.spec.ts +++ b/test/fields/collections/ConditionalLogic/e2e.spec.ts @@ -18,8 +18,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { conditionalLogicSlug } from '../../slugs.js' diff --git a/test/fields/collections/CustomID/e2e.spec.ts b/test/fields/collections/CustomID/e2e.spec.ts index 82122007ae6..ba3a437f0ed 100644 --- a/test/fields/collections/CustomID/e2e.spec.ts +++ b/test/fields/collections/CustomID/e2e.spec.ts @@ -12,8 +12,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { customIDSlug, customRowIDSlug, customTabIDSlug } from '../../slugs.js' import { customRowID, customTabID, nonStandardID } from './shared.js' diff --git a/test/fields/collections/Date/e2e.spec.ts b/test/fields/collections/Date/e2e.spec.ts index fc599716f01..abcef3f61ae 100644 --- a/test/fields/collections/Date/e2e.spec.ts +++ b/test/fields/collections/Date/e2e.spec.ts @@ -16,8 +16,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { dateFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Email/e2e.spec.ts b/test/fields/collections/Email/e2e.spec.ts index 1dfd1221652..7444ca27874 100644 --- a/test/fields/collections/Email/e2e.spec.ts +++ b/test/fields/collections/Email/e2e.spec.ts @@ -13,8 +13,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { emailFieldsSlug } from '../../slugs.js' import { emailDoc } from './shared.js' diff --git a/test/fields/collections/Group/e2e.spec.ts b/test/fields/collections/Group/e2e.spec.ts index 06e17c93de4..14202fe27b3 100644 --- a/test/fields/collections/Group/e2e.spec.ts +++ b/test/fields/collections/Group/e2e.spec.ts @@ -12,8 +12,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { groupFieldsSlug } from '../../slugs.js' import { namedGroupDoc } from './shared.js' diff --git a/test/fields/collections/Indexed/e2e.spec.ts b/test/fields/collections/Indexed/e2e.spec.ts index 87a14363a5a..d624bd8d2df 100644 --- a/test/fields/collections/Indexed/e2e.spec.ts +++ b/test/fields/collections/Indexed/e2e.spec.ts @@ -14,8 +14,8 @@ import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.j import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { indexedFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/JSON/e2e.spec.ts b/test/fields/collections/JSON/e2e.spec.ts index 98f99a39348..11bdeaa842c 100644 --- a/test/fields/collections/JSON/e2e.spec.ts +++ b/test/fields/collections/JSON/e2e.spec.ts @@ -14,8 +14,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { jsonFieldsSlug } from '../../slugs.js' import { jsonDoc } from './shared.js' diff --git a/test/fields/collections/Number/e2e.spec.ts b/test/fields/collections/Number/e2e.spec.ts index 00bc0072b0e..dde64f0ef3c 100644 --- a/test/fields/collections/Number/e2e.spec.ts +++ b/test/fields/collections/Number/e2e.spec.ts @@ -17,8 +17,8 @@ import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.j import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { numberDoc } from './shared.js' diff --git a/test/fields/collections/Point/e2e.spec.ts b/test/fields/collections/Point/e2e.spec.ts index fa015de89f9..e429073cb4c 100644 --- a/test/fields/collections/Point/e2e.spec.ts +++ b/test/fields/collections/Point/e2e.spec.ts @@ -14,8 +14,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { pointFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Radio/e2e.spec.ts b/test/fields/collections/Radio/e2e.spec.ts index 236f0d9914a..d285d205801 100644 --- a/test/fields/collections/Radio/e2e.spec.ts +++ b/test/fields/collections/Radio/e2e.spec.ts @@ -13,8 +13,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { radioFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Relationship/e2e.spec.ts b/test/fields/collections/Relationship/e2e.spec.ts index ac4a92a2299..f05302c8328 100644 --- a/test/fields/collections/Relationship/e2e.spec.ts +++ b/test/fields/collections/Relationship/e2e.spec.ts @@ -29,8 +29,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { assertToastErrors } from '../../../__helpers/shared/assertToastErrors.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { relationshipFieldsSlug, textFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Row/e2e.spec.ts b/test/fields/collections/Row/e2e.spec.ts index 7d135f9f0c7..535170307b7 100644 --- a/test/fields/collections/Row/e2e.spec.ts +++ b/test/fields/collections/Row/e2e.spec.ts @@ -12,8 +12,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { rowFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Select/e2e.spec.ts b/test/fields/collections/Select/e2e.spec.ts index e5f4bcd3f8b..ce62f18a494 100644 --- a/test/fields/collections/Select/e2e.spec.ts +++ b/test/fields/collections/Select/e2e.spec.ts @@ -16,8 +16,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { selectFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/SlugField/e2e.spec.ts b/test/fields/collections/SlugField/e2e.spec.ts index 6b1ad936e70..19925d27f4a 100644 --- a/test/fields/collections/SlugField/e2e.spec.ts +++ b/test/fields/collections/SlugField/e2e.spec.ts @@ -14,8 +14,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { slugFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Tabs/e2e.spec.ts b/test/fields/collections/Tabs/e2e.spec.ts index fbf85af4cc5..467d550483e 100644 --- a/test/fields/collections/Tabs/e2e.spec.ts +++ b/test/fields/collections/Tabs/e2e.spec.ts @@ -16,8 +16,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { tabsFieldsSlug } from '../../slugs.js' diff --git a/test/fields/collections/Tabs2/e2e.spec.ts b/test/fields/collections/Tabs2/e2e.spec.ts index 1256c3aa4c4..6b352d8f326 100644 --- a/test/fields/collections/Tabs2/e2e.spec.ts +++ b/test/fields/collections/Tabs2/e2e.spec.ts @@ -13,8 +13,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { tabsFields2Slug } from '../../slugs.js' diff --git a/test/fields/collections/Text/e2e.spec.ts b/test/fields/collections/Text/e2e.spec.ts index 465d01b8855..ba4aef21974 100644 --- a/test/fields/collections/Text/e2e.spec.ts +++ b/test/fields/collections/Text/e2e.spec.ts @@ -22,8 +22,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { textFieldsSlug } from '../../slugs.js' import { textDoc } from './shared.js' diff --git a/test/fields/collections/Textarea/e2e.spec.ts b/test/fields/collections/Textarea/e2e.spec.ts index 6b86d5150cf..02035913274 100644 --- a/test/fields/collections/Textarea/e2e.spec.ts +++ b/test/fields/collections/Textarea/e2e.spec.ts @@ -23,8 +23,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { textareaFieldsSlug } from '../../slugs.js' import { textareaDoc } from './shared.js' diff --git a/test/fields/collections/UI/e2e.spec.ts b/test/fields/collections/UI/e2e.spec.ts index 7c77b629add..40ec5bcf2a9 100644 --- a/test/fields/collections/UI/e2e.spec.ts +++ b/test/fields/collections/UI/e2e.spec.ts @@ -12,8 +12,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uiSlug } from '../../slugs.js' diff --git a/test/fields/collections/Upload/e2e.spec.ts b/test/fields/collections/Upload/e2e.spec.ts index d2f43cf1a76..fc25193bfab 100644 --- a/test/fields/collections/Upload/e2e.spec.ts +++ b/test/fields/collections/Upload/e2e.spec.ts @@ -15,8 +15,8 @@ import { openDocDrawer } from '../../../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsSlug } from '../../slugs.js' diff --git a/test/fields/collections/UploadMulti/e2e.spec.ts b/test/fields/collections/UploadMulti/e2e.spec.ts index 46cb6c8d547..b3d1ecdec1f 100644 --- a/test/fields/collections/UploadMulti/e2e.spec.ts +++ b/test/fields/collections/UploadMulti/e2e.spec.ts @@ -13,8 +13,8 @@ import { openDocDrawer } from '../../../__helpers/e2e/toggleDocDrawer.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsMulti } from '../../slugs.js' diff --git a/test/fields/collections/UploadMultiPoly/e2e.spec.ts b/test/fields/collections/UploadMultiPoly/e2e.spec.ts index 34928d89747..1ff3bf0683c 100644 --- a/test/fields/collections/UploadMultiPoly/e2e.spec.ts +++ b/test/fields/collections/UploadMultiPoly/e2e.spec.ts @@ -15,8 +15,8 @@ import { getSelectMenu } from '../../../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsMultiPoly } from '../../slugs.js' diff --git a/test/fields/collections/UploadPoly/e2e.spec.ts b/test/fields/collections/UploadPoly/e2e.spec.ts index e19933468e2..21d5227b227 100644 --- a/test/fields/collections/UploadPoly/e2e.spec.ts +++ b/test/fields/collections/UploadPoly/e2e.spec.ts @@ -14,8 +14,8 @@ import { exactText, gotoAndWaitForForm, saveDocAndAssert } from '../../../__help import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsPoly } from '../../slugs.js' diff --git a/test/fields/collections/UploadRestricted/e2e.spec.ts b/test/fields/collections/UploadRestricted/e2e.spec.ts index ae495db4193..cb93de004a3 100644 --- a/test/fields/collections/UploadRestricted/e2e.spec.ts +++ b/test/fields/collections/UploadRestricted/e2e.spec.ts @@ -11,8 +11,8 @@ import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../__helpers/shared/rest.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' -import { initPage } from '../../../__setup/initPage.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../../../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { uploadsRestricted } from '../../slugs.js' diff --git a/test/fields/int.spec.ts b/test/fields/int.spec.ts index 8bdd838f27e..bf243ddd91e 100644 --- a/test/fields/int.spec.ts +++ b/test/fields/int.spec.ts @@ -8,11 +8,11 @@ import { createLocalReq, reload } from 'payload' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { BlockField, GroupField } from './payload-types.js' import { it } from '../__helpers/int/vitest.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { isMongoose } from '../__helpers/shared/isMongoose.js' import { devUser } from '../credentials.js' import { arrayDefaultValue } from './collections/Array/index.js' diff --git a/test/folders/int.spec.ts b/test/folders/int.spec.ts index b59d245aabe..4110b842862 100644 --- a/test/folders/int.spec.ts +++ b/test/folders/int.spec.ts @@ -4,7 +4,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { folderSlug, postSlug } from './shared.js' let payload: Payload diff --git a/test/form-state/e2e.spec.ts b/test/form-state/e2e.spec.ts index 0e3825dec31..f8c7f0580fe 100644 --- a/test/form-state/e2e.spec.ts +++ b/test/form-state/e2e.spec.ts @@ -24,7 +24,7 @@ import { currentFramework, test } from '../__helpers/e2e/playwright.js' import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSaveToRunAndComplete.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { autosavePostsSlug } from './collections/Autosave/index.js' import { postsSlug } from './collections/Posts/index.js' diff --git a/test/form-state/int.spec.ts b/test/form-state/int.spec.ts index f95372a281b..be05cc2e051 100644 --- a/test/form-state/int.spec.ts +++ b/test/form-state/int.spec.ts @@ -7,9 +7,9 @@ import { createLocalReq } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { conditionsSlug } from './collections/Conditions/index.js' import { postsSlug } from './collections/Posts/index.js' diff --git a/test/globals/int.spec.ts b/test/globals/int.spec.ts index e341da44540..332c1334ef2 100644 --- a/test/globals/int.spec.ts +++ b/test/globals/int.spec.ts @@ -4,9 +4,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { accessControlSlug, arraySlug, diff --git a/test/graphql/int.spec.ts b/test/graphql/int.spec.ts index 2a1fb8f217a..9819b9c0547 100644 --- a/test/graphql/int.spec.ts +++ b/test/graphql/int.spec.ts @@ -7,10 +7,10 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload let restClient: NextRESTClient diff --git a/test/group-by/e2e.spec.ts b/test/group-by/e2e.spec.ts index 0b2efc00228..a3c64c0acaf 100644 --- a/test/group-by/e2e.spec.ts +++ b/test/group-by/e2e.spec.ts @@ -24,8 +24,8 @@ import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { devUser } from '../credentials.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { diff --git a/test/hierarchy/e2e.spec.ts b/test/hierarchy/e2e.spec.ts index 8e776c5873b..bdfed2e533c 100644 --- a/test/hierarchy/e2e.spec.ts +++ b/test/hierarchy/e2e.spec.ts @@ -10,7 +10,7 @@ import type { Config, Organization } from './payload-types.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/hierarchy/int.spec.ts b/test/hierarchy/int.spec.ts index bbb18950b03..c2164bdbdb2 100644 --- a/test/hierarchy/int.spec.ts +++ b/test/hierarchy/int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from import type { Organization } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/hooks/e2e.spec.ts b/test/hooks/e2e.spec.ts index 28e38ec7179..e503031e588 100644 --- a/test/hooks/e2e.spec.ts +++ b/test/hooks/e2e.spec.ts @@ -11,8 +11,8 @@ import type { Config } from './payload-types.js' import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { beforeValidateSlug } from './shared.js' diff --git a/test/hooks/int.spec.ts b/test/hooks/int.spec.ts index 509d8ead2c4..b40613a7fc6 100644 --- a/test/hooks/int.spec.ts +++ b/test/hooks/int.spec.ts @@ -5,10 +5,10 @@ import { AuthenticationError } from 'payload' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { devUser, regularUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { isMongoose } from '../__helpers/shared/isMongoose.js' import { afterOperationSlug } from './collections/AfterOperation/index.js' import { diff --git a/test/i18n/e2e.spec.ts b/test/i18n/e2e.spec.ts index ed1d91d3ae5..6a770027ade 100644 --- a/test/i18n/e2e.spec.ts +++ b/test/i18n/e2e.spec.ts @@ -18,8 +18,8 @@ import { openListFilters } from '../__helpers/e2e/filters/index.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' let payload: PayloadTestSDK diff --git a/test/joins/e2e.spec.ts b/test/joins/e2e.spec.ts index 803bfd4c52e..fbff3d91be1 100644 --- a/test/joins/e2e.spec.ts +++ b/test/joins/e2e.spec.ts @@ -20,7 +20,7 @@ import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { EXPECT_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { categoriesJoinRestrictedSlug, diff --git a/test/joins/int.spec.ts b/test/joins/int.spec.ts index 94a1608d22b..f8a2f6917c7 100644 --- a/test/joins/int.spec.ts +++ b/test/joins/int.spec.ts @@ -5,11 +5,11 @@ import { getFileByPath } from 'payload' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Category, Config, DepthJoins1, DepthJoins3, Post, Singular } from './payload-types.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { categoriesJoinRestrictedSlug, diff --git a/test/kv/int.spec.ts b/test/kv/int.spec.ts index 33e76c5eaa8..c9d8b67a6f6 100644 --- a/test/kv/int.spec.ts +++ b/test/kv/int.spec.ts @@ -6,7 +6,7 @@ import { inMemoryKVAdapter } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload diff --git a/test/lexical-mdx/int.spec.ts b/test/lexical-mdx/int.spec.ts index 052730ba362..5c61756a23f 100644 --- a/test/lexical-mdx/int.spec.ts +++ b/test/lexical-mdx/int.spec.ts @@ -12,7 +12,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { postsSlug } from './collections/Posts/index.js' import { editorJSONToMDX, mdxToEditorJSON } from './mdx/hooks.js' import { codeTest1 } from './tests/code1.test.js' diff --git a/test/lexical/benchmarks/perf.spec.ts b/test/lexical/benchmarks/perf.spec.ts index e1b449e7d02..69ae2df14df 100644 --- a/test/lexical/benchmarks/perf.spec.ts +++ b/test/lexical/benchmarks/perf.spec.ts @@ -9,7 +9,7 @@ import type { Config } from '../payload-types.js' import { AdminUrlUtil } from '../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../playwright.config.js' import { LexicalHelpers } from '../collections/utils.js' import { lexicalBenchmarkSlug } from '../slugs.js' diff --git a/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts b/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts index d8de6db5de4..7b8b3d5af73 100644 --- a/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts +++ b/test/lexical/collections/Lexical/e2e/blocks/e2e.spec.ts @@ -32,7 +32,7 @@ import { assertToastErrors } from '../../../../../__helpers/shared/assertToastEr import { reInitializeDB } from '../../../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../../../__helpers/shared/rest.js' -import { initPage } from '../../../../../__setup/initPage.js' +import { initPage } from '../../../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../../../playwright.config.js' import { lexicalFieldsSlug, lexicalNestedBlocksSlug } from '../../../../slugs.js' import { lexicalDocData } from '../../data.js' diff --git a/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts b/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts index ae58a39fa44..85fb1d87197 100644 --- a/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts +++ b/test/lexical/collections/Lexical/e2e/main/e2e.spec.ts @@ -28,7 +28,7 @@ import { AdminUrlUtil } from '../../../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../../../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../../../../../__helpers/shared/rest.js' -import { initPage } from '../../../../../__setup/initPage.js' +import { initPage } from '../../../../../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../../../playwright.config.js' import { lexicalCustomCellSlug, lexicalFieldsSlug, richTextFieldsSlug } from '../../../../slugs.js' import { lexicalDocData } from '../../data.js' diff --git a/test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts b/test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts index 9294f66dccd..dacd60b5d9f 100644 --- a/test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts +++ b/test/lexical/collections/LexicalAutosaveBlock/e2e.spec.ts @@ -7,7 +7,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalAutosaveBlockSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts b/test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts index 88ffc8068f4..c489eec7c02 100644 --- a/test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts +++ b/test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts @@ -4,7 +4,7 @@ import { fileURLToPath } from 'url' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalHeadingFeatureSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalJSXConverter/e2e.spec.ts b/test/lexical/collections/LexicalJSXConverter/e2e.spec.ts index e0be616cf70..f6b45ae42ec 100644 --- a/test/lexical/collections/LexicalJSXConverter/e2e.spec.ts +++ b/test/lexical/collections/LexicalJSXConverter/e2e.spec.ts @@ -7,7 +7,7 @@ import { fileURLToPath } from 'url' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalJSXConverterSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalLinkFeature/e2e.spec.ts b/test/lexical/collections/LexicalLinkFeature/e2e.spec.ts index 71331b777c8..2af3f018101 100644 --- a/test/lexical/collections/LexicalLinkFeature/e2e.spec.ts +++ b/test/lexical/collections/LexicalLinkFeature/e2e.spec.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url' import { waitForFormReady } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalLinkFeatureSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalListsFeature/e2e.spec.ts b/test/lexical/collections/LexicalListsFeature/e2e.spec.ts index 7e4d27fd8a5..6d7fbd5854d 100644 --- a/test/lexical/collections/LexicalListsFeature/e2e.spec.ts +++ b/test/lexical/collections/LexicalListsFeature/e2e.spec.ts @@ -7,7 +7,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalListsFeatureSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts b/test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts index 445ba85ac59..7b4be2c4c83 100644 --- a/test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts +++ b/test/lexical/collections/LexicalSlugFieldNameCollision/e2e.spec.ts @@ -7,7 +7,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalSlugFieldNameCollisionSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts b/test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts index 388014c7a2b..59b57e4a527 100644 --- a/test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsFrontend/e2e.spec.ts @@ -9,7 +9,7 @@ import type { LexicalViewsFrontendNodes } from './index.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsFrontendSlug, lexicalViewsSlug } from '../../slugs.js' diff --git a/test/lexical/collections/LexicalViewsNested/e2e.spec.ts b/test/lexical/collections/LexicalViewsNested/e2e.spec.ts index 4a85a0c6778..fc4499612ca 100644 --- a/test/lexical/collections/LexicalViewsNested/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsNested/e2e.spec.ts @@ -7,7 +7,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsNestedSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalViewsProvider/e2e.spec.ts b/test/lexical/collections/LexicalViewsProvider/e2e.spec.ts index 2972302b3a5..e19c1f15a23 100644 --- a/test/lexical/collections/LexicalViewsProvider/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsProvider/e2e.spec.ts @@ -8,7 +8,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsProviderSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts b/test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts index d28ae4e7cb7..d3f251a6ebd 100644 --- a/test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsProviderDefault/e2e.spec.ts @@ -7,7 +7,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsProviderDefaultSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/LexicalViewsProviderFallback/e2e.spec.ts b/test/lexical/collections/LexicalViewsProviderFallback/e2e.spec.ts index 34e8cfebeb7..617e3236e3e 100644 --- a/test/lexical/collections/LexicalViewsProviderFallback/e2e.spec.ts +++ b/test/lexical/collections/LexicalViewsProviderFallback/e2e.spec.ts @@ -7,7 +7,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { lexicalViewsProviderFallbackSlug } from '../../slugs.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/OnDemandForm/e2e.spec.ts b/test/lexical/collections/OnDemandForm/e2e.spec.ts index cb66d9d8728..8b85194955b 100644 --- a/test/lexical/collections/OnDemandForm/e2e.spec.ts +++ b/test/lexical/collections/OnDemandForm/e2e.spec.ts @@ -7,7 +7,7 @@ import { saveDocAndAssert } from '../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/_LexicalFullyFeatured/db/e2e.spec.ts b/test/lexical/collections/_LexicalFullyFeatured/db/e2e.spec.ts index e3a04993e88..1ffa8e13678 100644 --- a/test/lexical/collections/_LexicalFullyFeatured/db/e2e.spec.ts +++ b/test/lexical/collections/_LexicalFullyFeatured/db/e2e.spec.ts @@ -15,7 +15,7 @@ import { saveDocAndAssert } from '../../../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../../../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../../../../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../../../playwright.config.js' import { lexicalFullyFeaturedSlug } from '../../../slugs.js' import { LexicalHelpers, type PasteMode } from '../../utils.js' diff --git a/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts b/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts index 3478226c3d3..79f664c4bd1 100644 --- a/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts +++ b/test/lexical/collections/_LexicalFullyFeatured/e2e.spec.ts @@ -7,7 +7,7 @@ import type { Config } from '../../payload-types.js' import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../../__setup/e2e/ensureCompilationIsDone.js' import { lexicalFullyFeaturedSlug } from '../../../lexical/slugs.js' import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js' import { LexicalHelpers } from '../utils.js' diff --git a/test/lexical/collections/utils.ts b/test/lexical/collections/utils.ts index fd69bf96115..6af170e96ca 100644 --- a/test/lexical/collections/utils.ts +++ b/test/lexical/collections/utils.ts @@ -5,7 +5,7 @@ import fs from 'fs' import path from 'path' import { wait } from 'payload/shared' -import { patchPageMethods } from '../../__setup/patchPageMethods.js' +import { patchPageMethods } from '../../__setup/e2e/patchPageMethods.js' export type PasteMode = 'blob' | 'html' diff --git a/test/lexical/lexical.int.spec.ts b/test/lexical/lexical.int.spec.ts index e436641528b..19dcd31f825 100644 --- a/test/lexical/lexical.int.spec.ts +++ b/test/lexical/lexical.int.spec.ts @@ -48,8 +48,8 @@ import { // Diff converter import { LinkDiffHTMLConverterAsync } from '../../packages/richtext-lexical/src/field/Diff/converters/link.js' import { it } from '../__helpers/int/vitest.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' -import { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' +import { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { devUser } from '../credentials.js' import { lexicalDocData } from './collections/Lexical/data.js' import { generateLexicalLocalizedRichText } from './collections/LexicalLocalized/generateLexicalRichText.js' diff --git a/test/live-preview/e2e.spec.ts b/test/live-preview/e2e.spec.ts index 31e4be177ca..1298572fbd0 100644 --- a/test/live-preview/e2e.spec.ts +++ b/test/live-preview/e2e.spec.ts @@ -28,8 +28,8 @@ import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSav import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { devUser } from '../credentials.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { diff --git a/test/live-preview/int.spec.ts b/test/live-preview/int.spec.ts index 1d12ad48a06..a46024b90e0 100644 --- a/test/live-preview/int.spec.ts +++ b/test/live-preview/int.spec.ts @@ -10,7 +10,7 @@ import { getFileByPath } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Media, Page, Post, Tenant } from './payload-types.js' import { pagesSlug, postsSlug, tenantsSlug } from './shared.js' @@ -23,7 +23,7 @@ let restClient: NextRESTClient import type { CollectionPopulationRequestHandler } from '../../packages/live-preview/src/types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' const requestHandler: CollectionPopulationRequestHandler = ({ data, endpoint }) => { const url = `/${endpoint}` diff --git a/test/localization/e2e.spec.ts b/test/localization/e2e.spec.ts index 81cb19ba1b9..e7cbaf7dcaf 100644 --- a/test/localization/e2e.spec.ts +++ b/test/localization/e2e.spec.ts @@ -31,7 +31,7 @@ import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSav import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { arrayCollectionSlug } from './collections/Array/index.js' import { blocksCollectionSlug } from './collections/Blocks/index.js' diff --git a/test/localization/int.spec.ts b/test/localization/int.spec.ts index 8da3c488790..f451f1e3229 100644 --- a/test/localization/int.spec.ts +++ b/test/localization/int.spec.ts @@ -5,7 +5,7 @@ import { createLocalReq } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { BlocksField, LocalizedPost, @@ -20,7 +20,7 @@ import { devUser } from '../credentials.js' // eslint-disable-next-line payload/no-relative-monorepo-imports import { copyDataFromLocaleHandler } from '../../packages/ui/src/utilities/copyDataFromLocale.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { arrayCollectionSlug } from './collections/Array/index.js' import { groupSlug } from './collections/Group/index.js' import { nestedToArrayAndBlockCollectionSlug } from './collections/NestedToArrayAndBlock/index.js' diff --git a/test/localization/localizeStatus.int.spec.ts b/test/localization/localizeStatus.int.spec.ts index 758b361ac2f..6fffa50f405 100644 --- a/test/localization/localizeStatus.int.spec.ts +++ b/test/localization/localizeStatus.int.spec.ts @@ -11,7 +11,7 @@ import { wait } from 'payload/shared' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/localization/testMigration.ts b/test/localization/testMigration.ts index 3e8c8a2862f..a87e4d82a6a 100755 --- a/test/localization/testMigration.ts +++ b/test/localization/testMigration.ts @@ -17,7 +17,7 @@ import { Types } from 'mongoose' import path from 'path' import { fileURLToPath } from 'url' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/locked-documents/e2e.spec.ts b/test/locked-documents/e2e.spec.ts index a2f00bc025a..0385ce29e79 100644 --- a/test/locked-documents/e2e.spec.ts +++ b/test/locked-documents/e2e.spec.ts @@ -26,7 +26,7 @@ import { getSelectMenu } from '../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/locked-documents/int.spec.ts b/test/locked-documents/int.spec.ts index 77006d2a540..3df8664243a 100644 --- a/test/locked-documents/int.spec.ts +++ b/test/locked-documents/int.spec.ts @@ -9,7 +9,7 @@ import { fileURLToPath } from 'url' import type { Post, User } from './payload-types.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { menuSlug } from './globals/Menu/index.js' import { pagesSlug, postsSlug } from './slugs.js' diff --git a/test/login-with-username/int.spec.ts b/test/login-with-username/int.spec.ts index f65dcffea1c..dcf58589830 100644 --- a/test/login-with-username/int.spec.ts +++ b/test/login-with-username/int.spec.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload diff --git a/test/payload-cloud/int.spec.ts b/test/payload-cloud/int.spec.ts index a1cb07e3be0..2b87bcaa9f6 100644 --- a/test/payload-cloud/int.spec.ts +++ b/test/payload-cloud/int.spec.ts @@ -5,9 +5,9 @@ import { fileURLToPath } from 'url' import { promisify } from 'util' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { createStreamableFile } from '../uploads/createStreamableFile.js' const stat = promisify(fs.stat) diff --git a/test/plugin-cloud-storage/e2e.spec.ts b/test/plugin-cloud-storage/e2e.spec.ts index 21183e1209d..4c5c1bd1a17 100644 --- a/test/plugin-cloud-storage/e2e.spec.ts +++ b/test/plugin-cloud-storage/e2e.spec.ts @@ -7,7 +7,7 @@ import { fileURLToPath } from 'url' import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { mediaSlug } from './shared.js' diff --git a/test/plugin-cloud-storage/int.compositePrefixes.int.spec.ts b/test/plugin-cloud-storage/int.compositePrefixes.int.spec.ts index 721b10dd2de..3f887407769 100644 --- a/test/plugin-cloud-storage/int.compositePrefixes.int.spec.ts +++ b/test/plugin-cloud-storage/int.compositePrefixes.int.spec.ts @@ -7,7 +7,7 @@ import shelljs from 'shelljs' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { collectionPrefix, mediaWithCompositePrefixesSlug } from './shared.js' import { clearTestBucket, createTestBucket } from './utils.js' diff --git a/test/plugin-cloud-storage/int.spec.ts b/test/plugin-cloud-storage/int.spec.ts index f8e9cc3394e..7389b5ba803 100644 --- a/test/plugin-cloud-storage/int.spec.ts +++ b/test/plugin-cloud-storage/int.spec.ts @@ -11,10 +11,10 @@ import shelljs from 'shelljs' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Config } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { mediaSlug, mediaWithCustomURLSlug, diff --git a/test/plugin-ecommerce/e2e.spec.ts b/test/plugin-ecommerce/e2e.spec.ts index 3b73e917d60..809af0c2715 100644 --- a/test/plugin-ecommerce/e2e.spec.ts +++ b/test/plugin-ecommerce/e2e.spec.ts @@ -10,8 +10,8 @@ import type { Config } from './payload-types.js' import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/plugin-ecommerce/int.spec.ts b/test/plugin-ecommerce/int.spec.ts index dc7010353e9..72b8ca73dc7 100644 --- a/test/plugin-ecommerce/int.spec.ts +++ b/test/plugin-ecommerce/int.spec.ts @@ -3,9 +3,9 @@ import { type Payload } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload let restClient: NextRESTClient diff --git a/test/plugin-form-builder/e2e.spec.ts b/test/plugin-form-builder/e2e.spec.ts index 93db62cf64a..4483e27308f 100644 --- a/test/plugin-form-builder/e2e.spec.ts +++ b/test/plugin-form-builder/e2e.spec.ts @@ -12,7 +12,7 @@ import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { selectInput } from '../__helpers/e2e/selectInput.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { documentsSlug, formsSlug, formSubmissionsSlug, mediaSlug } from './shared.js' diff --git a/test/plugin-form-builder/int.spec.ts b/test/plugin-form-builder/int.spec.ts index 6d6563cce31..509c0814127 100644 --- a/test/plugin-form-builder/int.spec.ts +++ b/test/plugin-form-builder/int.spec.ts @@ -5,14 +5,14 @@ import { ValidationError } from 'payload' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Form } from './payload-types.js' import { handleUploads } from '../../packages/plugin-form-builder/src/collections/FormSubmissions/hooks/handleUploads.js' import { keyValuePairToHtmlTable } from '../../packages/plugin-form-builder/src/utilities/keyValuePairToHtmlTable.js' import { serializeLexical } from '../../packages/plugin-form-builder/src/utilities/lexical/serializeLexical.js' import { replaceDoubleCurlys } from '../../packages/plugin-form-builder/src/utilities/replaceDoubleCurlys.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { createStreamableFile } from '../uploads/createStreamableFile.js' import { documentsSlug, formsSlug, formSubmissionsSlug, mediaSlug } from './shared.js' diff --git a/test/plugin-import-export/e2e.spec.ts b/test/plugin-import-export/e2e.spec.ts index f29c0e7189c..dbbce5ba5e9 100644 --- a/test/plugin-import-export/e2e.spec.ts +++ b/test/plugin-import-export/e2e.spec.ts @@ -17,7 +17,7 @@ import { getSelectMenu } from '../__helpers/e2e/selectInput.js' import { setPerPageLimit } from '../__helpers/e2e/setPerPageLimit.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { readCSV } from './helpers.js' import { diff --git a/test/plugin-import-export/field-hooks.int.spec.ts b/test/plugin-import-export/field-hooks.int.spec.ts index 20f96262d5a..80816de9585 100644 --- a/test/plugin-import-export/field-hooks.int.spec.ts +++ b/test/plugin-import-export/field-hooks.int.spec.ts @@ -4,9 +4,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { readCSV, readJSON } from './helpers.js' import { postsWithFieldHooksSlug } from './shared.js' diff --git a/test/plugin-import-export/hooks.int.spec.ts b/test/plugin-import-export/hooks.int.spec.ts index e2d9e87716b..55eb8468dde 100644 --- a/test/plugin-import-export/hooks.int.spec.ts +++ b/test/plugin-import-export/hooks.int.spec.ts @@ -4,9 +4,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { readCSV, readJSON } from './helpers.js' import { hookCalls, resetHookSpies } from './hookSpies.js' diff --git a/test/plugin-import-export/int.spec.ts b/test/plugin-import-export/int.spec.ts index 82e9d729c5f..2ac3e599d83 100644 --- a/test/plugin-import-export/int.spec.ts +++ b/test/plugin-import-export/int.spec.ts @@ -7,9 +7,9 @@ import { extractID } from 'payload/shared' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser, regularUser } from '../credentials.js' import { clearTestBucket, createTestBucket } from '../storage-s3/test-utils.js' import { readCSV, readJSON } from './helpers.js' diff --git a/test/plugin-mcp/e2e.spec.ts b/test/plugin-mcp/e2e.spec.ts index 09a3317665e..dc222447d6a 100644 --- a/test/plugin-mcp/e2e.spec.ts +++ b/test/plugin-mcp/e2e.spec.ts @@ -6,7 +6,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { devUser } from '../credentials.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' diff --git a/test/plugin-mcp/helpers/mcpClient.ts b/test/plugin-mcp/helpers/mcpClient.ts index aa1c687923c..0ee536eff4f 100644 --- a/test/plugin-mcp/helpers/mcpClient.ts +++ b/test/plugin-mcp/helpers/mcpClient.ts @@ -1,6 +1,6 @@ import type { Client, ProtocolEra } from '@modelcontextprotocol/client' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' import type { McpHTTPResponse } from './realMcpClient.js' import { connectMcpClient } from './realMcpClient.js' diff --git a/test/plugin-mcp/helpers/mcpFixtures.ts b/test/plugin-mcp/helpers/mcpFixtures.ts index 55e5103826d..92e75c82ca5 100644 --- a/test/plugin-mcp/helpers/mcpFixtures.ts +++ b/test/plugin-mcp/helpers/mcpFixtures.ts @@ -7,10 +7,10 @@ import { fileURLToPath } from 'url' import { test as base, onTestFinished } from 'vitest' import type { TestRBAC } from '../../__helpers/plugins/rbac/index.js' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' import type { McpClient } from './mcpClient.js' -import { initPayloadInt } from '../../__setup/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/int/initPayloadInt.js' import { devUser } from '../../credentials.js' import { createMcpClient } from './mcpClient.js' diff --git a/test/plugin-mcp/helpers/realMcpClient.ts b/test/plugin-mcp/helpers/realMcpClient.ts index 5954e5be597..bf650a5fb86 100644 --- a/test/plugin-mcp/helpers/realMcpClient.ts +++ b/test/plugin-mcp/helpers/realMcpClient.ts @@ -2,7 +2,7 @@ import type { ProtocolEra } from '@modelcontextprotocol/client' import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' /** * Connects a real MCP client and returns it after the initialize handshake. diff --git a/test/plugin-multi-tenant/e2e.spec.ts b/test/plugin-multi-tenant/e2e.spec.ts index 4eb7600ea9a..2b64ac067da 100644 --- a/test/plugin-multi-tenant/e2e.spec.ts +++ b/test/plugin-multi-tenant/e2e.spec.ts @@ -23,7 +23,7 @@ import { closeNav, openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { credentials } from './credentials.js' import { diff --git a/test/plugin-multi-tenant/int.spec.ts b/test/plugin-multi-tenant/int.spec.ts index 5f0d7fd5e07..8f01b154e4e 100644 --- a/test/plugin-multi-tenant/int.spec.ts +++ b/test/plugin-multi-tenant/int.spec.ts @@ -4,10 +4,10 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Relationship } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { menuSlug, diff --git a/test/plugin-nested-docs/e2e.spec.ts b/test/plugin-nested-docs/e2e.spec.ts index c50165ed7a9..f6f80a13a24 100644 --- a/test/plugin-nested-docs/e2e.spec.ts +++ b/test/plugin-nested-docs/e2e.spec.ts @@ -8,7 +8,7 @@ import type { Config, Page as PayloadPage } from './payload-types.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/plugin-nested-docs/int.spec.ts b/test/plugin-nested-docs/int.spec.ts index 0705b942c1c..d68de3b58de 100644 --- a/test/plugin-nested-docs/int.spec.ts +++ b/test/plugin-nested-docs/int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' import type { Page } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload diff --git a/test/plugin-redirects/e2e.spec.ts b/test/plugin-redirects/e2e.spec.ts index f2244400ea6..ec7b1ebf72b 100644 --- a/test/plugin-redirects/e2e.spec.ts +++ b/test/plugin-redirects/e2e.spec.ts @@ -10,7 +10,7 @@ import type { Config } from './payload-types.js' import { saveDocAndAssert } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/plugin-redirects/int.spec.ts b/test/plugin-redirects/int.spec.ts index 975f2669f8e..b2ce16bed0b 100644 --- a/test/plugin-redirects/int.spec.ts +++ b/test/plugin-redirects/int.spec.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'url' import type { Page } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { pagesSlug } from './shared.js' let payload: Payload diff --git a/test/plugin-search/int.spec.ts b/test/plugin-search/int.spec.ts index ded49508dfe..2ba4b077796 100644 --- a/test/plugin-search/int.spec.ts +++ b/test/plugin-search/int.spec.ts @@ -5,9 +5,9 @@ import { wait } from 'payload/shared' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { pagesSlug, postsSlug } from './shared.js' diff --git a/test/plugin-sentry/int.spec.ts b/test/plugin-sentry/int.spec.ts index 33c9a2dbb97..7ffc98af464 100644 --- a/test/plugin-sentry/int.spec.ts +++ b/test/plugin-sentry/int.spec.ts @@ -4,7 +4,7 @@ import { describe, beforeAll, afterAll, it } from 'vitest' import path from 'path' import { fileURLToPath } from 'url' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload diff --git a/test/plugin-seo/e2e.spec.ts b/test/plugin-seo/e2e.spec.ts index 0b0b4f40979..edf89b410ad 100644 --- a/test/plugin-seo/e2e.spec.ts +++ b/test/plugin-seo/e2e.spec.ts @@ -13,8 +13,8 @@ import { switchTab, waitForFormReady } from '../__helpers/e2e/helpers.js' import { runAxeScan } from '../__helpers/e2e/runAxeScan.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { mediaSlug } from './shared.js' diff --git a/test/plugin-seo/int.spec.ts b/test/plugin-seo/int.spec.ts index 1b59639d952..3658403e4b4 100644 --- a/test/plugin-seo/int.spec.ts +++ b/test/plugin-seo/int.spec.ts @@ -5,7 +5,7 @@ import { getFileByPath } from 'payload' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { removeFiles } from '../__helpers/shared/removeFiles.js' import { mediaSlug } from './shared.js' diff --git a/test/plugin-stripe/int.spec.ts b/test/plugin-stripe/int.spec.ts index d4bd8afd6e2..1058303df6a 100644 --- a/test/plugin-stripe/int.spec.ts +++ b/test/plugin-stripe/int.spec.ts @@ -4,7 +4,7 @@ import { describe, beforeAll, afterAll, it, expect } from 'vitest' import path from 'path' import { fileURLToPath } from 'url' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload diff --git a/test/plugins/int.spec.ts b/test/plugins/int.spec.ts index 72ecf4661e3..09ec18688a5 100644 --- a/test/plugins/int.spec.ts +++ b/test/plugins/int.spec.ts @@ -6,7 +6,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { ReaderPluginOptions } from './config.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { pagesSlug } from './config.js' let payload: Payload diff --git a/test/query-presets/e2e.spec.ts b/test/query-presets/e2e.spec.ts index 236db450843..81772b98960 100644 --- a/test/query-presets/e2e.spec.ts +++ b/test/query-presets/e2e.spec.ts @@ -15,8 +15,8 @@ import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { assertURLParams } from './helpers/assertURLParams.js' import { openQueryPresetDrawer } from './helpers/openQueryPresetDrawer.js' diff --git a/test/query-presets/int.spec.ts b/test/query-presets/int.spec.ts index e01a81080d6..ea3debf61d4 100644 --- a/test/query-presets/int.spec.ts +++ b/test/query-presets/int.spec.ts @@ -5,7 +5,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { devUser, regularUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' const queryPresetsCollectionSlug = 'payload-query-presets' diff --git a/test/queues/cli.int.spec.ts b/test/queues/cli.int.spec.ts index 786f3e58c27..0f255887407 100644 --- a/test/queues/cli.int.spec.ts +++ b/test/queues/cli.int.spec.ts @@ -10,7 +10,7 @@ import { wait } from 'payload/shared' import { fileURLToPath } from 'url' import { beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { waitUntilAutorunIsDone } from './utilities.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/queues/e2e.spec.ts b/test/queues/e2e.spec.ts index 0d0228af95b..069ab9e323c 100644 --- a/test/queues/e2e.spec.ts +++ b/test/queues/e2e.spec.ts @@ -9,7 +9,7 @@ import type { Config } from './payload-types.js' import { login } from '../__helpers/e2e/auth/login.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/queues/int.spec.ts b/test/queues/int.spec.ts index 17c2472f5f9..fd156b4b5d2 100644 --- a/test/queues/int.spec.ts +++ b/test/queues/int.spec.ts @@ -13,10 +13,10 @@ import { wait } from 'payload/shared' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { it } from '../__helpers/int/vitest.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { clearAndSeedEverything } from './seed.js' import { waitUntilAutorunIsDone } from './utilities.js' diff --git a/test/queues/postgres-logs.int.spec.ts b/test/queues/postgres-logs.int.spec.ts index 88631018d89..c3de6742d7f 100644 --- a/test/queues/postgres-logs.int.spec.ts +++ b/test/queues/postgres-logs.int.spec.ts @@ -5,7 +5,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it, vitest } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { withoutAutoRun } from './utilities.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/queues/schedules-autocron.int.spec.ts b/test/queues/schedules-autocron.int.spec.ts index d5fa2ced9ee..03d6b705879 100644 --- a/test/queues/schedules-autocron.int.spec.ts +++ b/test/queues/schedules-autocron.int.spec.ts @@ -4,10 +4,10 @@ import { wait } from 'payload/shared' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { clearAndSeedEverything } from './seed.js' let payload: Payload diff --git a/test/queues/schedules.int.spec.ts b/test/queues/schedules.int.spec.ts index 483f15a546b..9c09f97367a 100644 --- a/test/queues/schedules.int.spec.ts +++ b/test/queues/schedules.int.spec.ts @@ -4,10 +4,10 @@ import { _internal_jobSystemGlobals, _internal_resetJobSystemGlobals, type Paylo import { wait } from 'payload/shared' import { fileURLToPath } from 'url' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import { devUser } from '../credentials.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { clearAndSeedEverything } from './seed.js' import { timeFreeze, timeTravel, waitUntilAutorunIsDone, withoutAutoRun } from './utilities.js' diff --git a/test/relationships/int.spec.ts b/test/relationships/int.spec.ts index 8f7babdd160..a7add252238 100644 --- a/test/relationships/int.spec.ts +++ b/test/relationships/int.spec.ts @@ -5,7 +5,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { ChainedRelation, CustomIdNumberRelation, @@ -17,7 +17,7 @@ import type { Relation, } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { mongooseList } from '../__helpers/shared/isMongoose.js' import { chainedRelSlug, diff --git a/test/sdk/int.spec.ts b/test/sdk/int.spec.ts index bda26047cf0..0aaf7bd6d14 100644 --- a/test/sdk/int.spec.ts +++ b/test/sdk/int.spec.ts @@ -6,10 +6,10 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { TypedPayloadSDK } from '../__helpers/shared/getSDK.js' +import type { TypedPayloadSDK } from '../__setup/int/getSDK.js' import type { Email, Post } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { createStreamableFile } from '../uploads/createStreamableFile.js' import { emailsSlug } from './collections/Emails.js' diff --git a/test/select/int.spec.ts b/test/select/int.spec.ts index cc52d244660..50d897d403a 100644 --- a/test/select/int.spec.ts +++ b/test/select/int.spec.ts @@ -7,7 +7,7 @@ import { assert } from 'ts-essentials' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Config, DeepPost, @@ -19,7 +19,7 @@ import type { VersionedPost, } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' let payload: Payload diff --git a/test/select/postgreslogs.int.spec.ts b/test/select/postgreslogs.int.spec.ts index c9745f722cc..b277ea5326e 100644 --- a/test/select/postgreslogs.int.spec.ts +++ b/test/select/postgreslogs.int.spec.ts @@ -7,7 +7,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vites import type { Point, Post } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' let payload: Payload diff --git a/test/server-functions/e2e.spec.ts b/test/server-functions/e2e.spec.ts index bc4c3504b2c..60c9149e875 100644 --- a/test/server-functions/e2e.spec.ts +++ b/test/server-functions/e2e.spec.ts @@ -11,7 +11,7 @@ import type { Config } from './payload-types.js' import { getRoutes } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { devUser } from '../credentials.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' diff --git a/test/server-url/e2e.spec.ts b/test/server-url/e2e.spec.ts index 5ce89a77a40..00512ad758d 100644 --- a/test/server-url/e2e.spec.ts +++ b/test/server-url/e2e.spec.ts @@ -8,7 +8,7 @@ import { login } from '../__helpers/e2e/auth/login.js' import { logoutViaNav } from '../__helpers/e2e/auth/logout.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/sort/e2e.spec.ts b/test/sort/e2e.spec.ts index f9ef7102a10..a6bad4b4a9c 100644 --- a/test/sort/e2e.spec.ts +++ b/test/sort/e2e.spec.ts @@ -15,7 +15,7 @@ import { moveRow } from '../__helpers/e2e/sort/moveRow.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { orderableSlug } from './collections/Orderable/index.js' import { orderableJoinSlug } from './collections/OrderableJoin/index.js' diff --git a/test/sort/int.spec.ts b/test/sort/int.spec.ts index caef7fe6637..c3ff554c3b9 100644 --- a/test/sort/int.spec.ts +++ b/test/sort/int.spec.ts @@ -5,10 +5,10 @@ import * as qs from 'qs-esm' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Draft, Orderable, OrderableJoin } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { draftsSlug } from './collections/Drafts/index.js' import { nonUniqueSortSlug } from './collections/NonUniqueSort/index.js' import { orderableSlug } from './collections/Orderable/index.js' diff --git a/test/storage-azure/client-uploads/e2e.spec.ts b/test/storage-azure/client-uploads/e2e.spec.ts index c19f5dc5692..5c5a5f7304a 100644 --- a/test/storage-azure/client-uploads/e2e.spec.ts +++ b/test/storage-azure/client-uploads/e2e.spec.ts @@ -12,7 +12,7 @@ import type { PayloadTestSDK } from '../../__helpers/shared/sdk/index.js' import { saveDocAndAssert } from '../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../playwright.config.js' import { mediaWithDocPrefixSlug } from './collections/MediaWithDocPrefix.js' diff --git a/test/storage-azure/client-uploads/int.spec.ts b/test/storage-azure/client-uploads/int.spec.ts index 4230b7ac172..3ad6b700407 100644 --- a/test/storage-azure/client-uploads/int.spec.ts +++ b/test/storage-azure/client-uploads/int.spec.ts @@ -7,9 +7,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../../__setup/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/int/initPayloadInt.js' import { mediaSlug } from '../shared.js' import { mediaWithDocPrefixSlug } from './collections/MediaWithDocPrefix.js' diff --git a/test/storage-azure/int.spec.ts b/test/storage-azure/int.spec.ts index 918742ef7e0..cf712cc8f05 100644 --- a/test/storage-azure/int.spec.ts +++ b/test/storage-azure/int.spec.ts @@ -7,9 +7,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { mediaSlug, mediaWithPrefixSlug, prefix } from './shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/storage-azure/streamingUploads.int.spec.ts b/test/storage-azure/streamingUploads.int.spec.ts index 48df903dc20..82a8a7e55ea 100644 --- a/test/storage-azure/streamingUploads.int.spec.ts +++ b/test/storage-azure/streamingUploads.int.spec.ts @@ -7,9 +7,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { mediaSlug, mediaWithPrefixSlug, prefix } from './shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/storage-s3/client-uploads/e2e.spec.ts b/test/storage-s3/client-uploads/e2e.spec.ts index 854d45d6cfb..3438625ecaf 100644 --- a/test/storage-s3/client-uploads/e2e.spec.ts +++ b/test/storage-s3/client-uploads/e2e.spec.ts @@ -8,7 +8,7 @@ import { fileURLToPath } from 'url' import { exactText, gotoAndWaitForForm, saveDocAndAssert } from '../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../playwright.config.js' import { mediaSlug } from '../shared.js' diff --git a/test/storage-s3/client-uploads/int.spec.ts b/test/storage-s3/client-uploads/int.spec.ts index 0868f4d14cb..ca568650eaa 100644 --- a/test/storage-s3/client-uploads/int.spec.ts +++ b/test/storage-s3/client-uploads/int.spec.ts @@ -6,9 +6,9 @@ import { assert } from 'ts-essentials' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../../__setup/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/int/initPayloadInt.js' import { clearTestBucket, createTestBucket, diff --git a/test/storage-s3/int.spec.ts b/test/storage-s3/int.spec.ts index 1c729dfd3a5..f08b36595bf 100644 --- a/test/storage-s3/int.spec.ts +++ b/test/storage-s3/int.spec.ts @@ -4,9 +4,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { mediaSlug, mediaWithAlwaysInsertFieldsSlug, diff --git a/test/storage-s3/searchBeforeS3.int.spec.ts b/test/storage-s3/searchBeforeS3.int.spec.ts index 2b468998611..0306c72763e 100644 --- a/test/storage-s3/searchBeforeS3.int.spec.ts +++ b/test/storage-s3/searchBeforeS3.int.spec.ts @@ -4,7 +4,7 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { mediaSlug } from './shared.js' import { clearTestBucket, createTestBucket, verifyUploads } from './test-utils.js' diff --git a/test/storage-vercel-blob/client-uploads/compositePrefixes.int.spec.ts b/test/storage-vercel-blob/client-uploads/compositePrefixes.int.spec.ts index 5e95e2f77ed..29cd5abb46e 100644 --- a/test/storage-vercel-blob/client-uploads/compositePrefixes.int.spec.ts +++ b/test/storage-vercel-blob/client-uploads/compositePrefixes.int.spec.ts @@ -8,9 +8,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../../__setup/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/int/initPayloadInt.js' import { collectionPrefix, mediaWithCompositePrefixesSlug } from '../shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/storage-vercel-blob/client-uploads/e2e.spec.ts b/test/storage-vercel-blob/client-uploads/e2e.spec.ts index 0b1215a355c..b021cff31be 100644 --- a/test/storage-vercel-blob/client-uploads/e2e.spec.ts +++ b/test/storage-vercel-blob/client-uploads/e2e.spec.ts @@ -8,7 +8,7 @@ import { fileURLToPath } from 'url' import { exactText, gotoAndWaitForForm, saveDocAndAssert } from '../../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../../__setup/ensureCompilationIsDone.js' +import { ensureCompilationIsDone } from '../../__setup/e2e/ensureCompilationIsDone.js' import { TEST_TIMEOUT_LONG } from '../../playwright.config.js' import { mediaSlug } from '../shared.js' diff --git a/test/storage-vercel-blob/client-uploads/int.spec.ts b/test/storage-vercel-blob/client-uploads/int.spec.ts index bc0cde69a66..e0fd9a91c6d 100644 --- a/test/storage-vercel-blob/client-uploads/int.spec.ts +++ b/test/storage-vercel-blob/client-uploads/int.spec.ts @@ -8,9 +8,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../../__setup/initPayloadInt.js' +import { initPayloadInt } from '../../__setup/int/initPayloadInt.js' import { prefix } from '../shared.js' const filename = fileURLToPath(import.meta.url) diff --git a/test/storage-vercel-blob/int.spec.ts b/test/storage-vercel-blob/int.spec.ts index 091624f8793..72ff7f18d60 100644 --- a/test/storage-vercel-blob/int.spec.ts +++ b/test/storage-vercel-blob/int.spec.ts @@ -5,9 +5,9 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { mediaSlug, mediaWithAlwaysInsertFieldsSlug, diff --git a/test/tags/e2e.spec.ts b/test/tags/e2e.spec.ts index 915fdfdea95..fc5eefda4b8 100644 --- a/test/tags/e2e.spec.ts +++ b/test/tags/e2e.spec.ts @@ -10,7 +10,7 @@ import type { Config, Tag } from './payload-types.js' import { openNav } from '../__helpers/e2e/toggleNav.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { initPage } from '../__setup/initPage.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { tagsSlug } from './config.js' diff --git a/test/tags/int.spec.ts b/test/tags/int.spec.ts index 63a296cc6d1..a5b7f5d4e20 100644 --- a/test/tags/int.spec.ts +++ b/test/tags/int.spec.ts @@ -6,7 +6,7 @@ import { renderToStaticMarkup } from 'react-dom/server' import { fileURLToPath } from 'url' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/trash/e2e.spec.ts b/test/trash/e2e.spec.ts index 9b168b14f89..a73d2884dc9 100644 --- a/test/trash/e2e.spec.ts +++ b/test/trash/e2e.spec.ts @@ -12,8 +12,8 @@ import { changeLocale, closeAllToasts } from '../__helpers/e2e/helpers.js' import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { TEST_TIMEOUT_LONG } from '../playwright.config.js' import { pagesSlug } from './collections/Pages/index.js' import { postsSlug } from './collections/Posts/index.js' diff --git a/test/trash/int.spec.ts b/test/trash/int.spec.ts index 7dcd294e498..9ba3b1ad019 100644 --- a/test/trash/int.spec.ts +++ b/test/trash/int.spec.ts @@ -4,11 +4,11 @@ import path from 'path' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { DifferentiatedTrashCollection, Post, RestrictedCollection } from './payload-types.js' import { idToString } from '../__helpers/shared/idToString.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser, regularUser } from '../credentials.js' import { differentiatedTrashCollectionSlug } from './collections/DifferentiatedTrashCollection/index.js' import { pagesSlug } from './collections/Pages/index.js' diff --git a/test/uploads/e2e.spec.ts b/test/uploads/e2e.spec.ts index e7f8b3f3b68..c2d5d2fc9f2 100644 --- a/test/uploads/e2e.spec.ts +++ b/test/uploads/e2e.spec.ts @@ -31,8 +31,8 @@ import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB. import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' import { RESTClient } from '../__helpers/shared/rest.js' import { startTestFileServer } from '../__helpers/shared/startTestFileServer.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { adminThumbnailFunctionSlug, diff --git a/test/uploads/int.spec.ts b/test/uploads/int.spec.ts index 0408efb23cb..7900c4b2006 100644 --- a/test/uploads/int.spec.ts +++ b/test/uploads/int.spec.ts @@ -11,7 +11,7 @@ import { fileURLToPath } from 'url' import { promisify } from 'util' import { afterAll, afterEach, beforeAll, describe, expect, it, vitest } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { Enlarge, Media } from './payload-types.js' // eslint-disable-next-line payload/no-relative-monorepo-imports @@ -20,7 +20,7 @@ import { checkFileRestrictions } from '../../packages/payload/src/uploads/checkF import { getExternalFile } from '../../packages/payload/src/uploads/getExternalFile.js' // eslint-disable-next-line payload/no-relative-monorepo-imports import { tempFileHandler } from '../../packages/payload/src/uploads/fetchAPI-multipart/handlers.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { createStreamableFile } from './createStreamableFile.js' import { adminThumbnailSizeSlug, diff --git a/test/uuid-v7/int.spec.ts b/test/uuid-v7/int.spec.ts index 60ff65910f5..e4c6e8b5758 100644 --- a/test/uuid-v7/int.spec.ts +++ b/test/uuid-v7/int.spec.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url' import { validate as uuidValidate } from 'uuid' import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) diff --git a/test/versions/e2e.spec.ts b/test/versions/e2e.spec.ts index 434e751234d..ddce94ba234 100644 --- a/test/versions/e2e.spec.ts +++ b/test/versions/e2e.spec.ts @@ -53,8 +53,8 @@ import { waitForAutoSaveToRunAndComplete } from '../__helpers/e2e/waitForAutoSav import { AdminUrlUtil } from '../__helpers/shared/adminUrlUtil.js' import { reInitializeDB } from '../__helpers/shared/clearAndSeed/reInitializeDB.js' import { initPayloadE2ENoConfig } from '../__helpers/shared/initPayloadE2ENoConfig.js' -import { ensureCompilationIsDone } from '../__setup/ensureCompilationIsDone.js' -import { initPage } from '../__setup/initPage.js' +import { ensureCompilationIsDone } from '../__setup/e2e/ensureCompilationIsDone.js' +import { initPage } from '../__setup/e2e/initPage.js' import { postsCollectionSlug } from '../admin/slugs.js' import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../playwright.config.js' import { draftWithCustomUnpublishSlug } from './collections/DraftsWithCustomUnpublish.js' diff --git a/test/versions/int.spec.ts b/test/versions/int.spec.ts index 123c1e9e535..59c1b2dc0aa 100644 --- a/test/versions/int.spec.ts +++ b/test/versions/int.spec.ts @@ -9,10 +9,10 @@ import * as qs from 'qs-esm' import { fileURLToPath } from 'url' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest' -import type { NextRESTClient } from '../__helpers/shared/NextRESTClient.js' +import type { NextRESTClient } from '../__setup/int/NextRESTClient.js' import type { AutosaveMultiSelectPost, DraftPost } from './payload-types.js' -import { initPayloadInt } from '../__setup/initPayloadInt.js' +import { initPayloadInt } from '../__setup/int/initPayloadInt.js' import { devUser } from '../credentials.js' import { cloudStorageDeletedFilenames } from './collections/DraftsWithUploadCloudStorage.js' import { From 7767692f3c98d876df5e3ac1868c07275318e27a Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 18:12:31 -0400 Subject: [PATCH 06/16] chore: reset the auth password through the API, not the admin UI The `passwords` teardown drove the account view to restore the dev user's password, which made cleanup depend on the shared page surviving the whole spec file and being hydrated, plus a save toast. When the page was gone by teardown it failed with "Target page, context or browser has been closed", and Playwright attributed that single hook failure to every test in the describe. Resetting via the local API needs none of that. --- test/auth/e2e.spec.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/auth/e2e.spec.ts b/test/auth/e2e.spec.ts index 806bc463fe4..83cf11543c9 100644 --- a/test/auth/e2e.spec.ts +++ b/test/auth/e2e.spec.ts @@ -177,12 +177,20 @@ describe('Auth', () => { }) afterAll(async () => { - // reset password to original password - await page.goto(url.account) - await page.locator('#change-password').click() - await page.locator('#field-password').fill(devUser.password) - await page.locator('#field-confirm-password').fill(devUser.password) - await saveDocAndAssert(page, '#action-save') + // Reset the password through the API rather than the admin UI. This is cleanup, not + // a test, and driving the UI made it depend on the shared page still being alive at + // teardown — which fails with "Target page, context or browser has been closed". + const { docs } = await payload.find({ + collection: slug, + limit: 1, + where: { email: { equals: devUser.email } }, + }) + + await payload.update({ + collection: slug, + id: docs[0]!.id, + data: { password: devUser.password }, + }) }) // TODO: This test is unreliable. During development, the bundle sent to the client will include debug information. From a410ef8f56296ac60547e61e30e2769403febcd9 Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 18:22:34 -0400 Subject: [PATCH 07/16] chore: restore the default @payload-config path --- tsconfig.base.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.base.json b/tsconfig.base.json index d2fbf746437..5d3b1fcaf45 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -32,7 +32,7 @@ ], "paths": { "@payloadcms/figma": ["../enterprise-plugins/packages/figma/src/index.ts"], - "@payload-config": ["./test/admin/config.ts"], + "@payload-config": ["./test/_community/config.ts"], "@payloadcms/admin-bar": ["./packages/admin-bar/src"], "@payloadcms/live-preview": ["./packages/live-preview/src"], "@payloadcms/live-preview-react": ["./packages/live-preview-react/src/index.ts"], From 41be5482773b9585e5e5e560a173659223e251eb Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 19:18:01 -0400 Subject: [PATCH 08/16] fix refresh server fn e2e --- test/auth/e2e.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/auth/e2e.spec.ts b/test/auth/e2e.spec.ts index 1779230bfca..2624d80bffa 100644 --- a/test/auth/e2e.spec.ts +++ b/test/auth/e2e.spec.ts @@ -595,7 +595,6 @@ describe('Auth', () => { ) expect(initialCookie).toBeDefined() - await wait(1000) await page.getByText('Custom Refresh', { exact: true }).click() await expect(page.getByRole('status').filter({ hasText: 'Token refreshed' })).toBeVisible() From 0bd8b30d0e42b8275dd56eaca41924123bdb0e8a Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 19:44:18 -0400 Subject: [PATCH 09/16] chore: gate the hydration wait on the admin shell, not the view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wait was keyed off the view template, which is part of the view — so on any page whose view had not rendered yet the guard saw nothing to wait for and skipped the wait entirely, leaving the original race. Measured on /admin/server-functions, the template was absent at marker-true in 3 of 3 runs while the shell was present in 3 of 3. --- test/__setup/e2e/patchPageMethods.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/test/__setup/e2e/patchPageMethods.ts b/test/__setup/e2e/patchPageMethods.ts index b23a42bafb0..ac5f14d76ea 100644 --- a/test/__setup/e2e/patchPageMethods.ts +++ b/test/__setup/e2e/patchPageMethods.ts @@ -6,6 +6,13 @@ import type { Page } from '@playwright/test' */ const ADMIN_TEMPLATE_SELECTOR = '.template-default, .template-minimal' +/** + * Part of the admin document shell rather than the view, so it is in the DOM from the + * first byte. Used to tell "this is an admin page whose view has not arrived yet" apart + * from "this page has no admin view at all", which the view selector cannot distinguish. + */ +const ADMIN_SHELL_SELECTOR = '.payload__modal-container' + /** * Patches `page.goto()` / `page.reload()` so it only returns once the admin view is interactive. * @@ -53,12 +60,16 @@ export function patchPageMethods(page: Page) { { timeout: 15000 }, ) - // Router-idle lands 60-135ms BEFORE React commits the view. In that gap the SSR'd - // markup is still on screen but doomed: it gets torn down and replaced by nodes React - // owns, so a click there targets an element that ceases to exist. Wait for the admin - // template to carry React's internal keys, which happens in the same commit as every - // interactive element inside it. - if (await page.locator(ADMIN_TEMPLATE_SELECTOR).count()) { + // Router-idle can land before React has even rendered the view, let alone committed + // it. In that gap the SSR'd markup is either absent or doomed — it gets torn down and + // replaced by nodes React owns — so an interaction there targets an element that does + // not exist yet or is about to stop existing. Wait for the admin template to carry + // React's internal keys, which happens in the same commit as every interactive element + // inside it. + // + // Gate on the shell, not the template: the template is part of the view, so keying off + // it skips this wait exactly when the view has yet to render. + if (await page.locator(ADMIN_SHELL_SELECTOR).count()) { await page.waitForFunction( (selector) => { const el = document.querySelector(selector) From ce5364cd64c4f56fbd1892bdafe5209268286aa0 Mon Sep 17 00:00:00 2001 From: Jake Fletcher Date: Wed, 29 Jul 2026 20:11:23 -0400 Subject: [PATCH 10/16] chore: detect the tanstack app from the page, not the environment `patchPageMethods` gated every hydration wait on `PAYLOAD_FRAMEWORK`, which the CLI runner sets but editor test runners do not. Running the suite from an editor against a TanStack dev server therefore disabled the waits silently while the tests still ran, so interactions after `page.goto` raced again and the server-function tests failed. `HydrationMarker` renders a marker element instead of returning null, and the wrapper looks for that. It has to be server-rendered markup rather than a global: the existing `window.__TANSTACK_*` flags are only assigned during hydration, which is after `goto` resolves and so too late to decide whether to wait. --- .../components/HydrationMarker/index.tsx | 7 +++++- test/__setup/e2e/patchPageMethods.ts | 25 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/test/__helpers/components/HydrationMarker/index.tsx b/test/__helpers/components/HydrationMarker/index.tsx index 9ce3cb019ff..055135e145e 100644 --- a/test/__helpers/components/HydrationMarker/index.tsx +++ b/test/__helpers/components/HydrationMarker/index.tsx @@ -31,5 +31,10 @@ export function HydrationMarker() { ;(window as unknown as { __TANSTACK_HYDRATED__?: boolean }).__TANSTACK_HYDRATED__ = isReady }, [isReady]) - return null + // Rendered rather than set on `window` so it is in the server HTML from the first byte. The + // Playwright wrapper needs to know it is driving the TanStack app *before* any script has + // run, since that is precisely when it has to decide whether to wait. Only the TanStack test + // apps render this, so it also stands in for `PAYLOAD_FRAMEWORK`, which the CLI runner sets + // but editor test runners do not. + return