Initial commit: LinkSyncServer and LinkSyncExtension projects with complete documentation, models, API endpoints, tests, and extension implementation
This commit is contained in:
98
Linkding Browser Extension/LinkdingSync/playwright.config.ts
Normal file
98
Linkding Browser Extension/LinkdingSync/playwright.config.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Playwright configuration for LinkdingSync E2E tests
|
||||
*
|
||||
* Test setup:
|
||||
* - Launches Firefox (primary) and Chromium (optional)
|
||||
* - Configured for headless mode for CI
|
||||
* - API calls to Linkding backend for sync testing
|
||||
*/
|
||||
|
||||
export default defineConfig({
|
||||
// Define a base URL for the extension (adjust as needed)
|
||||
baseURL: 'http://localhost:5555',
|
||||
|
||||
// Test directory
|
||||
testDir: './tests',
|
||||
|
||||
// Run all tests in parallel
|
||||
fullyParallel: true,
|
||||
|
||||
// In CI, forbid only tests (must pass all tests)
|
||||
forbidOnly: !!process.env.CI,
|
||||
|
||||
// Retry failed tests in CI
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
|
||||
// Test workers (use 1 in CI for determinism)
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
|
||||
// Test reporter (HTML for visual debugging)
|
||||
reporter: [
|
||||
['list'],
|
||||
['html', { outputFolder: 'test-results' }],
|
||||
],
|
||||
|
||||
// Shared configuration for all tests
|
||||
use: {
|
||||
// Base URL for API calls
|
||||
baseURL: 'http://localhost:5555',
|
||||
|
||||
// Collect trace on failure for debugging
|
||||
trace: 'on-first-retry',
|
||||
|
||||
// Take screenshot on failure
|
||||
screenshot: 'only-on-failure',
|
||||
|
||||
// Browser context settings
|
||||
contextOptions: {
|
||||
// Accept cookies (needed for sync)
|
||||
acceptDownloads: true,
|
||||
},
|
||||
|
||||
// Set viewport for consistent tests
|
||||
viewport: { width: 1280, height: 800 },
|
||||
|
||||
// Ignore HTTPS errors for local testing (if needed)
|
||||
// ignoreHTTPSErrors: true,
|
||||
},
|
||||
|
||||
// Define test projects for different browsers
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
// Mobile emulation (optional)
|
||||
// {
|
||||
// name: 'Mobile Chrome',
|
||||
// use: { ...devices['Pixel 5'] },
|
||||
// },
|
||||
],
|
||||
|
||||
// Web server setup for tests
|
||||
// Uncomment if you need a server for tests
|
||||
// webServer: {
|
||||
// command: 'npm start',
|
||||
// port: 5555,
|
||||
// timeout: 120 * 1000,
|
||||
// reuseExistingServer: !process.env.CI,
|
||||
// },
|
||||
|
||||
// Timeout for each test (increase for flaky API calls)
|
||||
timeout: 30 * 1000,
|
||||
|
||||
// Expectation of how many tests should run
|
||||
expect: {
|
||||
// Timeout for assertions
|
||||
timeout: 1000,
|
||||
},
|
||||
|
||||
// Global timeout for the whole test run
|
||||
globalTimeout: 30 * 60 * 1000, // 30 minutes
|
||||
});
|
||||
Reference in New Issue
Block a user