test: removes all unnecessary page.waitForURL methods (#11412)

Removes all unnecessary `page.waitForURL` methods within e2e tests.
These are unneeded when following a `page.goto` call because the
subsequent page load is already being awaited.

It is only a requirement when:

- Clicking a link and expecting navigation
- Expecting a redirect after a route change
- Waiting for a change in search params
This commit is contained in:
Jacob Fletcher
2025-02-26 16:54:39 -05:00
committed by GitHub
parent b540da53ec
commit b975858e76
22 changed files with 31 additions and 134 deletions

View File

@@ -2,6 +2,7 @@ import type { Page } from '@playwright/test'
import { expect, test } from '@playwright/test'
import path from 'path'
import { wait } from 'payload/shared'
import { fileURLToPath } from 'url'
import {
@@ -32,7 +33,6 @@ import {
ssrAutosavePagesSlug,
ssrPagesSlug,
} from './shared.js'
import { wait } from 'payload/shared'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
@@ -210,7 +210,6 @@ describe('Live Preview', () => {
test('global — has tab', async () => {
const global = new AdminUrlUtil(serverURL, 'header')
await page.goto(global.global('header'))
await page.waitForURL(global.global('header'))
const docURL = page.url()
const pathname = new URL(docURL).pathname
@@ -248,7 +247,6 @@ describe('Live Preview', () => {
test('device — properly measures size', async () => {
await page.goto(pagesURLUtil.create)
await page.waitForURL(pagesURLUtil.create)
await page.locator('#field-title').fill('Title 3')
await page.locator('#field-slug').fill('slug-3')
@@ -297,7 +295,6 @@ describe('Live Preview', () => {
test('device — resizes to specified breakpoint', async () => {
await page.goto(pagesURLUtil.create)
await page.waitForURL(pagesURLUtil.create)
await page.locator('#field-title').fill('Title 4')
await page.locator('#field-slug').fill('slug-4')

View File

@@ -13,7 +13,6 @@ export const goToCollectionLivePreview = async (
): Promise<void> => {
await navigateToDoc(page, urlUtil)
await page.goto(`${page.url()}/preview`)
await page.waitForURL(`**/preview`)
}
export const goToGlobalLivePreview = async (
@@ -24,7 +23,6 @@ export const goToGlobalLivePreview = async (
const global = new AdminUrlUtil(serverURL, slug)
const previewURL = `${global.global(slug)}/preview`
await page.goto(previewURL)
await page.waitForURL(previewURL)
}
export const selectLivePreviewBreakpoint = async (page: Page, breakpointLabel: string) => {