E2E test automation project using Playwright for testing web applications.
- Node.js (v18 or higher)
- npm
- Git
- Fork this repository to your GitHub account
- Clone your forked repository:
git clone https://github.com/phorest/playwright-e2e-tests.git cd playwright-e2e-tests
npm installCreate a .env file in the project root with the following variables:
# Required for login tests
[email protected]
staffPassword=your-password
# Optional
REVISION_KEY=your-revision-key
apiUsername=your-api-username
apiPassword=your-api-password
MAILOSAURAPIKEY=your-mailosaur-api-keynpx playwright install# Run all tests
npm run test
# Run tests in headed mode (see browser)
npx playwright test --headed
# Run specific test file
npx playwright test tests/login.spec.js
# Run tests in debug mode
npx playwright test --debugplaywright-e2e-tests/
├── .github/workflows/ # GitHub Actions CI/CD
├── fixtures/ # Test data and fixtures
├── locators/ # Centralized page locators
├── support/ # Helper functions and utilities
├── testData/ # Test data files
├── tests/ # Test files
├── playwright.config.js # Playwright configuration
└── package.json # Dependencies and scripts
import { test, expect } from '@playwright/test';
import { loginLocators } from '../locators/login/login.locators.js';
test('Test description', async ({ page }) => {
await page.goto('/');
// Your test steps here
});Import and use centralized locators:
import { loginLocators } from '../locators/login/login.locators.js';
// Use in tests
await page.locator(loginLocators.emailInput).fill('[email protected]');The playwright.config.js file contains:
- Base URL configuration
- Browser settings
- Test timeouts
- Reporter settings
The project includes GitHub Actions workflow for CI/CD:
- Automatic test execution on push/PR
- Browser installation
- Test report generation
After running tests, reports are generated in:
playwright-report/- HTML reporttest-results/- Test artifacts
View the HTML report:
npx playwright show-report- Browser not found: Run
npx playwright install - Environment variables not loaded: Check
.envfile exists - Tests timing out: Increase timeout in
playwright.config.js
Run tests in debug mode to step through:
npx playwright test --debug- Create a feature branch
- Write your tests
- Run tests locally
- Create a pull request