Skip to content

Commit

Permalink
fix(tests): update text.spec test, remove wait, assert content
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin committed Jan 10, 2025
1 parent 452189f commit 5e5ae89
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/e2e/tests/inputs/text.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,18 @@ test.describe('inputs: text', () => {
await expect(page.getByTestId('document-panel-scroller')).toBeAttached()

await titleInput.fill('Title A')

// generally waiting for timeouts is not a good idea but for this specific instance
// since we are using `.fill` and `.click` they 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)
await expect(paneFooter).toHaveText(/draft Edited just now/i)

// Wait for the document to be published.
publishButton.click()
expect(await paneFooter.textContent()).toMatch(/published/i)
await expect(paneFooter).toHaveText(/published/i)

// Change the title.
await titleInput.fill('Title B')
await expect(paneFooter).toHaveText(/draft Edited just now/i)

// Wait for the document to be published.
publishButton.click()
expect(await paneFooter.textContent()).toMatch(/published/i)
await expect(paneFooter).toHaveText(/published/i)
})
})

0 comments on commit 5e5ae89

Please sign in to comment.