Skip to content

Commit

Permalink
Fix one failing E2E test on Firefox, skip the other one (#1809)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
rmunn authored May 13, 2024
1 parent 8a6b4e2 commit ef581f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions test/e2e/tests/editor/editor.entries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ test.describe('Editor entries', () => {
.toHaveValue(entries.multipleMeaningEntry.senses[0].definition.en.value);
});

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

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

const alreadyThere: string = await editorPageManager.getTextarea(editorPageManager.entryCard, 'Word', 'th').inputValue();
await (editorPageManager.getTextarea(editorPageManager.entryCard, 'Word', 'th'))
.fill(alreadyThere + 'a');
.fill(alreadyThere + 'a'); // Failing on Firefox due to Playwright bug; remove test.skip() above once the Playwright bug is resolved
await editorPageManager.page.reload();
await expect((editorPageManager.getTextarea(
editorPageManager.entryCard, 'Word', 'th')))
Expand Down
11 changes: 7 additions & 4 deletions test/e2e/tests/editor/editor.pictures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Project } from '../../utils';

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

const { project } = defaultProject();
const { project, entryIds } = defaultProject();
const newProject = projectPerTest(true);

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

test('Showing and hiding captions', async ({ managerTab, browserName }) => {
test.slow(browserName === 'firefox');

const configurationPage = new ConfigurationPageFieldsTab(managerTab, project());

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

const caption = await test.step('Non-empty caption is visible', async () => {
await editorPageManager.goto();
await editorPageManager.goto({ entryId: entryIds()[0] });
await editorPageManager.showExtraFields(false);
const picture = editorPageManager.picture(entries.entry1.senses[0].pictures[0].fileName);
const caption = editorPageManager.caption(picture);
Expand All @@ -76,7 +75,11 @@ test.describe('Editor pictures', () => {
await expect(caption).toBeVisible(); // it disappears immediately which could be annoying
await caption.fill('');
await expect(caption).not.toBeVisible(); // it disappears immediately which could be annoying
// Navigate away to force changes to be saved
await editorPageManager.goto({ entryId: entryIds()[1] });
// Reload page then navigate back to this entry to verify changes took effect
await editorPageManager.reload();
await editorPageManager.goto({ entryId: entryIds()[0] });
await expect(caption).not.toBeVisible();
});

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

await test.step('Empty caption is visible', async () => {
await editorPageManager.goto();
await editorPageManager.goto({ entryId: entryIds()[0] });
await editorPageManager.showExtraFields(false);
const picture = editorPageManager.picture(entries.entry1.senses[0].pictures[0].fileName);
const caption = editorPageManager.caption(picture);
Expand Down

0 comments on commit ef581f5

Please sign in to comment.