mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 01:52:28 +08:00
e2e(desktop): create empty project
This commit is contained in:
parent
520b862551
commit
a7091779b7
3
apps/desktop-e2e/.env
Normal file
3
apps/desktop-e2e/.env
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
TRILIUM_INTEGRATION_TEST=memory-no-store
|
||||||
|
TRILIUM_PORT=8082
|
||||||
|
TRILIUM_DATA_DIR=data
|
15
apps/desktop-e2e/eslint.config.mjs
Normal file
15
apps/desktop-e2e/eslint.config.mjs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import playwright from "eslint-plugin-playwright";
|
||||||
|
import baseConfig from "../../eslint.config.mjs";
|
||||||
|
|
||||||
|
export default [
|
||||||
|
playwright.configs["flat/recommended"],
|
||||||
|
...baseConfig,
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.js"
|
||||||
|
],
|
||||||
|
// Override or add rules here
|
||||||
|
rules: {}
|
||||||
|
}
|
||||||
|
];
|
24
apps/desktop-e2e/package.json
Normal file
24
apps/desktop-e2e/package.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "@triliumnext/desktop-e2e",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"nx": {
|
||||||
|
"name": "desktop-e2e",
|
||||||
|
"implicitDependencies": [
|
||||||
|
"client",
|
||||||
|
"desktop"
|
||||||
|
],
|
||||||
|
"targets": {
|
||||||
|
"e2e": {
|
||||||
|
"dependsOn": [
|
||||||
|
"desktop:build",
|
||||||
|
"desktop:rebuild-deps"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"dotenv": "16.5.0",
|
||||||
|
"electron": "36.5.0"
|
||||||
|
}
|
||||||
|
}
|
27
apps/desktop-e2e/playwright.config.ts
Normal file
27
apps/desktop-e2e/playwright.config.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { defineConfig, devices } from '@playwright/test';
|
||||||
|
import { nxE2EPreset } from '@nx/playwright/preset';
|
||||||
|
|
||||||
|
require('dotenv').config({
|
||||||
|
path: __dirname + "/" + ".env"
|
||||||
|
});
|
||||||
|
|
||||||
|
// For CI, you may want to set BASE_URL to the deployed application.
|
||||||
|
const port = process.env['TRILIUM_PORT'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
|
*/
|
||||||
|
export default defineConfig({
|
||||||
|
...nxE2EPreset(__filename, { testDir: './src' }),
|
||||||
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
|
use: {
|
||||||
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: "chromium",
|
||||||
|
use: { ...devices["Desktop Chrome"] },
|
||||||
|
}
|
||||||
|
],
|
||||||
|
});
|
13
apps/desktop-e2e/src/example.spec.ts
Normal file
13
apps/desktop-e2e/src/example.spec.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { test, expect, _electron as electron } from '@playwright/test';
|
||||||
|
import { join } from 'path';
|
||||||
|
|
||||||
|
test('Electron app should display correct title', async () => {
|
||||||
|
// Launch Electron app
|
||||||
|
const distPath = join(__dirname, '../../desktop/dist/main.cjs');
|
||||||
|
const app = await electron.launch({ args: [ distPath ] });
|
||||||
|
|
||||||
|
// Get the main window
|
||||||
|
const window = await app.firstWindow();
|
||||||
|
await expect(window).toHaveTitle("Setup");
|
||||||
|
await app.close();
|
||||||
|
});
|
25
apps/desktop-e2e/tsconfig.json
Normal file
25
apps/desktop-e2e/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"outDir": "out-tsc/playwright",
|
||||||
|
"sourceMap": false
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.js",
|
||||||
|
"playwright.config.ts",
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.spec.js",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.test.js",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"out-tsc",
|
||||||
|
"test-output",
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
"eslint.config.cjs"
|
||||||
|
]
|
||||||
|
}
|
9
pnpm-lock.yaml
generated
9
pnpm-lock.yaml
generated
@ -401,6 +401,15 @@ importers:
|
|||||||
specifier: ^7.1.1
|
specifier: ^7.1.1
|
||||||
version: 7.1.3
|
version: 7.1.3
|
||||||
|
|
||||||
|
apps/desktop-e2e:
|
||||||
|
devDependencies:
|
||||||
|
dotenv:
|
||||||
|
specifier: 16.5.0
|
||||||
|
version: 16.5.0
|
||||||
|
electron:
|
||||||
|
specifier: 36.5.0
|
||||||
|
version: 36.5.0
|
||||||
|
|
||||||
apps/dump-db:
|
apps/dump-db:
|
||||||
dependencies:
|
dependencies:
|
||||||
better-sqlite3:
|
better-sqlite3:
|
||||||
|
@ -62,6 +62,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "./apps/website"
|
"path": "./apps/website"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./apps/desktop-e2e"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user