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

@@ -131,13 +131,23 @@ describe('JSON', () => {
const jsonField = page.locator('.json-field:not(.read-only) #field-customJSON')
await expect(jsonField).toContainText('"default": "value"')
const originalHeight =
(await page.locator('.json-field:not(.read-only) #field-customJSON').boundingBox())?.height ||
0
await page.locator('#set-custom-json').click()
const newHeight =
(await page.locator('.json-field:not(.read-only) #field-customJSON').boundingBox())?.height ||
0
expect(newHeight).toBeGreaterThan(originalHeight)
const boundingBox = await page
.locator('.json-field:not(.read-only) #field-customJSON')
.boundingBox()
await expect(() => expect(boundingBox).not.toBeNull()).toPass()
const originalHeight = boundingBox!.height
// click the button to set custom JSON
await page.locator('#set-custom-json').click({ delay: 1000 })
const newBoundingBox = await page
.locator('.json-field:not(.read-only) #field-customJSON')
.boundingBox()
await expect(() => expect(newBoundingBox).not.toBeNull()).toPass()
const newHeight = newBoundingBox!.height
await expect(() => {
expect(newHeight).toBeGreaterThan(originalHeight)
}).toPass()
})
})

View File

@@ -23,7 +23,6 @@ import { AdminUrlUtil } from '../../../helpers/adminUrlUtil.js'
import { assertToastErrors } from '../../../helpers/assertToastErrors.js'
import { initPayloadE2ENoConfig } from '../../../helpers/initPayloadE2ENoConfig.js'
import { reInitializeDB } from '../../../helpers/reInitializeDB.js'
import { RESTClient } from '../../../helpers/rest.js'
import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js'
import { relationshipFieldsSlug, textFieldsSlug } from '../../slugs.js'
const filename = fileURLToPath(import.meta.url)
@@ -33,7 +32,6 @@ const dirname = path.resolve(currentFolder, '../../')
const { beforeAll, beforeEach, describe } = test
let payload: PayloadTestSDK<Config>
let client: RESTClient
let page: Page
let serverURL: string
// If we want to make this run in parallel: test.describe.configure({ mode: 'parallel' })
@@ -59,12 +57,6 @@ describe('relationship', () => {
uploadsDir: path.resolve(dirname, './collections/Upload/uploads'),
})
if (client) {
await client.logout()
}
client = new RESTClient({ defaultSlug: 'users', serverURL })
await client.login()
await ensureCompilationIsDone({ page, serverURL })
})
@@ -693,7 +685,7 @@ describe('relationship', () => {
await createRelationshipFieldDoc({ value: textDoc.id, relationTo: 'text-fields' })
await page.goto(url.list)
await wait(300)
await wait(1000) // wait for page to load
await addListFilter({
page,

View File

@@ -17,7 +17,6 @@ import {
import { AdminUrlUtil } from '../../../helpers/adminUrlUtil.js'
import { initPayloadE2ENoConfig } from '../../../helpers/initPayloadE2ENoConfig.js'
import { reInitializeDB } from '../../../helpers/reInitializeDB.js'
import { RESTClient } from '../../../helpers/rest.js'
import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js'
import { uploadsSlug } from '../../slugs.js'
@@ -28,7 +27,6 @@ const dirname = path.resolve(currentFolder, '../../')
const { beforeAll, beforeEach, describe } = test
let payload: PayloadTestSDK<Config>
let client: RESTClient
let page: Page
let serverURL: string
// If we want to make this run in parallel: test.describe.configure({ mode: 'parallel' })
@@ -57,12 +55,6 @@ describe('Upload', () => {
uploadsDir: path.resolve(dirname, './collections/Upload/uploads'),
})
if (client) {
await client.logout()
}
client = new RESTClient({ defaultSlug: 'users', serverURL })
await client.login()
await ensureCompilationIsDone({ page, serverURL })
})