From b2402919138ed7e02197075cf8ccaac70fa12bf4 Mon Sep 17 00:00:00 2001 From: Alessio Gravili Date: Mon, 11 Nov 2024 09:31:27 -0700 Subject: [PATCH] make lexical tests wait even longer --- .../collections/Lexical/e2e/main/e2e.spec.ts | 19 +++++++++++++++++-- test/helpers.ts | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test/fields/collections/Lexical/e2e/main/e2e.spec.ts b/test/fields/collections/Lexical/e2e/main/e2e.spec.ts index fe87243608b..12b4ab2de49 100644 --- a/test/fields/collections/Lexical/e2e/main/e2e.spec.ts +++ b/test/fields/collections/Lexical/e2e/main/e2e.spec.ts @@ -77,7 +77,7 @@ describe('lexicalMain', () => { /*await throttleTest({ page, context, - delay: 'Slow 4G', + delay: 'Fast 4G', })*/ await reInitializeDB({ serverURL, @@ -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() @@ -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 @@ -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() @@ -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) diff --git a/test/helpers.ts b/test/helpers.ts index 2bbfe7c354d..e177e86eef8 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -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)