Skip to content

Commit af5ffc2

Browse files
committed
✅(e2e) fix flaky tests
Fix a flaky tests on the e2e test: - "it renders correctly when we switch from one doc to another" - "it saves the doc when we change pages"
1 parent 3434029 commit af5ffc2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,10 @@ test.describe('Doc Editor', () => {
131131

132132
test('it renders correctly when we switch from one doc to another', async ({
133133
page,
134+
browserName,
134135
}) => {
135136
// Check the first doc
136-
const firstDoc = await goToGridDoc(page);
137+
const [firstDoc] = await createDoc(page, 'doc-switch-1', browserName, 1);
137138
await expect(page.locator('h2').getByText(firstDoc)).toBeVisible();
138139

139140
const editor = page.locator('.ProseMirror');
@@ -142,9 +143,7 @@ test.describe('Doc Editor', () => {
142143
await expect(editor.getByText('Hello World Doc 1')).toBeVisible();
143144

144145
// Check the second doc
145-
const secondDoc = await goToGridDoc(page, {
146-
nthRow: 2,
147-
});
146+
const [secondDoc] = await createDoc(page, 'doc-switch-2', browserName, 1);
148147
await expect(page.locator('h2').getByText(secondDoc)).toBeVisible();
149148
await expect(editor.getByText('Hello World Doc 1')).toBeHidden();
150149
await editor.click();
@@ -160,9 +159,12 @@ test.describe('Doc Editor', () => {
160159
await expect(editor.getByText('Hello World Doc 1')).toBeVisible();
161160
});
162161

163-
test('it saves the doc when we change pages', async ({ page }) => {
162+
test('it saves the doc when we change pages', async ({
163+
page,
164+
browserName,
165+
}) => {
164166
// Check the first doc
165-
const doc = await goToGridDoc(page);
167+
const [doc] = await createDoc(page, 'doc-saves-change', browserName, 1);
166168
await expect(page.locator('h2').getByText(doc)).toBeVisible();
167169

168170
const editor = page.locator('.ProseMirror');

0 commit comments

Comments
 (0)