This repository contains automated tests for the Movie App using Playwright Test Framework with Docker containerization and MCP (Model Context Protocol) support.
- End-to-end testing of movie search and details functionality
- Configurable Page Object Model implementation with
MoviePageHelperclass - Support for different environments, languages, and UI variations through configuration
- Unit tests for helper methods
- GitHub Actions integration for continuous testing
- Allure reporting for detailed test results and analytics
- Automated test reports generation
- Docker containerization for cross-platform test execution
- MCP integration for enhanced test execution and reporting
- Cross-platform command-line scripts (Linux/macOS/Windows)
The MoviePageHelper class now supports custom configuration to adapt to different applications, environments, or UI variations:
import { MoviePageHelper } from './helpers/MoviePageHelper';
// Uses default configuration for the movie app
const moviePage = new MoviePageHelper(page);import { MoviePageHelper, MoviePageConfig } from './helpers/MoviePageHelper';
const customConfig: MoviePageConfig = {
baseUrl: 'https://staging-movie-app.com',
searchButtonText: 'Find Movies',
darkModeSymbol: 'π',
lightModeSymbol: 'βοΈ',
loadingText: 'Loading movies...'
};
const moviePage = new MoviePageHelper(page, customConfig);| Property | Default Value | Description |
|---|---|---|
baseUrl |
'https://debs-obrien.github.io/playwright-movies-app/' |
Base URL of the application |
searchButtonText |
'Search for a movie' |
Text/label for the search button |
searchInputLabel |
'Search Input' |
Label for the search input field |
searchPlaceholder |
'Search for a movie' |
Placeholder text for search input |
loadingText |
'Please wait a moment' |
Loading message text |
synopsisHeading |
'The Synopsis' |
Synopsis section heading |
genresHeading |
'The Genres' |
Genres section heading |
darkModeSymbol |
'βΎ' |
Dark mode button symbol |
lightModeSymbol |
'β' |
Light mode button symbol |
page2ButtonText |
'Page 2' |
Page 2 navigation button text |
sorryHeading |
'Sorry!' |
No results message heading |
starSymbol |
'β
' |
Star rating symbol |
movieLinkPattern |
/poster of .* rating/i |
Pattern for movie link recognition |
- Different Environments: Test against staging, production, or local environments
- Internationalization: Support different languages and locales
- UI Variations: Adapt to different themes or symbol sets
- A/B Testing: Test different UI variations with the same test logic
Install dependencies:
npm ciInstall Playwright browsers:
npx playwright install --with-depsRun all tests:
npm testRun tests in headed mode (with browser UI):
npm run test:headedRun tests in debug mode:
npm run test:debugRun unit tests only:
npm run test:unitRun integration tests only:
npm run test:integrationRun tests with Allure reporting:
npm run test:allureGenerate Allure report:
npm run allure:generateServe Allure report:
npm run allure:serveOpen generated Allure report:
npm run allure:openRun specific test file:
npx playwright test tests/sonnet_test.spec.tsRun tests with specific browser:
npx playwright test --project chromium
npx playwright test --project firefox
npx playwright test --project webkitRun tests matching pattern:
npx playwright test --grep "search"Run tests with UI mode:
npx playwright test --uiShow test report:
npx playwright show-reportThis project supports Docker containerization for cross-platform test execution with MCP integration.
- Docker Desktop installed and running
- Git (for cloning the repository)
-
Build the Docker image:
docker build -t mcp-playwright-tests . -
Run all tests with Docker:
# Linux/macOS ./run-tests.sh # Windows run-tests.bat
Linux/macOS (run-tests.sh):
# Make executable (first time only)
chmod +x run-tests.sh
# Run all tests
./run-tests.sh
# Run with options
./run-tests.sh --browser firefox --project "Mobile Chrome"
./run-tests.sh --headed --debug
./run-tests.sh --grep "search"Windows (run-tests.bat):
# Run all tests
run-tests.bat
# Run with options
run-tests.bat --browser webkit --project "Desktop Safari"
run-tests.bat --headed --debugBasic test execution:
docker run --rm \
-v ${PWD}/test-results:/app/test-results \
-v ${PWD}/allure-results:/app/allure-results \
mcp-playwright-tests npm testRun specific tests:
docker run --rm \
-v ${PWD}/test-results:/app/test-results \
-v ${PWD}/allure-results:/app/allure-results \
mcp-playwright-tests npx playwright test --grep "search"Run with specific browser:
docker run --rm \
-v ${PWD}/test-results:/app/test-results \
-v ${PWD}/allure-results:/app/allure-results \
mcp-playwright-tests npx playwright test --project chromiumFor more complex setups with Allure reporting server:
# Run tests only
docker-compose up playwright-tests
# Run tests with Allure report server
docker-compose --profile allure up
# Run in detached mode
docker-compose --profile allure up -d
# View Allure reports at http://localhost:5050The Docker setup works on:
- Linux (native Docker)
- macOS (Docker Desktop)
- Windows (Docker Desktop, WSL2, or native)
- Ubuntu on Windows (via WSL2 or VM)
Both shell scripts (run-tests.sh and run-tests.bat) support:
- β Automatic Docker image building
- β Volume mounting for persistent reports
- β All Playwright CLI options pass-through
- β Colored output and status messages
- β Cross-platform compatibility
- β Error handling and cleanup
This project uses Allure for comprehensive test reporting with the following features:
- Rich Test Reports: Visual reports with test execution details, screenshots, and logs
- Test Analytics: Historical data, trends, and flaky test detection
- Integration: Automatically generated in CI/CD pipeline
- Artifacts: Test results and reports are saved as GitHub Actions artifacts
npm run test:allure- Run tests with Allure reporternpm run allure:generate- Generate static HTML report from resultsnpm run allure:serve- Start local server to view reportnpm run allure:open- Open generated report in browser
The test workflow runs in two stages with Allure reporting:
-
Unit Tests
- Runs tests in
tests/unit/directory - Must pass before integration tests can start
- Generates both HTML and Allure reports
- Artifacts: "unit-test-report", "unit-allure-report", "unit-allure-results"
- Runs tests in
-
Integration Tests
- Runs only after unit tests pass
- Executes all non-unit tests
- Can be run on different browsers (chromium/firefox/webkit)
- Generates both HTML and Allure reports
- Artifacts: "integration-test-report", "integration-allure-report", "integration-allure-results"
- Test report available as "integration-test-report" artifact
Tests are automatically run on:
- Every push to
masterbranch - Every pull request to
masterbranch
You can manually trigger the tests through GitHub Actions:
- Go to the "Actions" tab in your repository
- Click on "Playwright Tests" workflow
- Click "Run workflow" button
- Select the browser for integration tests (chromium/firefox/webkit)
- Click "Run workflow" to start the tests
Both unit test and integration test reports are available in the GitHub Actions artifacts for each run.