Skip to content

Commit

Permalink
test(core): await publish action to prevent test flakiness (#6609)
Browse files Browse the repository at this point in the history
  • Loading branch information
cngonzalez authored and jordanl17 committed May 10, 2024
1 parent 183d5f3 commit 23c7fa3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/e2e/tests/document-actions/delete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ test(`unpublished documents can be deleted`, async ({page, createDraftDocument})
test(`published documents can be deleted`, async ({page, createDraftDocument}) => {
await createDraftDocument('/test/content/author')
await page.getByTestId('field-name').getByTestId('string-input').fill(name)
const paneFooter = page.getByTestId('pane-footer-document-status')

// `.fill` and `.click` can cause the draft creation and publish to happen at the same exact time.
// We are waiting for 1s to make sure the draft actually gets created and click action is not too eager
await page.waitForTimeout(1000)

// Wait for the document to be published.
await page.getByTestId('action-Publish').click()
await expect(page.getByText('was published')).toBeVisible()
expect(await paneFooter.textContent()).toMatch(/published/i)

await page.getByTestId('action-menu-button').click()
await page.getByTestId('action-Delete').click()
Expand Down

0 comments on commit 23c7fa3

Please sign in to comment.