1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/web/playwright.config.ts
jbpratt 0ac8499067 test(web): consolidate Playwright API utils into ApiClient class (#4739)
* test(web): consolidate Playwright API utils into ApiClient class

Migrate from individual function-based API utilities to a unified
ApiClient class with CSRF token caching. This eliminates redundant
token requests when tests make multiple API calls.

Key changes:
- Create ApiClient class with cached CSRF token
- Add signIn() method for authentication flows
- Update all test files to use ApiClient instances
- Remove individual api/csrf.ts, organization.ts, repository.ts,
  team.ts, user.ts files in favor of single client.ts
- Update fixtures.ts to use ApiClient for login

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Brady Pratt <bpratt@redhat.com>

* test(web): run playwright on small machine for chrome only

while we are migrating, swap things around to save time and money

Signed-off-by: Brady Pratt <bpratt@redhat.com>

---------

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-12-16 14:56:43 +00:00

72 lines
1.8 KiB
TypeScript

import {defineConfig, devices} from '@playwright/test';
/**
* Playwright configuration for Quay E2E tests
* See https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: './playwright/e2e',
// Global setup to create test users before all tests
globalSetup: require.resolve('./playwright/global-setup'),
// Maximum time one test can run for
timeout: 60 * 1000,
// Run tests in parallel (auto-detect optimal worker count based on CPU cores)
fullyParallel: true,
workers: undefined,
// 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 ? 1 : 0,
// Reporter configuration
reporter: [
[process.env.CI ? 'github' : 'list'],
['html', {outputFolder: 'playwright-report'}],
['json', {outputFile: 'test-results/results.json'}],
],
// Shared settings for all tests
use: {
// Base URL for navigation
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:9000',
// Action timeout
actionTimeout: 30 * 1000,
// Collect trace only on failure
trace: 'on-first-retry',
// Screenshot only on failure
screenshot: 'only-on-failure',
// Video only on failure
video: 'retain-on-failure',
},
// Output directories
outputDir: 'test-results/',
// Configure projects for different browsers
projects: [
{
name: 'chromium',
use: {...devices['Desktop Chrome']},
},
],
// Configure web server for local development
// Note: In CI, services are started separately via docker-compose
webServer: {
command:
'REACT_QUAY_APP_API_URL=http://localhost:8080 npm run build && npm run start:integration',
url: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:9000',
reuseExistingServer: true,
timeout: 120 * 1000,
},
});