e2e(desktop): create empty project

This commit is contained in:
Elian Doran 2025-06-21 14:23:47 +03:00
parent 520b862551
commit a7091779b7
No known key found for this signature in database
8 changed files with 119 additions and 0 deletions

3
apps/desktop-e2e/.env Normal file
View File

@ -0,0 +1,3 @@
TRILIUM_INTEGRATION_TEST=memory-no-store
TRILIUM_PORT=8082
TRILIUM_DATA_DIR=data

View 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: {}
}
];

View 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"
}
}

View 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"] },
}
],
});

View 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();
});

View 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
View File

@ -401,6 +401,15 @@ importers:
specifier: ^7.1.1
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:
dependencies:
better-sqlite3:

View File

@ -62,6 +62,9 @@
},
{
"path": "./apps/website"
},
{
"path": "./apps/desktop-e2e"
}
]
}