chore(dx/ci): denx-ify playwright

This commit is contained in:
Elian Doran 2025-09-02 19:00:49 +03:00
parent 04753226e5
commit 15fba23ad7
No known key found for this signature in database
3 changed files with 13 additions and 44 deletions

View File

@ -1,3 +1,3 @@
TRILIUM_INTEGRATION_TEST=memory
TRILIUM_PORT=8082
TRILIUM_DATA_DIR=apps/server/spec/db
TRILIUM_DATA_DIR=spec/db

View File

@ -1,6 +1,5 @@
import { defineConfig, devices } from '@playwright/test';
import { nxE2EPreset } from '@nx/playwright/preset';
import { workspaceRoot } from '@nx/devkit';
import { join } from 'path';
require('dotenv').config({
path: __dirname + "/" + ".env"
@ -14,55 +13,30 @@ const baseURL = process.env['BASE_URL'] || `http://127.0.0.1:${port}`;
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
...nxE2EPreset(__filename, { testDir: './src' }),
testDir: "src",
reporter: [["list"], ["html", { outputFolder: "test-output" }]],
outputDir: "test-output",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Run your local dev server before starting the tests */
webServer: !process.env.TRILIUM_DOCKER ? {
command: 'pnpm server:start-prod',
command: 'pnpm start-prod',
url: baseURL,
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
cwd: join(__dirname, "../server"),
timeout: 5 * 60 * 1000
} : undefined,
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
// {
// name: "firefox",
// use: { ...devices["Desktop Firefox"] },
// },
// {
// name: "webkit",
// use: { ...devices["Desktop Safari"] },
// },
// Uncomment for mobile browsers support
/* {
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
}, */
// Uncomment for branded browsers
/* {
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
} */
],
}
]
});

View File

@ -10,6 +10,7 @@
"package": "pnpm build && bash scripts/build-server.sh",
"test": "vitest",
"test-build": "vitest --config vitest.build.config.mts",
"start-prod": "pnpm build && node dist/main.cjs",
"circular-deps": "dpdm -T src/**/*.ts --tree=false --warning=false --skip-dynamic-imports=circular"
},
"dependencies": {
@ -178,12 +179,6 @@
"runBuildTargetDependencies": false
}
},
"start-prod": {
"dependsOn": [
"build"
],
"command": "node apps/server/dist/main.cjs"
},
"docker-build": {
"dependsOn": [
"build"