This directory contains E2E tests for the Integrations application using Playwright.
Before running the tests, you need to:
-
Run the application locally
- The tests expect the application to be running and accessible
- Default:
https://stage.foo.redhat.com:1337 - You'll need to set up your local proxy configuration to point to your local dev server
-
Set up environment variables
E2E_USER- Red Hat SSO username for testingE2E_PASSWORD- Red Hat SSO password for testingAPP_TEST_HOST_PORT(optional) - Custom URL for the test environment
Basic command with required credentials:
E2E_USER=your-username E2E_PASSWORD=your-password npm run playwright -- testOverride the default test URL:
APP_TEST_HOST_PORT=localhost:8080 E2E_USER=your-username E2E_PASSWORD=your-password npm run playwright -- testRun a specific test file:
E2E_USER=your-username E2E_PASSWORD=your-password npm run playwright -- test integrations.spec.jsRun tests in headed mode (see the browser):
E2E_USER=your-username E2E_PASSWORD=your-password npm run playwright -- test --headedRun tests in debug mode with Playwright Inspector:
E2E_USER=your-username E2E_PASSWORD=your-password npm run playwright -- test --debugMost tests require user authentication. Use authTest instead of test to automatically handle login:
import { authTest, expect } from './fixtures.js';
authTest.use({ ignoreHTTPSErrors: true });
authTest.describe('my feature', () => {
authTest('should do something', async ({ page }) => {
// User is already logged in here
await page.goto('/settings/integrations');
await expect(page.locator('h1')).toBeVisible();
});
});You can also use the authentication functions directly:
import { ensureLoggedIn, login, disableCookiePrompt } from './fixtures.js';
// Ensure user is logged in (checks if already logged in first)
await ensureLoggedIn(page);
// Direct login
await login(page, 'username', 'password');
// Disable cookie prompts
await disableCookiePrompt(page);When tests fail, the following artifacts are captured:
- Screenshots - Saved in
test-results/ - Videos - Saved in
test-results/ - Traces - Captured on first retry, viewable with
npx playwright show-trace
These artifacts are automatically ignored by git (see .gitignore).
The Playwright configuration is in playwright.config.js and includes:
- Video recording on failure
- Screenshots on failure
- Trace recording on first retry
- Automatic retries in CI (2 retries)
- Single worker in CI for stability
playwright/
├── README.md # This file
├── fixtures.js # Authentication utilities and authTest fixture
├── integrations.spec.js # Integration page tests
└── [other test files]
- Verify your
E2E_USERandE2E_PASSWORDare correct - Check that your SSO account has access to the environment
- Ensure the application is running and accessible
- Check that your local dev server is running
- Verify the
APP_TEST_HOST_PORTmatches your actual server - Check network connectivity to external dependencies
Tests use ignoreHTTPSErrors: true to handle self-signed certificates in development environments. This is configured per-test using authTest.use().