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`)

View File

@@ -92,7 +92,7 @@ test.describe('Bulk Edit', () => {
await selectTableRow(page, titleOfPostToDelete2)
await page.locator('.delete-documents__toggle').click()
await page.locator('#delete-posts #confirm-action').click()
await page.locator('#confirm-delete-many-docs #confirm-action').click()
await expect(page.locator('.payload-toast-container .toast-success')).toContainText(
'Deleted 2 Posts successfully.',
@@ -121,7 +121,7 @@ test.describe('Bulk Edit', () => {
await selectTableRow(page, titleOfPostToPublish1)
await selectTableRow(page, titleOfPostToPublish2)
await page.locator('.publish-many__toggle').click()
await page.locator('.list-selection__button[aria-label="Publish"]').click()
await page.locator('#publish-posts #confirm-action').click()
await expect(page.locator('.payload-toast-container .toast-success')).toContainText(
@@ -151,7 +151,7 @@ test.describe('Bulk Edit', () => {
await selectTableRow(page, titleOfPostToUnpublish1)
await selectTableRow(page, titleOfPostToUnpublish2)
await page.locator('.unpublish-many__toggle').click()
await page.locator('.list-selection__button[aria-label="Unpublish"]').click()
await page.locator('#unpublish-posts #confirm-action').click()
await expect(findTableCell(page, '_status', titleOfPostToUnpublish1)).toContainText('Draft')
@@ -287,8 +287,8 @@ test.describe('Bulk Edit', () => {
await expect(page.locator('.table table > tbody > tr')).toHaveCount(3)
await page.locator('input#select-all').check()
await page.locator('.delete-documents__toggle').click()
await page.locator('#delete-posts #confirm-action').click()
await page.locator('.list-selection__button[aria-label="Delete"]').click()
await page.locator('#confirm-delete-many-docs #confirm-action').click()
await expect(page.locator('.payload-toast-container .toast-success')).toHaveText(
'Deleted 3 Posts successfully.',
@@ -313,8 +313,8 @@ test.describe('Bulk Edit', () => {
await expect(page.locator('.table table > tbody > tr')).toHaveCount(5)
await page.locator('input#select-all').check()
await page.locator('button#select-all-across-pages').click()
await page.locator('.delete-documents__toggle').click()
await page.locator('#delete-posts #confirm-action').click()
await page.locator('.list-selection__button[aria-label="Delete"]').click()
await page.locator('#confirm-delete-many-docs #confirm-action').click()
await expect(page.locator('.payload-toast-container .toast-success')).toHaveText(
'Deleted 6 Posts successfully.',