mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
test: add electron test (#1840)
This commit is contained in:
22
apps/electron/tests/basic.spec.ts
Normal file
22
apps/electron/tests/basic.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { _electron as electron } from 'playwright';
|
||||
|
||||
test('new page', async () => {
|
||||
const electronApp = await electron.launch({
|
||||
args: [resolve(__dirname, '..')],
|
||||
executablePath: resolve(__dirname, '../node_modules/.bin/electron'),
|
||||
});
|
||||
const page = await electronApp.firstWindow();
|
||||
await page.getByTestId('new-page-button').click({
|
||||
delay: 100,
|
||||
});
|
||||
await page.waitForSelector('v-line');
|
||||
const flavour = await page.evaluate(
|
||||
// @ts-expect-error
|
||||
() => globalThis.currentWorkspace.flavour
|
||||
);
|
||||
expect(flavour).toBe('local');
|
||||
await electronApp.close();
|
||||
});
|
||||
8
apps/electron/tests/tsconfig.json
Normal file
8
apps/electron/tests/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["**.spec.ts", "**.test.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user