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

fix(core): fix flaky e2e #6293

Merged
merged 1 commit into from
Mar 25, 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
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const HistoryEditorPreview = ({
{snapshotPage ? (
<AffineErrorBoundary>
<Scrollable.Root>
<Scrollable.Viewport>
<Scrollable.Viewport className="affine-page-viewport">
<BlockSuiteEditor
className={styles.editor}
mode={mode}
Expand Down Expand Up @@ -165,7 +165,7 @@ const HistoryEditorPreview = ({

return (
<div className={styles.previewWrapper}>
{historyList.map((item, i) => {
{historyList.map((_item, i) => {
const historyIndex = historyList.findIndex(h => h.timestamp === ts);
const distance = i - historyIndex;
const flag =
Expand All @@ -175,11 +175,7 @@ const HistoryEditorPreview = ({
? '< -20'
: distance.toString();
return (
<div
data-distance={flag}
key={item.id}
className={styles.previewContainer}
>
<div data-distance={flag} key={i} className={styles.previewContainer}>
{historyIndex === i ? content : null}
</div>
);
Expand Down
11 changes: 10 additions & 1 deletion tests/affine-cloud/e2e/page-history.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,23 @@ test('can restore page to a history version', async ({ page }) => {
await pushCurrentPageUpdates(page);

const title = getBlockSuiteEditorTitle(page);

await title.focus();

await title.pressSequentially('TEST TITLE', {
delay: 50,
});

// write something and push to history
await pushCurrentPageUpdates(page);

await title.fill('New Title');
await title.selectText();

await title.press('Backspace');

await title.pressSequentially('New Title', {
delay: 50,
});

// click the history button
await page.getByTestId('header-dropDownButton').click();
Expand Down
Loading