test: stabilize frequent fails (#13318)

Adjusts tests that "flake" frequently.
This commit is contained in:
Jarrod Flesch
2025-07-30 08:52:01 -04:00
committed by GitHub
parent e7124f6176
commit a22f27de1c
13 changed files with 47 additions and 71 deletions

View File

@@ -6,7 +6,7 @@ import { devUser } from 'credentials.js'
import { openDocControls } from 'helpers/e2e/openDocControls.js'
import { openNav } from 'helpers/e2e/toggleNav.js'
import path from 'path'
import { email, wait } from 'payload/shared'
import { wait } from 'payload/shared'
import { fileURLToPath } from 'url'
import type { PayloadTestSDK } from '../helpers/sdk/index.js'
@@ -16,7 +16,6 @@ import {
closeNav,
ensureCompilationIsDone,
exactText,
getRoutes,
initPageConsoleErrorCatch,
login,
saveDocAndAssert,
@@ -71,7 +70,6 @@ describe('Access Control', () => {
let disabledFields: AdminUrlUtil
let serverURL: string
let context: BrowserContext
let logoutURL: string
let authFields: AdminUrlUtil
beforeAll(async ({ browser }, testInfo) => {
@@ -98,17 +96,6 @@ describe('Access Control', () => {
await ensureCompilationIsDone({ page, serverURL, noAutoLogin: true })
await login({ page, serverURL })
await ensureCompilationIsDone({ page, serverURL })
const {
admin: {
routes: { logout: logoutRoute },
},
routes: { admin: adminRoute },
} = getRoutes({})
logoutURL = `${serverURL}${adminRoute}${logoutRoute}`
})
describe('fields', () => {
@@ -515,6 +502,13 @@ describe('Access Control', () => {
describe('global', () => {
test('should restrict update access based on document field', async () => {
await payload.updateGlobal({
slug: userRestrictedGlobalSlug,
data: {
name: 'dev@payloadcms.com',
},
})
await page.goto(userRestrictedGlobalURL.global(userRestrictedGlobalSlug))
await expect(page.locator('#field-name')).toBeVisible()
await expect(page.locator('#field-name')).toHaveValue(devUser.email)