test: stabilize frequent fails (#13318)
Adjusts tests that "flake" frequently.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user