Skip to content

Commit ef581f5

Browse files
authored
Fix one failing E2E test on Firefox, skip the other one (#1809)
* Fix one failing E2E test on Firefox It seems that reloading the page immediately after editing an entry isn't triggering the autosave on Firefox. We can work around this by navigating to another entry before reloading, which does trigger the autosave. * Skip one failing E2E test on Firefox There appears to be a Playwright bug with locator.fill() on Firefox, where the locator waits forever for the textarea to be editable. This happens even if you have added "expect(...).toBeEditable()" immediately before the locator.fill(). Since this bug appears to be Firefox-specific, we will simply skip this test on Firefox until the bug is solved.
1 parent 8a6b4e2 commit ef581f5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

test/e2e/tests/editor/editor.entries.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ test.describe('Editor entries', () => {
204204
.toHaveValue(entries.multipleMeaningEntry.senses[0].definition.en.value);
205205
});
206206

207-
test('Create new word, modify new word, autosaves changes, new word visible in editor and list', async () => {
207+
test('Create new word, modify new word, autosaves changes, new word visible in editor and list', async ({browserName}) => {
208+
test.skip(browserName === 'firefox', 'locator.fill() has a bug on Firefox that is causing a false-positive test failure as of 2024-04');
208209
await editorPageManager.goto({ entryId: entryIds()[2] });
209210

210211
const startEntryCount = await editorPageManager.compactEntryListItem.count();
@@ -231,7 +232,7 @@ test.describe('Editor entries', () => {
231232

232233
const alreadyThere: string = await editorPageManager.getTextarea(editorPageManager.entryCard, 'Word', 'th').inputValue();
233234
await (editorPageManager.getTextarea(editorPageManager.entryCard, 'Word', 'th'))
234-
.fill(alreadyThere + 'a');
235+
.fill(alreadyThere + 'a'); // Failing on Firefox due to Playwright bug; remove test.skip() above once the Playwright bug is resolved
235236
await editorPageManager.page.reload();
236237
await expect((editorPageManager.getTextarea(
237238
editorPageManager.entryCard, 'Word', 'th')))

test/e2e/tests/editor/editor.pictures.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Project } from '../../utils';
77

88
test.describe('Editor pictures', () => {
99

10-
const { project } = defaultProject();
10+
const { project, entryIds } = defaultProject();
1111
const newProject = projectPerTest(true);
1212

1313
let editorPageManager: EditorPage;
@@ -52,7 +52,6 @@ test.describe('Editor pictures', () => {
5252

5353
test('Showing and hiding captions', async ({ managerTab, browserName }) => {
5454
test.slow(browserName === 'firefox');
55-
5655
const configurationPage = new ConfigurationPageFieldsTab(managerTab, project());
5756

5857
await test.step('Hide empty captions', async () => {
@@ -64,7 +63,7 @@ test.describe('Editor pictures', () => {
6463
});
6564

6665
const caption = await test.step('Non-empty caption is visible', async () => {
67-
await editorPageManager.goto();
66+
await editorPageManager.goto({ entryId: entryIds()[0] });
6867
await editorPageManager.showExtraFields(false);
6968
const picture = editorPageManager.picture(entries.entry1.senses[0].pictures[0].fileName);
7069
const caption = editorPageManager.caption(picture);
@@ -76,7 +75,11 @@ test.describe('Editor pictures', () => {
7675
await expect(caption).toBeVisible(); // it disappears immediately which could be annoying
7776
await caption.fill('');
7877
await expect(caption).not.toBeVisible(); // it disappears immediately which could be annoying
78+
// Navigate away to force changes to be saved
79+
await editorPageManager.goto({ entryId: entryIds()[1] });
80+
// Reload page then navigate back to this entry to verify changes took effect
7981
await editorPageManager.reload();
82+
await editorPageManager.goto({ entryId: entryIds()[0] });
8083
await expect(caption).not.toBeVisible();
8184
});
8285

@@ -89,7 +92,7 @@ test.describe('Editor pictures', () => {
8992
});
9093

9194
await test.step('Empty caption is visible', async () => {
92-
await editorPageManager.goto();
95+
await editorPageManager.goto({ entryId: entryIds()[0] });
9396
await editorPageManager.showExtraFields(false);
9497
const picture = editorPageManager.picture(entries.entry1.senses[0].pictures[0].fileName);
9598
const caption = editorPageManager.caption(picture);

0 commit comments

Comments
 (0)