mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-09 01:16:15 -08:00
Add a new Electron smoke test suite using Playwright to verify the packaged application starts, renders the main window, and exposes expected window properties. The tests launch the built Electron main bundle, locate the primary (non-DevTools) window, wait for DOM load, and assert the title contains "IPTVnator". They also check window visibility and bounds, validate rendered body content, and capture screenshots to dist/test-results/electron-backend-e2e for debugging. Include helpers to resolve project paths, ensure the screenshot directory exists, and robustly find the main application window. Set NODE_ENV and ELECTRON_IS_DEV to ensure the app loads built artifacts.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { defineConfig } from '@playwright/test';
|
|
|
|
/**
|
|
* Playwright configuration for Electron e2e tests.
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './src',
|
|
/* Match .e2e.ts files */
|
|
testMatch: '**/*.e2e.ts',
|
|
/* Run tests sequentially since we're testing an Electron app */
|
|
fullyParallel: false,
|
|
/* Fail the build on CI if you accidentally left test.only in the source code */
|
|
forbidOnly: !!process.env['CI'],
|
|
/* Retry on CI only */
|
|
retries: process.env['CI'] ? 2 : 0,
|
|
/* Single worker since we're testing an Electron app */
|
|
workers: 1,
|
|
/* Reporter to use */
|
|
reporter: [
|
|
['list'],
|
|
['html', { outputFolder: '../../dist/playwright-report/electron-backend-e2e' }],
|
|
],
|
|
/* Shared settings for all the projects below */
|
|
use: {
|
|
/* Collect trace when retrying the failed test */
|
|
trace: 'on-first-retry',
|
|
/* Screenshots on failure */
|
|
screenshot: 'on',
|
|
/* Video on failure */
|
|
video: 'on-first-retry',
|
|
},
|
|
/* Output folder for test artifacts */
|
|
outputDir: '../../dist/test-results/electron-backend-e2e',
|
|
/* Timeout for each test */
|
|
timeout: 60000,
|
|
/* Timeout for expect() assertions */
|
|
expect: {
|
|
timeout: 10000,
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'electron',
|
|
use: {},
|
|
},
|
|
],
|
|
});
|