Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lexical-playground] Bug Fix: Fix firefox e2e test regression in Selection.spec.mjs #6546

Merged
merged 4 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/call-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Lexical e2e test runner
on:
workflow_call:
inputs:
# Make sure that all of these are present in the name of the actions/upload-artifact@v4 action below
os: {required: true, type: string}
node-version: {required: true, type: string}
browser: {required: true, type: string}
Expand Down Expand Up @@ -65,6 +66,6 @@ jobs:
if: failure()
uses: actions/upload-artifact@v4
with:
name: Test Results ${{ inputs.os }}-${{ inputs.browser }}-${{ inputs.editor-mode }}-${{ inputs.events-mode }}-${{ inputs.prod && 'prod' || 'dev' }}-${{ inputs.node-version }}-${{ inputs.override-react-version }}
name: Test Results ${{ inputs.os }}-${{ inputs.browser }}-${{ inputs.editor-mode }}-${{ inputs.events-mode }}-${{ inputs.prod && 'prod' || 'dev' }}-${{ inputs.node-version }}-${{ inputs.override-react-version }}-${{ inputs.flaky && 'flaky' || ''}}
path: ${{ env.test_results_path }}
retention-days: 7
75 changes: 43 additions & 32 deletions packages/lexical-playground/__tests__/e2e/Selection.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ test.describe.parallel('Selection', () => {
browserName,
legacyEvents,
}) => {
test.skip(isPlainText);
test.skip(isPlainText || isCollab);

await focusEditor(page);
await page.keyboard.type('Line1');
Expand All @@ -665,19 +665,32 @@ test.describe.parallel('Selection', () => {
'.PlaygroundEditorTheme__tableCell:last-child',
);
await lastCell.click();
await page.keyboard.type('Foo');
const cellText = 'Foo';
await page.keyboard.type(cellText);

const lastCellText = lastCell.locator('span');
const tripleClickDelay = 50;
await lastCellText.click({clickCount: 3, delay: tripleClickDelay});
const anchorPath = [1, 0, 1, 0];

// Only the last cell should be selected, and not the entire docuemnt
await assertSelection(page, {
anchorOffset: 0,
anchorPath: [1, 0, 1, 0],
focusOffset: 1,
focusPath: [1, 0, 1, 0],
});
if (browserName === 'firefox') {
// Firefox selects the p > span > #text node
await assertSelection(page, {
anchorOffset: 0,
anchorPath: [...anchorPath, 0, 0],
focusOffset: cellText.length,
focusPath: [...anchorPath, 0, 0],
});
} else {
// Other browsers select the p
await assertSelection(page, {
anchorOffset: 0,
anchorPath,
focusOffset: 1,
focusPath: anchorPath,
});
}
});

test('Can persist the text format from the paragraph', async ({
Expand Down Expand Up @@ -929,30 +942,28 @@ test.describe.parallel('Selection', () => {
},
);

test('shift+arrowup into a table, when the table is the first node, selects the whole table', async ({
page,
isPlainText,
isCollab,
browserName,
legacyEvents,
}) => {
test.skip(isPlainText);
test.fixme(browserName === 'chromium' && legacyEvents);
await focusEditor(page);
await insertTable(page, 2, 2);
await moveToEditorBeginning(page);
await deleteBackward(page);
await moveToEditorEnd(page);
await page.keyboard.down('Shift');
await page.keyboard.press('ArrowUp');
await page.keyboard.up('Shift');
await assertSelection(page, {
anchorOffset: 0,
anchorPath: [1],
focusOffset: 1,
focusPath: [0, 0, 0],
});
});
test(
'shift+arrowup into a table, when the table is the first node, selects the whole table',
{tag: '@flaky'},
async ({page, isPlainText, isCollab, browserName, legacyEvents}) => {
test.skip(isPlainText);
test.fixme(browserName === 'chromium' && legacyEvents);
await focusEditor(page);
await insertTable(page, 2, 2);
await moveToEditorBeginning(page);
await deleteBackward(page);
await moveToEditorEnd(page);
await page.keyboard.down('Shift');
await page.keyboard.press('ArrowUp');
await page.keyboard.up('Shift');
await assertSelection(page, {
anchorOffset: 0,
anchorPath: [1],
focusOffset: 1,
focusPath: [0, 0, 0],
});
},
);

test(
'shift+arrowdown into a table, when the table is the only node, selects the whole table',
Expand Down
Loading