mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
chore: remove createEmptyEditor legacy test misc (#10291)
This commit is contained in:
@@ -3,13 +3,9 @@ import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
|
||||
import { expect, type Page, test as baseTest } from '@playwright/test';
|
||||
import { test as baseTest } from '@playwright/test';
|
||||
|
||||
import {
|
||||
enterPlaygroundRoom,
|
||||
initEmptyParagraphState,
|
||||
} from './actions/misc.js';
|
||||
import { currentEditorIndex, scope } from './multiple-editor.js';
|
||||
import { scope } from './multiple-editor.js';
|
||||
|
||||
const istanbulTempDir = process.env.ISTANBUL_TEMP_DIR
|
||||
? path.resolve(process.env.ISTANBUL_TEMP_DIR)
|
||||
@@ -59,52 +55,3 @@ export const test = baseTest.extend<{}>({
|
||||
}
|
||||
},
|
||||
});
|
||||
if (scope) {
|
||||
test.beforeEach(async ({ browser }, testInfo) => {
|
||||
if (!testInfo.title.startsWith(scope!)) {
|
||||
testInfo.fn = () => {
|
||||
testInfo.skip();
|
||||
};
|
||||
testInfo.skip();
|
||||
await browser.close();
|
||||
}
|
||||
});
|
||||
|
||||
let page: Page;
|
||||
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
});
|
||||
|
||||
// oxlint-disable-next-line no-empty-pattern
|
||||
test.afterAll(async ({}, testInfo) => {
|
||||
if (!testInfo.title.startsWith(scope!)) {
|
||||
return;
|
||||
}
|
||||
const focusInSecondEditor = await page.evaluate(
|
||||
([currentEditorIndex]) => {
|
||||
const editor = document.querySelectorAll('affine-editor-container')[
|
||||
currentEditorIndex
|
||||
];
|
||||
const selection = getSelection();
|
||||
if (!selection || selection.rangeCount === 0) {
|
||||
return true;
|
||||
}
|
||||
// once the range exists, it must be in the corresponding editor
|
||||
return editor.contains(selection.getRangeAt(0).startContainer);
|
||||
},
|
||||
[currentEditorIndex]
|
||||
);
|
||||
expect(focusInSecondEditor).toBe(true);
|
||||
});
|
||||
|
||||
test('ensure enable two editor', async ({ page }) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
const count = await page.evaluate(() => {
|
||||
return document.querySelectorAll('affine-editor-container').length;
|
||||
});
|
||||
|
||||
expect(count).toBe(2);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user