fixes more tests

This commit is contained in:
Jarrod Flesch
2025-05-16 13:37:25 -04:00
parent decd512daa
commit d90afba70d
2 changed files with 21 additions and 10 deletions

View File

@@ -1,7 +1,8 @@
import type { Page } from '@playwright/test'
import type { BrowserContext, Page } from '@playwright/test'
import { expect, test } from '@playwright/test'
import * as path from 'path'
import { wait } from 'payload/shared'
import { adminRoute } from 'shared.js'
import { fileURLToPath } from 'url'
@@ -10,6 +11,7 @@ import {
initPageConsoleErrorCatch,
login,
saveDocAndAssert,
throttleTest,
} from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js'
@@ -17,6 +19,7 @@ import { TEST_TIMEOUT_LONG } from '../playwright.config.js'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
let context: BrowserContext
test.describe('Admin Panel (Root)', () => {
let page: Page
@@ -30,7 +33,7 @@ test.describe('Admin Panel (Root)', () => {
admin: adminRoute,
})
const context = await browser.newContext()
context = await browser.newContext()
page = await context.newPage()
initPageConsoleErrorCatch(page)
@@ -54,6 +57,14 @@ test.describe('Admin Panel (Root)', () => {
})
})
// test.beforeEach(async () => {
// await throttleTest({
// page,
// context,
// delay: 'Fast 4G',
// })
// })
test('renders admin panel at root', async () => {
await page.goto(url.admin)
const pageURL = page.url()
@@ -99,7 +110,7 @@ test.describe('Admin Panel (Root)', () => {
test('global — renders versions list', async () => {
await page.goto(url.global('menu'))
const textField = page.locator('#field-globalText')
await textField.fill('test')
await textField.fill('updated global text')
await saveDocAndAssert(page)
await page.goto(`${url.global('menu')}/versions`)