test(electron): add test cases for electron tabs (#7635)

fix AF-1000
This commit is contained in:
pengx17
2024-07-29 11:05:24 +00:00
parent 1efc1d0f5b
commit 157cc97a65
8 changed files with 215 additions and 49 deletions
-40
View File
@@ -1,7 +1,6 @@
import { test } from '@affine-test/kit/electron';
import {
clickNewPageButton,
createLinkedPage,
getBlockSuiteEditorTitle,
} from '@affine-test/kit/utils/page-logic';
import {
@@ -143,42 +142,3 @@ test('delete workspace', async ({ page }) => {
'Demo Workspace'
);
});
// temporary way to enable split view
async function enableSplitView(page: Page) {
await page.evaluate(() => {
const settingKey = 'affine-settings';
window.localStorage.setItem(
settingKey,
JSON.stringify({
clientBorder: false,
fullWidthLayout: false,
windowFrameStyle: 'frameless',
fontStyle: 'Serif',
dateFormat: 'MM/dd/YYYY',
startWeekOnMonday: false,
enableBlurBackground: true,
enableNoisyBackground: true,
autoCheckUpdate: true,
autoDownloadUpdate: true,
enableMultiView: true,
editorFlags: {},
})
);
});
await page.reload();
}
test('open split view', async ({ page }) => {
await enableSplitView(page);
await clickNewPageButton(page);
await page.waitForTimeout(500);
await page.keyboard.press('Enter');
await createLinkedPage(page, 'hi from another page');
await page
.locator('.affine-reference-title:has-text("hi from another page")')
.click({
modifiers: ['ControlOrMeta', 'Alt'],
});
await expect(page.locator('.doc-title-container')).toHaveCount(2);
});