chore: remove createEmptyEditor legacy test misc (#10291)

This commit is contained in:
Saul-Mirone
2025-02-19 13:23:41 +00:00
parent 2b11941c0e
commit 091ba7bb51
7 changed files with 222 additions and 348 deletions

View File

@@ -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);
});
}