mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-09 01:16:15 -08:00
- Introduced `stalker-mock-server` with TypeScript configuration for local development and testing. - Updated `playwright.config.ts` to run both Angular app and mock server in parallel during e2e tests. - Created comprehensive e2e tests for Stalker portal functionality, including health checks, portal addition, and content loading. - Added detailed architecture documentation for both `stalker-mock-server` and `xtream-mock-server`, outlining design decisions, data flow, and API protocols. - Implemented `xtream-mock-server` to simulate Xtream Codes API for local development and testing, with corresponding e2e tests. - Enhanced test isolation by resetting mock server state before each test run.
86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
import { workspaceRoot } from '@nx/devkit';
|
|
|
|
// For CI, you may want to set BASE_URL to the deployed application.
|
|
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';
|
|
|
|
/**
|
|
* Read environment variables from file.
|
|
* https://github.com/motdotla/dotenv
|
|
*/
|
|
// require('dotenv').config();
|
|
|
|
/**
|
|
* 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: {
|
|
baseURL,
|
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
trace: 'on-first-retry',
|
|
},
|
|
/* Run local dev servers before starting the tests.
|
|
* Both the Angular app and the Stalker mock server start in parallel.
|
|
* Set MOCK_PORT to override the default mock server port (3210).
|
|
*/
|
|
webServer: [
|
|
{
|
|
command: 'pnpm nx run web:serve',
|
|
url: 'http://localhost:4200',
|
|
reuseExistingServer: !process.env['CI'],
|
|
cwd: workspaceRoot,
|
|
},
|
|
{
|
|
command: 'pnpm nx run stalker-mock-server:serve',
|
|
url: `http://localhost:${process.env['MOCK_PORT'] ?? '3210'}/health`,
|
|
reuseExistingServer: !process.env['CI'],
|
|
cwd: workspaceRoot,
|
|
},
|
|
{
|
|
command: 'pnpm nx run xtream-mock-server:serve',
|
|
url: `http://localhost:${process.env['XTREAM_MOCK_PORT'] ?? '3211'}/health`,
|
|
reuseExistingServer: !process.env['CI'],
|
|
cwd: workspaceRoot,
|
|
},
|
|
],
|
|
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' },
|
|
} */
|
|
],
|
|
});
|