mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 22:37:04 +08:00
fix(core): fix flaky e2e (#6293)
This commit is contained in:
@@ -137,7 +137,7 @@ const HistoryEditorPreview = ({
|
|||||||
{snapshotPage ? (
|
{snapshotPage ? (
|
||||||
<AffineErrorBoundary>
|
<AffineErrorBoundary>
|
||||||
<Scrollable.Root>
|
<Scrollable.Root>
|
||||||
<Scrollable.Viewport>
|
<Scrollable.Viewport className="affine-page-viewport">
|
||||||
<BlockSuiteEditor
|
<BlockSuiteEditor
|
||||||
className={styles.editor}
|
className={styles.editor}
|
||||||
mode={mode}
|
mode={mode}
|
||||||
@@ -165,7 +165,7 @@ const HistoryEditorPreview = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.previewWrapper}>
|
<div className={styles.previewWrapper}>
|
||||||
{historyList.map((item, i) => {
|
{historyList.map((_item, i) => {
|
||||||
const historyIndex = historyList.findIndex(h => h.timestamp === ts);
|
const historyIndex = historyList.findIndex(h => h.timestamp === ts);
|
||||||
const distance = i - historyIndex;
|
const distance = i - historyIndex;
|
||||||
const flag =
|
const flag =
|
||||||
@@ -175,11 +175,7 @@ const HistoryEditorPreview = ({
|
|||||||
? '< -20'
|
? '< -20'
|
||||||
: distance.toString();
|
: distance.toString();
|
||||||
return (
|
return (
|
||||||
<div
|
<div data-distance={flag} key={i} className={styles.previewContainer}>
|
||||||
data-distance={flag}
|
|
||||||
key={item.id}
|
|
||||||
className={styles.previewContainer}
|
|
||||||
>
|
|
||||||
{historyIndex === i ? content : null}
|
{historyIndex === i ? content : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ test('can restore page to a history version', async ({ page }) => {
|
|||||||
await pushCurrentPageUpdates(page);
|
await pushCurrentPageUpdates(page);
|
||||||
|
|
||||||
const title = getBlockSuiteEditorTitle(page);
|
const title = getBlockSuiteEditorTitle(page);
|
||||||
|
|
||||||
|
await title.focus();
|
||||||
|
|
||||||
await title.pressSequentially('TEST TITLE', {
|
await title.pressSequentially('TEST TITLE', {
|
||||||
delay: 50,
|
delay: 50,
|
||||||
});
|
});
|
||||||
@@ -105,7 +108,13 @@ test('can restore page to a history version', async ({ page }) => {
|
|||||||
// write something and push to history
|
// write something and push to history
|
||||||
await pushCurrentPageUpdates(page);
|
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
|
// click the history button
|
||||||
await page.getByTestId('header-dropDownButton').click();
|
await page.getByTestId('header-dropDownButton').click();
|
||||||
|
|||||||
Reference in New Issue
Block a user