Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions playwright/e2e/conflict.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,13 @@ resolutionVariants.forEach(({ source, buttonName, headingName }) => {
container,
editor,
file,
page,
reader,
user,
}) => {
await expect(editor.el).toBeVisible()
const pushPromise = page.waitForRequest(/push/)
await editor.typeHeading('Hello world')
await pushPromise
// Wait for the steps to be pushed so the editor knows about unsaved changes
await expect(editor.saveIndicator).toHaveAccessibleName(/Unsaved changes/)
await user.uploadFile({ name: file.name, content: '## Good bye' })

// Verify both verisons are shown
Expand Down Expand Up @@ -146,6 +145,8 @@ test.describe('Plaintext conflict resolution', () => {
}) => {
await expect(editor.el).toBeVisible()
await editor.type('Hello world')
// Wait for the steps to be pushed so the editor knows about unsaved changes
await expect(editor.saveIndicator).toHaveAccessibleName(/Unsaved changes/)
await user.uploadFile({ name: file.name, content: 'Good bye' })

// Verify both verisons are shown
Expand All @@ -164,16 +165,16 @@ test('[conflict] automatic resolution if no unsaved changes', async ({
container,
editor,
file,
page,
reader,
user,
}) => {
await expect(editor.el).toBeVisible()
await editor.typeHeading('Hello world')
const requestPromise = page.waitForRequest(/save/)
// Wait for the steps to be pushed so the editor knows about unsaved changes
await expect(editor.saveIndicator).toHaveAccessibleName(/Unsaved changes/)
await editor.saveIndicator.click()
await requestPromise
await page.waitForTimeout(500) // More robust against 423 Locked
// Wait until client has successfully saved
await expect(editor.saveIndicator).not.toHaveAccessibleName(/Unsaved changes/)

await user.uploadFile({ name: file.name, content: '## Good bye' })

Expand Down
7 changes: 5 additions & 2 deletions playwright/e2e/reconnect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const test = mergeTests(editorTest, offlineTest, uploadFileTest)
// we cannot run tests in parallel.
test.describe.configure({ mode: 'serial' })

// Upload with an old mtime so the server accepts the first autosave after reopening
test.use({ mtime: Date.now() / 1000 - 10 })

test.beforeEach(async ({ open }) => {
await open()
})
Expand All @@ -32,9 +35,9 @@ test('opening a file with unsaved changes', async ({
await expect(editor.saveIndicator).toHaveAccessibleName(/Unsaved changes/)
await close()
await setOnline()
await expect(await file.getContent()).toBe('')
expect(await file.getContent()).toBe('')
await open()
await expect(editor.getHeading({ name: 'Hello world' })).toBeVisible()
await expect(editor.saveIndicator).not.toHaveAccessibleName(/Unsaved changes/)
await expect(await file.getContent()).toBe('## Hello world')
expect(await file.getContent()).toBe('## Hello world')
})
Loading