From 424b9e4856d7819d9ae979aa296c175501184b68 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Thu, 13 Aug 2026 10:48:29 +0200 Subject: [PATCH 1/2] test: replace fixed waitForTimeout sleeps with event-driven waits Fixed sleeps guessed how long a save/UI transition would take, adding dead time to every run regardless of actual latency. Swap "wait then hope it saved" for the existing waitForSave() network- response helper, and drop sleeps that were already redundant with the following expect()'s built-in polling. 63 calls / 149.8s of fixed sleep -> 30 calls / 57.3s across the suite; the remainder (Y.js websocket stabilization before typing, directory-listing eventual consistency) has no observable signal to poll on and is left as-is. Co-Authored-By: Claude Sonnet 5 --- test/e2e/tests/auth.setup.js | 3 --- .../tests/authenticated/acl_browse.spec.js | 15 ++++------- .../tests/authenticated/acl_versions.spec.js | 2 -- test/e2e/tests/authenticated/collab.spec.js | 3 --- test/e2e/tests/copy_rename.spec.js | 15 +++++------ test/e2e/tests/delete.spec.js | 3 --- test/e2e/tests/edit.spec.js | 18 ++++++------- test/e2e/tests/formatting.spec.js | 9 +++---- test/e2e/tests/preview_publish.spec.js | 16 +++++------ test/e2e/tests/sheet.spec.js | 4 +-- test/e2e/tests/versions.spec.js | 27 ++++++++++--------- 11 files changed, 48 insertions(+), 67 deletions(-) diff --git a/test/e2e/tests/auth.setup.js b/test/e2e/tests/auth.setup.js index 1bce62366..f994b2c65 100644 --- a/test/e2e/tests/auth.setup.js +++ b/test/e2e/tests/auth.setup.js @@ -73,9 +73,6 @@ setup('Set up authentication', async ({ page }) => { await signInButton.click(); - // The IMS sign in page needs a bit of time to load - await page.waitForTimeout(3000); - const emailInput = page.getByLabel('Email address'); await emailInput.waitFor(); await emailInput.fill('da-test@adobetest.com'); diff --git a/test/e2e/tests/authenticated/acl_browse.spec.js b/test/e2e/tests/authenticated/acl_browse.spec.js index d7572313b..7a76876e6 100644 --- a/test/e2e/tests/authenticated/acl_browse.spec.js +++ b/test/e2e/tests/authenticated/acl_browse.spec.js @@ -11,7 +11,9 @@ */ import { test, expect } from '../../utils/fixtures.js'; import ENV from '../../utils/env.js'; -import { getTestPageURL, getQuery, tabBackward, fill, TEST_SITE } from '../../utils/page.js'; +import { + getTestPageURL, getQuery, tabBackward, fill, waitForSave, TEST_SITE, +} from '../../utils/page.js'; test('Read-only directory', async ({ page }) => { test.skip(TEST_SITE !== 'da-status', 'ACLs are not yet supported for Helix 6'); @@ -26,7 +28,6 @@ test('Read-only directory', async ({ page }) => { await tabBackward(page); await page.keyboard.press(' '); - await page.waitForTimeout(500); const tickbox = page.locator('da-list-item').filter({ hasText: 'onlyread-doc' }).locator('label'); await expect(tickbox).toBeChecked(); @@ -54,8 +55,9 @@ test('Read-write directory', async ({ browser, page, trackCleanup }, workerInfo) await expect(page.locator('div.ProseMirror')).toHaveAttribute('contenteditable', 'true'); // The new page needs a moment to be ready await page.waitForTimeout(2000); + const saved = waitForSave(page); await fill(page, 'test writable doc'); - await page.waitForTimeout(3000); + await saved; const newPage = await browser.newPage(); await newPage.goto(pageURL); @@ -71,7 +73,6 @@ test('Read-write directory', async ({ browser, page, trackCleanup }, workerInfo) await tabBackward(page); await page.keyboard.press(' '); - await page.waitForTimeout(500); const tickbox = page.locator('da-list-item').filter({ hasText: pageName }).locator('label'); await expect(tickbox).toBeChecked(); @@ -79,13 +80,8 @@ test('Read-write directory', async ({ browser, page, trackCleanup }, workerInfo) // There are 2 delete buttons, one on the Browse panel and another on the Search one // select the visible one. await page.locator('button.delete-button').filter({ visible: true }).click(); - - await page.waitForTimeout(1000); - await page.locator('sl-button.negative').filter({ visible: true }).click(); - await page.waitForTimeout(1000); - await expect(page.locator(`a[href="/edit#/da-testautomation/acltest/testdocs/subdir/subdir1/${pageName}"]`)).not.toBeVisible(); }); @@ -99,7 +95,6 @@ test('Readonly directory with writeable document', async ({ page }) => { await tabBackward(page); await page.keyboard.press(' '); - await page.waitForTimeout(500); // Check that the expected delete button is there (but don't click it) await expect(page.locator('button.delete-button').filter({ visible: true })).toBeVisible(); diff --git a/test/e2e/tests/authenticated/acl_versions.spec.js b/test/e2e/tests/authenticated/acl_versions.spec.js index 8c4692d60..3ee16a000 100644 --- a/test/e2e/tests/authenticated/acl_versions.spec.js +++ b/test/e2e/tests/authenticated/acl_versions.spec.js @@ -26,7 +26,6 @@ test('Can read versions of read-write document', async ({ page }) => { // find v1 and check it — the click expands the version entry to reveal its // button; WebKit needs a beat for the expansion to start processing. await page.getByText('v1').click(); - await page.waitForTimeout(500); const v1Button = page.locator('li').filter({ hasText: 'v1' }).getByRole('button'); await expect(v1Button).toBeVisible(); await v1Button.click(); @@ -52,7 +51,6 @@ test('Cannot read versions of read-only document', async ({ page }) => { // find v1 and check it — the click expands the version entry to reveal its // button; WebKit needs a beat for the expansion to start processing. await page.getByText('version 1').click(); - await page.waitForTimeout(500); const v1Button = page.locator('li').filter({ hasText: 'version 1' }).getByRole('button'); await expect(v1Button).toBeVisible(); await v1Button.click(); diff --git a/test/e2e/tests/authenticated/collab.spec.js b/test/e2e/tests/authenticated/collab.spec.js index 8d11e8b4c..bb30ed79c 100644 --- a/test/e2e/tests/authenticated/collab.spec.js +++ b/test/e2e/tests/authenticated/collab.spec.js @@ -98,9 +98,6 @@ test('Collab cursors in multiple editors', async ({ browser, page, browserName, await page2.mouse.click(editBox.x + 10, editBox.y + 10); await page2.keyboard.type('From user 2'); - // Give the collab cursors some cycles to appear - await page.waitForTimeout(3000); - // Wait for page2's edit to reach page1 — confirms YJS sync before checking collab state await expect(page.locator('div.ProseMirror')).toContainText('From user 2'); diff --git a/test/e2e/tests/copy_rename.spec.js b/test/e2e/tests/copy_rename.spec.js index 0fab3fce4..cf2aa0d34 100644 --- a/test/e2e/tests/copy_rename.spec.js +++ b/test/e2e/tests/copy_rename.spec.js @@ -12,7 +12,7 @@ import { test, expect } from '../utils/fixtures.js'; import ENV from '../utils/env.js'; import { - getQuery, getTestFolderURL, getTestPageURL, fill, TEST_ORG, TEST_SITE, + getQuery, getTestFolderURL, getTestPageURL, fill, waitForSave, TEST_ORG, TEST_SITE, } from '../utils/page.js'; import { dismissAlertBanner } from '../utils/utils.js'; @@ -41,26 +41,26 @@ const link = await page.getByRole('link', { name: orgPageName }); await page.waitForTimeout(2000); // Enter some initial text onto the page + let saved = waitForSave(page); await fill(page, 'First text'); - - // Wait to ensure its saved in da-admin - await page.waitForTimeout(5000); + await saved; // Add some more text + saved = waitForSave(page); await fill(page, 'Versioned text'); - await page.waitForTimeout(5000); + await saved; // Create a new stored version called 'myver' await page.getByRole('button', { name: 'Versions' }).click(); await page.locator('button.da-version-btn', { hasText: 'Create' }).click(); await page.locator('input.da-version-new-input').fill('myver'); await page.locator('input.da-version-new-input').press('Enter'); - await page.waitForTimeout(3000); await expect(page.getByText('myver', { exact: false })).toBeVisible(); // Add some more text + saved = waitForSave(page); await fill(page, 'After versioned'); - await page.waitForTimeout(5000); + await saved; // Go back to the directory view await page.goto(`${ENV}/${getQuery()}#/${TEST_ORG}/${TEST_SITE}/tests`); @@ -118,7 +118,6 @@ const link = await page.getByRole('link', { name: orgPageName }); await expect(page.locator('div.ProseMirror')).toContainText('After versioned'); await page.getByRole('button', { name: 'Versions' }).click(); await page.getByText('myver', { exact: false }).click(); - await page.waitForTimeout(500); const myverButton = page.locator('li').filter({ hasText: 'myver' }).getByRole('button'); await expect(myverButton).toBeVisible(); await myverButton.click(); diff --git a/test/e2e/tests/delete.spec.js b/test/e2e/tests/delete.spec.js index 3ed548067..afec001b6 100644 --- a/test/e2e/tests/delete.spec.js +++ b/test/e2e/tests/delete.spec.js @@ -96,9 +96,6 @@ test('Empty out open editors on deleted documents', async ({ browser, page, trac await dismissAlertBanner(list); await list.locator('button.delete-button').filter({ visible: true }).click(); - // Give the modal a chance to open - await list.waitForTimeout(1000); - // Hit the delete confirmation button await list.locator('sl-button.negative').filter({ visible: true }).click(); diff --git a/test/e2e/tests/edit.spec.js b/test/e2e/tests/edit.spec.js index be2372be5..0ffad2e50 100644 --- a/test/e2e/tests/edit.spec.js +++ b/test/e2e/tests/edit.spec.js @@ -12,7 +12,7 @@ import { test, expect } from '../utils/fixtures.js'; import ENV from '../utils/env.js'; import { - getQuery, getTestPageURL, tabBackward, fill, TEST_ORG, TEST_SITE, + getQuery, getTestPageURL, tabBackward, fill, waitForSave, TEST_ORG, TEST_SITE, } from '../utils/page.js'; import { dismissAlertBanner } from '../utils/utils.js'; @@ -22,17 +22,15 @@ test('Update Document', async ({ browser, page, trackCleanup }, workerInfo) => { const url = getTestPageURL('edit1', workerInfo); trackCleanup(url); await page.goto(url); - await page.waitForTimeout(2000); await page.getByText('Create document', { exact: true }).click(); await expect(page.locator('div.ProseMirror')).toBeVisible(); await expect(page.locator('div.ProseMirror')).toHaveAttribute('contenteditable', 'true'); // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); const enteredText = `[${workerInfo.project.name}] Edited by test ${new Date()}`; + const saved = waitForSave(page); await fill(page, enteredText); - - // Wait for content to save before closing - await page.waitForTimeout(3000); + await saved; await page.close(); const newPage = await browser.newPage(); @@ -60,8 +58,9 @@ test('Create Delete Document', async ({ browser, page, trackCleanup }, workerInf await expect(page.locator('div.ProseMirror')).toHaveAttribute('contenteditable', 'true'); // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); + const saved = waitForSave(page); await fill(page, 'testcontent'); - await page.waitForTimeout(1000); + await saved; const newPage = await browser.newPage(); await newPage.goto(`${ENV}/${getQuery()}#/${TEST_ORG}/${TEST_SITE}/tests`); @@ -118,8 +117,9 @@ test('Change document by switching anchors', async ({ page, trackCleanup }, work await newRowCells.nth(0).click(); await page.keyboard.type('k 2'); await newRowCells.nth(1).click(); + const savedA = waitForSave(page); await page.keyboard.type('v 2'); - await page.waitForTimeout(5000); + await savedA; await page.goto(urlB); await page.getByText('Create document', { exact: true }).click(); @@ -127,13 +127,13 @@ test('Change document by switching anchors', async ({ page, trackCleanup }, work await expect(page.locator('div.ProseMirror')).toHaveAttribute('contenteditable', 'true'); // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); + const savedB = waitForSave(page); await fill(page, 'page B'); - await page.waitForTimeout(3000); // Verify the fill took effect locally before waiting for persistence await expect(page.locator('div.ProseMirror')).toContainText('page B'); // Wait for Y.js to persist the content to the server - await page.waitForTimeout(5000); + await savedB; await page.goto(urlA); await expect(page.locator('div.ProseMirror')).toBeVisible(); diff --git a/test/e2e/tests/formatting.spec.js b/test/e2e/tests/formatting.spec.js index d7b8c268a..424f53309 100644 --- a/test/e2e/tests/formatting.spec.js +++ b/test/e2e/tests/formatting.spec.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ import { test, expect } from '../utils/fixtures.js'; -import { getTestPageURL, fill } from '../utils/page.js'; +import { getTestPageURL, fill, waitForSave } from '../utils/page.js'; const MOD = process.platform === 'darwin' ? 'Meta' : 'Control'; @@ -150,15 +150,14 @@ test('Text formatting and links persist after reload', async ({ page, trackClean await page.locator('da-palette').waitFor(); await page.locator('da-palette').locator('#field-href').fill('https://adobe.com'); - await page.keyboard.press('Enter'); - // Wait for Y.js to persist the content to the server - await page.waitForTimeout(5000); + const saved = waitForSave(page); + await page.keyboard.press('Enter'); + await saved; // --- Reload and verify all formatting was retained --- await page.reload(); await expect(proseMirror).toBeVisible(); - await page.waitForTimeout(3000); // Verify headings await expect(proseMirror.locator('h1')).toContainText('Heading Level One'); diff --git a/test/e2e/tests/preview_publish.spec.js b/test/e2e/tests/preview_publish.spec.js index 258f5ca10..f3135781a 100644 --- a/test/e2e/tests/preview_publish.spec.js +++ b/test/e2e/tests/preview_publish.spec.js @@ -1,7 +1,7 @@ import { test, expect } from '../utils/fixtures.js'; import ENV from '../utils/env.js'; import { - getQuery, getTestPageURL, getTestFolderURL, createDocument, fill, TEST_ORG, TEST_SITE, + getQuery, getTestPageURL, getTestFolderURL, createDocument, fill, waitForSave, TEST_ORG, TEST_SITE, } from '../utils/page.js'; import { dismissAlertBanner } from '../utils/utils.js'; import { parseTestUrl, deleteResource } from '../utils/cleanup.js'; @@ -54,11 +54,11 @@ async function createPagesInFolder(page, workerInfo, folderPath, prefix, count) // eslint-disable-next-line no-await-in-loop await page.waitForTimeout(2000); + const saved = waitForSave(page); // eslint-disable-next-line no-await-in-loop await fill(page, `${prefix} test ${i}`); - // eslint-disable-next-line no-await-in-loop - await page.waitForTimeout(3000); + await saved; } return pageNames; } @@ -96,10 +96,9 @@ test('Preview the selected page', async ({ page, context, trackCleanup }, worker // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); + const saved = waitForSave(page); await fill(page, 'preview test'); - - // Wait to ensure its saved in da-admin - await page.waitForTimeout(3000); + await saved; await page.goto(TESTS_DIR); await expect(page.getByText(pageName), 'Precondition: new page must exist').toBeVisible(); @@ -137,10 +136,9 @@ test('Publish the selected page', async ({ page, context, trackCleanup }, worker // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); + const saved = waitForSave(page); await fill(page, 'publish test'); - - // Wait to ensure its saved in da-admin - await page.waitForTimeout(3000); + await saved; await page.goto(TESTS_DIR); await expect(page.getByText(pageName), 'Precondition: new page must exist').toBeVisible(); diff --git a/test/e2e/tests/sheet.spec.js b/test/e2e/tests/sheet.spec.js index c7b26f059..197bfcfad 100644 --- a/test/e2e/tests/sheet.spec.js +++ b/test/e2e/tests/sheet.spec.js @@ -20,10 +20,10 @@ test('New sheet', async ({ page, trackCleanup }, workerInfo) => { await page.locator('input').fill('key'); // Enter text into second cell + const saved = waitForSave(page); await page.locator('[data-x="0"][data-y="1"]').dblclick(); await page.locator('td input').fill(enteredText); - - await page.waitForTimeout(3000); + await saved; await page.close(); }); diff --git a/test/e2e/tests/versions.spec.js b/test/e2e/tests/versions.spec.js index c72fde302..57cd1ab2b 100644 --- a/test/e2e/tests/versions.spec.js +++ b/test/e2e/tests/versions.spec.js @@ -10,7 +10,9 @@ * governing permissions and limitations under the License. */ import { test, expect } from '../utils/fixtures.js'; -import { getTestPageURL, fill, TEST_SITE } from '../utils/page.js'; +import { + getTestPageURL, fill, waitForSave, TEST_SITE, +} from '../utils/page.js'; test('Create Version and Restore from it', async ({ page, trackCleanup }, workerInfo) => { // This test has a fairly high timeout because it waits for the document to be saved @@ -27,14 +29,14 @@ test('Create Version and Restore from it', async ({ page, trackCleanup }, worker await page.waitForTimeout(2000); // Enter some initial text onto the page + let saved = waitForSave(page); await fill(page, 'Initial version'); - - // Wait to ensure its saved in da-admin - await page.waitForTimeout(5000); + await saved; // Add some more text + saved = waitForSave(page); await fill(page, 'Second version'); - await page.waitForTimeout(5000); + await saved; // Create a new stored version called 'ver 1' await page.getByRole('button', { name: 'Versions' }).click(); @@ -44,15 +46,14 @@ test('Create Version and Restore from it', async ({ page, trackCleanup }, worker // Close the versions panel and add some more text await page.locator('button.da-versions-close-btn').click(); + saved = waitForSave(page); await fill(page, 'Some modifications'); - - // Wait to ensure its saved - await page.waitForTimeout(5000); + await saved; // And add some more text + saved = waitForSave(page); await fill(page, 'Some more modifications'); - // Wait to ensure its saved - await page.waitForTimeout(5000); + await saved; // Reload the page and check that the latest changes are there await page.reload(); @@ -74,10 +75,10 @@ test('Create Version and Restore from it', async ({ page, trackCleanup }, worker await expect(audit).toContainText(expectedUser); } - // Select 'ver 1' and restore it — the click expands the version entry; - // WebKit needs a beat for the expansion to start processing. + // Select 'ver 1' and restore it — the click expands the version entry. + // The following assertion's built-in polling covers WebKit needing a beat + // for the expansion to start processing. await page.getByText('ver 1', { exact: false }).click(); - await page.waitForTimeout(500); const ver1Button = page.locator('li').filter({ hasText: 'ver 1' }).getByRole('button'); await expect(ver1Button).toBeVisible(); await ver1Button.click(); From 702b08d7daa8e9a0bd3a8abe90779d9c12bb38ff Mon Sep 17 00:00:00 2001 From: kptdobe Date: Thu, 13 Aug 2026 10:54:12 +0200 Subject: [PATCH 2/2] fix(test): revert waitForSave() on ProseMirror doc saves waitForSave() watches for a client-side POST /source response, but ProseMirror document content persists to da-admin via da-collab's WebSocket/Yjs sync, not a direct browser request - the client never sees that response, so every swapped call timed out after 10s. Only sheet.spec.js's saves are genuine client-side POST /source calls (jspreadsheet), which is why that one kept passing. Revert the doc-save sites (edit/versions/copy_rename/preview_publish/ formatting/acl_browse) back to fixed sleeps; keep sheet.spec.js as-is. Co-Authored-By: Claude Sonnet 5 --- .../tests/authenticated/acl_browse.spec.js | 7 ++----- test/e2e/tests/copy_rename.spec.js | 13 ++++++------ test/e2e/tests/edit.spec.js | 17 +++++++-------- test/e2e/tests/formatting.spec.js | 9 ++++---- test/e2e/tests/preview_publish.spec.js | 16 +++++++------- test/e2e/tests/versions.spec.js | 21 +++++++++---------- 6 files changed, 40 insertions(+), 43 deletions(-) diff --git a/test/e2e/tests/authenticated/acl_browse.spec.js b/test/e2e/tests/authenticated/acl_browse.spec.js index 7a76876e6..bf608f783 100644 --- a/test/e2e/tests/authenticated/acl_browse.spec.js +++ b/test/e2e/tests/authenticated/acl_browse.spec.js @@ -11,9 +11,7 @@ */ import { test, expect } from '../../utils/fixtures.js'; import ENV from '../../utils/env.js'; -import { - getTestPageURL, getQuery, tabBackward, fill, waitForSave, TEST_SITE, -} from '../../utils/page.js'; +import { getTestPageURL, getQuery, tabBackward, fill, TEST_SITE } from '../../utils/page.js'; test('Read-only directory', async ({ page }) => { test.skip(TEST_SITE !== 'da-status', 'ACLs are not yet supported for Helix 6'); @@ -55,9 +53,8 @@ test('Read-write directory', async ({ browser, page, trackCleanup }, workerInfo) await expect(page.locator('div.ProseMirror')).toHaveAttribute('contenteditable', 'true'); // The new page needs a moment to be ready await page.waitForTimeout(2000); - const saved = waitForSave(page); await fill(page, 'test writable doc'); - await saved; + await page.waitForTimeout(3000); const newPage = await browser.newPage(); await newPage.goto(pageURL); diff --git a/test/e2e/tests/copy_rename.spec.js b/test/e2e/tests/copy_rename.spec.js index cf2aa0d34..8b9b0b33c 100644 --- a/test/e2e/tests/copy_rename.spec.js +++ b/test/e2e/tests/copy_rename.spec.js @@ -12,7 +12,7 @@ import { test, expect } from '../utils/fixtures.js'; import ENV from '../utils/env.js'; import { - getQuery, getTestFolderURL, getTestPageURL, fill, waitForSave, TEST_ORG, TEST_SITE, + getQuery, getTestFolderURL, getTestPageURL, fill, TEST_ORG, TEST_SITE, } from '../utils/page.js'; import { dismissAlertBanner } from '../utils/utils.js'; @@ -41,14 +41,14 @@ const link = await page.getByRole('link', { name: orgPageName }); await page.waitForTimeout(2000); // Enter some initial text onto the page - let saved = waitForSave(page); await fill(page, 'First text'); - await saved; + + // Wait to ensure its saved in da-admin + await page.waitForTimeout(5000); // Add some more text - saved = waitForSave(page); await fill(page, 'Versioned text'); - await saved; + await page.waitForTimeout(5000); // Create a new stored version called 'myver' await page.getByRole('button', { name: 'Versions' }).click(); @@ -58,9 +58,8 @@ const link = await page.getByRole('link', { name: orgPageName }); await expect(page.getByText('myver', { exact: false })).toBeVisible(); // Add some more text - saved = waitForSave(page); await fill(page, 'After versioned'); - await saved; + await page.waitForTimeout(5000); // Go back to the directory view await page.goto(`${ENV}/${getQuery()}#/${TEST_ORG}/${TEST_SITE}/tests`); diff --git a/test/e2e/tests/edit.spec.js b/test/e2e/tests/edit.spec.js index 0ffad2e50..bfa12059a 100644 --- a/test/e2e/tests/edit.spec.js +++ b/test/e2e/tests/edit.spec.js @@ -12,7 +12,7 @@ import { test, expect } from '../utils/fixtures.js'; import ENV from '../utils/env.js'; import { - getQuery, getTestPageURL, tabBackward, fill, waitForSave, TEST_ORG, TEST_SITE, + getQuery, getTestPageURL, tabBackward, fill, TEST_ORG, TEST_SITE, } from '../utils/page.js'; import { dismissAlertBanner } from '../utils/utils.js'; @@ -28,9 +28,10 @@ test('Update Document', async ({ browser, page, trackCleanup }, workerInfo) => { // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); const enteredText = `[${workerInfo.project.name}] Edited by test ${new Date()}`; - const saved = waitForSave(page); await fill(page, enteredText); - await saved; + + // Wait for content to save before closing + await page.waitForTimeout(3000); await page.close(); const newPage = await browser.newPage(); @@ -58,9 +59,8 @@ test('Create Delete Document', async ({ browser, page, trackCleanup }, workerInf await expect(page.locator('div.ProseMirror')).toHaveAttribute('contenteditable', 'true'); // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); - const saved = waitForSave(page); await fill(page, 'testcontent'); - await saved; + await page.waitForTimeout(1000); const newPage = await browser.newPage(); await newPage.goto(`${ENV}/${getQuery()}#/${TEST_ORG}/${TEST_SITE}/tests`); @@ -117,9 +117,8 @@ test('Change document by switching anchors', async ({ page, trackCleanup }, work await newRowCells.nth(0).click(); await page.keyboard.type('k 2'); await newRowCells.nth(1).click(); - const savedA = waitForSave(page); await page.keyboard.type('v 2'); - await savedA; + await page.waitForTimeout(5000); await page.goto(urlB); await page.getByText('Create document', { exact: true }).click(); @@ -127,13 +126,13 @@ test('Change document by switching anchors', async ({ page, trackCleanup }, work await expect(page.locator('div.ProseMirror')).toHaveAttribute('contenteditable', 'true'); // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); - const savedB = waitForSave(page); await fill(page, 'page B'); + await page.waitForTimeout(3000); // Verify the fill took effect locally before waiting for persistence await expect(page.locator('div.ProseMirror')).toContainText('page B'); // Wait for Y.js to persist the content to the server - await savedB; + await page.waitForTimeout(5000); await page.goto(urlA); await expect(page.locator('div.ProseMirror')).toBeVisible(); diff --git a/test/e2e/tests/formatting.spec.js b/test/e2e/tests/formatting.spec.js index 424f53309..d7b8c268a 100644 --- a/test/e2e/tests/formatting.spec.js +++ b/test/e2e/tests/formatting.spec.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ import { test, expect } from '../utils/fixtures.js'; -import { getTestPageURL, fill, waitForSave } from '../utils/page.js'; +import { getTestPageURL, fill } from '../utils/page.js'; const MOD = process.platform === 'darwin' ? 'Meta' : 'Control'; @@ -150,14 +150,15 @@ test('Text formatting and links persist after reload', async ({ page, trackClean await page.locator('da-palette').waitFor(); await page.locator('da-palette').locator('#field-href').fill('https://adobe.com'); - // Wait for Y.js to persist the content to the server - const saved = waitForSave(page); await page.keyboard.press('Enter'); - await saved; + + // Wait for Y.js to persist the content to the server + await page.waitForTimeout(5000); // --- Reload and verify all formatting was retained --- await page.reload(); await expect(proseMirror).toBeVisible(); + await page.waitForTimeout(3000); // Verify headings await expect(proseMirror.locator('h1')).toContainText('Heading Level One'); diff --git a/test/e2e/tests/preview_publish.spec.js b/test/e2e/tests/preview_publish.spec.js index f3135781a..258f5ca10 100644 --- a/test/e2e/tests/preview_publish.spec.js +++ b/test/e2e/tests/preview_publish.spec.js @@ -1,7 +1,7 @@ import { test, expect } from '../utils/fixtures.js'; import ENV from '../utils/env.js'; import { - getQuery, getTestPageURL, getTestFolderURL, createDocument, fill, waitForSave, TEST_ORG, TEST_SITE, + getQuery, getTestPageURL, getTestFolderURL, createDocument, fill, TEST_ORG, TEST_SITE, } from '../utils/page.js'; import { dismissAlertBanner } from '../utils/utils.js'; import { parseTestUrl, deleteResource } from '../utils/cleanup.js'; @@ -54,11 +54,11 @@ async function createPagesInFolder(page, workerInfo, folderPath, prefix, count) // eslint-disable-next-line no-await-in-loop await page.waitForTimeout(2000); - const saved = waitForSave(page); // eslint-disable-next-line no-await-in-loop await fill(page, `${prefix} test ${i}`); + // eslint-disable-next-line no-await-in-loop - await saved; + await page.waitForTimeout(3000); } return pageNames; } @@ -96,9 +96,10 @@ test('Preview the selected page', async ({ page, context, trackCleanup }, worker // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); - const saved = waitForSave(page); await fill(page, 'preview test'); - await saved; + + // Wait to ensure its saved in da-admin + await page.waitForTimeout(3000); await page.goto(TESTS_DIR); await expect(page.getByText(pageName), 'Precondition: new page must exist').toBeVisible(); @@ -136,9 +137,10 @@ test('Publish the selected page', async ({ page, context, trackCleanup }, worker // Allow Y.js WebSocket to stabilize before typing await page.waitForTimeout(2000); - const saved = waitForSave(page); await fill(page, 'publish test'); - await saved; + + // Wait to ensure its saved in da-admin + await page.waitForTimeout(3000); await page.goto(TESTS_DIR); await expect(page.getByText(pageName), 'Precondition: new page must exist').toBeVisible(); diff --git a/test/e2e/tests/versions.spec.js b/test/e2e/tests/versions.spec.js index 57cd1ab2b..704e167b0 100644 --- a/test/e2e/tests/versions.spec.js +++ b/test/e2e/tests/versions.spec.js @@ -10,9 +10,7 @@ * governing permissions and limitations under the License. */ import { test, expect } from '../utils/fixtures.js'; -import { - getTestPageURL, fill, waitForSave, TEST_SITE, -} from '../utils/page.js'; +import { getTestPageURL, fill, TEST_SITE } from '../utils/page.js'; test('Create Version and Restore from it', async ({ page, trackCleanup }, workerInfo) => { // This test has a fairly high timeout because it waits for the document to be saved @@ -29,14 +27,14 @@ test('Create Version and Restore from it', async ({ page, trackCleanup }, worker await page.waitForTimeout(2000); // Enter some initial text onto the page - let saved = waitForSave(page); await fill(page, 'Initial version'); - await saved; + + // Wait to ensure its saved in da-admin + await page.waitForTimeout(5000); // Add some more text - saved = waitForSave(page); await fill(page, 'Second version'); - await saved; + await page.waitForTimeout(5000); // Create a new stored version called 'ver 1' await page.getByRole('button', { name: 'Versions' }).click(); @@ -46,14 +44,15 @@ test('Create Version and Restore from it', async ({ page, trackCleanup }, worker // Close the versions panel and add some more text await page.locator('button.da-versions-close-btn').click(); - saved = waitForSave(page); await fill(page, 'Some modifications'); - await saved; + + // Wait to ensure its saved + await page.waitForTimeout(5000); // And add some more text - saved = waitForSave(page); await fill(page, 'Some more modifications'); - await saved; + // Wait to ensure its saved + await page.waitForTimeout(5000); // Reload the page and check that the latest changes are there await page.reload();