Skip to content

Commit

Permalink
make lexical tests wait even longer
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioGr committed Nov 11, 2024
1 parent a249935 commit b240291
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions test/fields/collections/Lexical/e2e/main/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('lexicalMain', () => {
/*await throttleTest({
page,
context,
delay: 'Slow 4G',
delay: 'Fast 4G',
})*/
await reInitializeDB({
serverURL,
Expand Down Expand Up @@ -114,6 +114,10 @@ describe('lexicalMain', () => {
test('should not warn about unsaved changes when navigating to lexical editor with blocks node and then leaving the page after making a change and saving', async () => {
// Relevant issue: https://github.com/payloadcms/payload/issues/4115
await navigateToLexicalFields()
await expect(page.locator('.rich-text-lexical').nth(2).locator('.lexical-block')).toHaveCount(
10,
)
await expect(page.locator('.shimmer-effect')).toHaveCount(0)
const thirdBlock = page.locator('.rich-text-lexical').nth(2).locator('.lexical-block').nth(2)
await thirdBlock.scrollIntoViewIfNeeded()
await expect(thirdBlock).toBeVisible()
Expand All @@ -137,6 +141,10 @@ describe('lexicalMain', () => {

// Save
await saveDocAndAssert(page)
await expect(page.locator('.rich-text-lexical').nth(2).locator('.lexical-block')).toHaveCount(
10,
)
await expect(page.locator('.shimmer-effect')).toHaveCount(0)
await expect(newSpanInBlock).toHaveText('Some text below rmoretextelationship node 1')

// Navigate to some different page, away from the current document
Expand Down Expand Up @@ -435,7 +443,10 @@ describe('lexicalMain', () => {
await expect(uploadListDrawer).toBeHidden()
await wait(500)
await saveDocAndAssert(page)

await expect(page.locator('.rich-text-lexical').nth(2).locator('.lexical-block')).toHaveCount(
10,
)
await expect(page.locator('.shimmer-effect')).toHaveCount(0)
// second one should be the newly created one
const secondUploadNode = richTextField.locator('.lexical-upload').nth(1)
await secondUploadNode.scrollIntoViewIfNeeded()
Expand Down Expand Up @@ -516,6 +527,10 @@ describe('lexicalMain', () => {
await wait(500)
await saveDocAndAssert(page)
await wait(500)
await expect(page.locator('.rich-text-lexical').nth(2).locator('.lexical-block')).toHaveCount(
10,
)
await expect(page.locator('.shimmer-effect')).toHaveCount(0)
// Reload page, open the extra fields drawer again and check if the text is still there
await page.reload()
await wait(300)
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export async function throttleTest({
page,
}: {
context: BrowserContext
delay: 'Fast 3G' | 'Slow 3G' | 'Slow 4G'
delay: keyof typeof networkConditions
page: Page
}) {
const cdpSession = await context.newCDPSession(page)
Expand Down

0 comments on commit b240291

Please sign in to comment.