This repository contains end-to-end (E2E) tests using Playwright, an automation framework for web and api testing. The tests are designed to ensure the reliability and functionality of web applications by simulating real user interactions.
- Cross-browser testing (Chromium, Firefox, WebKit)
- Headless and headed mode execution
- Parallel test execution
- Integration with CI/CD pipelines
- Screenshots and video recording for debugging
Ensure you have the following installed:
- Node.js (version 16 or later recommended)
- Playwright (install using instructions below)
Clone the repository and install dependencies:
git clone https://github.com/maniziva/playwright-e2e-test.git
cd playwright-e2e-test
npm install
npx playwright installRun all tests in headless mode:
npx playwright testRun tests in headed mode:
npx playwright test --headedRun a specific test file:
npx playwright test tests/example.spec.jsGenerate and view an HTML report:
npx playwright test --reporter=html
npx playwright show-reportThe repository is organized as follows:
- API Test Scripts: Located in the
api-testfolder - Web Test Scripts: Located in the
web-testfolder
Playwright test configurations are split into separate files:
- API Test Configuration:
playwright.api.config.ts - Web Test Configuration:
playwright.web.config.ts - Global Setup for Web Tests:
web-global-setup.ts
Modify these files to customize test execution settings:
- Browsers: Define which browsers to test
- Base URL: Set the application URL
- Timeouts: Configure test timeouts
- Retries: Enable retries for flaky tests
Playwright tests can be integrated into CI/CD pipelines using GitHub Actions, Jenkins, or other CI tools. Example GitHub Actions workflow:
name: Playwright Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run tests
run: npx playwright test- Use
--debugmode to inspect issues:npx playwright test --debug - Capture screenshots and videos for failed tests by updating
playwright.config.js.
- Fork the repository
- Create a feature branch (
git checkout -b feature-branch) - Commit changes (
git commit -m "Add new feature") - Push to the branch (
git push origin feature-branch) - Create a Pull Request
- Manikandan - Maintainer & Lead Developer (API & Web Automation)