A production-style end-to-end UI automation framework for Wikipedia built on Playwright + TypeScript with support for:
- authenticated UI testing;
- two login strategies: authentication via API and via UI;
- Page Object Model with centralized locators and test data;
- data-driven internationalization checks;
- local, remote CI, and Docker-based execution;
- automatic HTML report, trace, video, and screenshots on failure.
- Project Overview
- Key Features
- Tech Stack
- Project Structure
- Authentication Strategies
- Test Coverage
- Environment Variables
- Getting Started
- Running Tests Locally
- Running Tests Remotely in CI
- Running Tests in Docker
- Reports and Artifacts
- Playwright Projects
- Test Cases
- Troubleshooting
- Roadmap
This framework validates that an authenticated Wikipedia user can change the interface language in Preferences, save the new value, return to the Main Page, and verify that key search controls are localized correctly.
The framework is designed in a maintainable, production-oriented way:
- page behavior is encapsulated in dedicated Page Objects;
- selectors are stored in separate locator enums;
- expected localized values are stored in dedicated data enums;
- authentication is prepared once and reused through Playwright storage state;
- test execution is organized through dedicated Playwright projects.
The current implementation covers a real end-to-end user flow with authenticated access and post-test cleanup that restores the original English language setting.
The framework tests a real user scenario on Wikipedia after successful authentication and verifies visible business-critical UI text.
The framework supports two reusable authorization approaches:
- API auth setup — obtains a login token via MediaWiki API and performs login through API calls;
- UI auth setup — performs authentication through the real login page.
Both strategies persist authenticated session state into Playwright storage files and allow downstream test projects to start from an already logged-in state.
The framework uses dedicated page classes:
WikipediaMainPageWikipediaPreferencesPage
These classes encapsulate navigation, actions, assertions, and reusable interaction flows.
Selectors and visible text are not scattered across tests. They are kept in dedicated enums under src/locators and src/data, which makes maintenance easier when UI changes happen.
The test suite validates multiple language/localization pairs using a single structured data array. Covered languages currently include:
- Spanish
- Portuguese
- French
- German
- Ukrainian
- Polish
The framework is configured to collect:
- trace on first retry;
- screenshots on failure;
- video on failure;
- Playwright HTML report.
The project can be executed:
- on a local machine;
- in GitHub Actions;
- inside a Docker container;
- via Docker Compose.
- Playwright
1.59+ - TypeScript
5.6+ - Node.js
20+recommended - dotenv for environment variable loading
- Docker / Docker Compose
- GitHub Actions for remote execution
aqa-wikipedia-framework/
├── .github/
│ └── workflows/
│ └── playwright.yml # CI pipeline
├── src/
│ ├── api/
│ │ └── auth/
│ │ ├── wiki-auth-api.client.ts # API-based login and storage state creation
│ │ └── wiki-auth-ui.service.ts # UI-based login and storage state creation
│ ├── data/
│ │ ├── internationalisation.enum.ts # Supported interface languages
│ │ └── search-controls.enum.ts # Expected localized search texts
│ ├── fixtures/
│ │ └── wiki-auth.fixtures.ts # Custom Playwright fixtures
│ ├── locators/
│ │ ├── wiki-main-page/
│ │ └── wiki-preferences-page/
│ ├── pages/
│ │ ├── WikipediaMainPage.ts # Main Page object
│ │ └── WikipediaPreferencesPage.ts # Preferences Page object
│ └── utils/
│ ├── env.ts # Environment access helpers
│ └── path.ts # Storage state paths
├── tests/
│ └── wiki-internationalisation-settings-tests.spec.ts
├── playwright.config.ts # Global Playwright configuration
├── Dockerfile # Docker image for test execution
├── docker-compose.yml # Docker Compose runner
├── package.json # Scripts and dependencies
└── .env # Local environment variables
Implemented in:
src/api/auth/wiki-auth-api.client.ts
How it works:
- Requests a MediaWiki login token via
/w/api.php. - Sends login credentials through API.
- Persists authenticated browser storage state into:
playwright/.auth/user-api.json
Why it is useful:
- faster than full UI login;
- suitable for stable preconditions;
- reduces repeated UI authentication overhead.
Implemented in:
src/api/auth/wiki-auth-ui.service.ts
How it works:
- Opens
/wiki/Special:UserLogin. - Enters username and password.
- Confirms successful redirect to
/wiki/Main_Page. - Persists authenticated browser storage state into:
playwright/.auth/user-ui.json
Why it is useful:
- validates the real login flow;
- useful when API login is not desirable;
- closer to true user behavior.
The current suite focuses on Wikipedia interface internationalization settings.
Main flow covered:
- Open Wikipedia Main Page.
- Open user menu.
- Navigate to Preferences.
- Select target interface language.
- Save settings.
- Return to Main Page.
- Validate localized search placeholder text.
- Validate localized search button text.
- Restore English language in cleanup.
Covered language datasets:
es - españolpt - portuguêsfr - françaisde - Deutschuk - українськаpl - polski
Expected localized UI values are stored in:
src/data/search-controls.enum.ts
The framework uses environment variables loaded via .env and dotenv.
Required variables:
WIKI_BASE_URL=https://en.wikipedia.org
WIKI_USERNAME=your_username
WIKI_PASSWORD=your_password| Variable | Required | Description |
|---|---|---|
WIKI_BASE_URL |
Yes | Base URL of the target Wikipedia environment |
WIKI_USERNAME |
Yes | Username used for login |
WIKI_PASSWORD |
Yes | Password used for login |
WIKI_USERNAMEandWIKI_PASSWORDare mandatory. The framework throws an error if they are not provided.
Install the following before running the framework:
- Node.js 20+
- npm
- Docker (optional, for container execution)
- Docker Compose (optional)
# clone repository
git clone <your-repository-url>
# go to project root
cd aqa-wikipedia-framework
# install dependencies
npm ci
# install Playwright browser dependencies
npx playwright install --with-deps chromiumCreate or update your .env file:
WIKI_BASE_URL=https://en.wikipedia.org
WIKI_USERNAME=your_username
WIKI_PASSWORD=your_passwordnpm testThis command runs Playwright tests using all configured projects from playwright.config.ts.
npm run test:headedUseful for debugging and visual observation.
npm run test:uiUseful for interactive debugging, step-by-step investigation, and re-running individual tests.
npm run test:api-authThis runs:
wikipedia-ui-tests-with-api-auth_[chromium]
npm run test:ui-authThis runs:
wikipedia-ui-tests-with-ui-auth_[chromium]
npx playwright test tests/wiki-internationalisation-settings-tests.spec.tsLinux / macOS
WIKI_BASE_URL=https://en.wikipedia.org \
WIKI_USERNAME=your_username \
WIKI_PASSWORD=your_password \
npx playwright testWindows PowerShell
$env:WIKI_BASE_URL="https://en.wikipedia.org"
$env:WIKI_USERNAME="your_username"
$env:WIKI_PASSWORD="your_password"
npx playwright testThe project already contains a GitHub Actions workflow:
.github/workflows/playwright.yml
- Checks out repository source code.
- Sets up Node.js 20.
- Installs project dependencies with
npm ci. - Installs Playwright Chromium browser.
- Runs the Playwright test suite.
- Uploads generated artifacts:
playwright-report/test-results/
The workflow runs on:
- push to
main,master,develop; - pull requests to
main,master,develop; - manual run via
workflow_dispatch.
For remote execution in GitHub Actions, define these repository secrets:
WIKI_USERNAME
WIKI_PASSWORD
The workflow already sets:
CI=true
WIKI_BASE_URL=https://en.wikipedia.org
After pushing code, GitHub Actions starts automatically for configured branches. You can also launch it from the Actions tab using Run workflow.
The framework is container-ready and uses the official Playwright image.
# build image
Docker build -t aqa-wikipedia-framework .
# run tests inside container
Docker run --rm \
--env-file .env \
-v "$(pwd)/playwright-report:/app/playwright-report" \
-v "$(pwd)/test-results:/app/test-results" \
-v "$(pwd)/playwright/.auth:/app/playwright/.auth" \
aqa-wikipedia-frameworkdocker compose up --buildCurrent docker-compose.yml runs:
npx playwright test --project="wikipedia-ui-tests-with-api-auth_[chromium]"This is a good default for stable container-based execution because it reuses API-created authenticated state.
- Builds image from
mcr.microsoft.com/playwright:v1.59.1-noble. - Installs Node dependencies via
npm ci. - Copies project source.
- Runs Playwright tests inside the container.
- Persists reports and test results to mounted host folders.
- Keep
.envconfigured before launching containers. - The following folders are mounted from host to container:
playwright-report/test-results/playwright/.auth/
- This makes it easy to inspect reports after container execution finishes.
The framework uses Playwright reporters and built-in diagnostics.
Generate/open report after run:
npm run reportDepending on execution result, the framework stores:
- HTML report in
playwright-report/ - test artifacts in
test-results/ - authenticated storage state in
playwright/.auth/
Configured in playwright.config.ts:
trace: 'on-first-retry'screenshot: 'only-on-failure'video: 'retain-on-failure'
This makes debugging significantly easier in local and CI runs.
The framework defines four Playwright projects:
Runs API-based authentication setup and prepares storage state for dependent test projects.
Runs UI-based authentication setup and prepares storage state for dependent test projects.
Runs browser tests with:
browserName: chromium- storage state from API authentication
- dependency on
auth-api-setup
Runs browser tests with:
browserName: chromium- storage state from UI authentication
- dependency on
auth-ui-setup
This design cleanly separates session preparation from functional test execution.
Below are the two test cases included exactly as requested for README documentation.
ID: TC-WIKI-INTL-001
Name: Change interface language for an authorized user
The system shall allow an authenticated user to change the Wikipedia interface language via the Preferences page and apply the selected localization to the UI.
- Authorized user is logged in.
- Preferences page is accessible.
- Target language exists in Wikipedia Preferences.
- Expected localized UI values are defined for validation.
| Step | Action | Expected Result |
|---|---|---|
| 1 | Open Wikipedia Main Page | Main Page is displayed successfully |
| 2 | Open user menu | User menu is displayed |
| 3 | Click Preferences | Preferences page is opened |
| 4 | Select target language | The selected language is applied in the Preferences form |
| 5 | Click Save | Changes are saved successfully |
| 6 | Click Wikipedia logo | Main Page is opened |
| 7 | Verify search placeholder text | Placeholder matches expected localized value |
| 8 | Verify search button text | Button label matches expected localized value |
| 9 | Restore English language | Application state is reset successfully |
The interface language is changed successfully, and the Main Page displays the correct localized search controls for the selected language.
Reset interface language to English.
Test Case ID: WC-INT-001
Title: Verify that an authorized user can successfully change the Wikipedia interface language from Preferences
Priority: High
Type: Functional / UI / Positive
Automation Status: Automated
To verify that an authenticated Wikipedia user can change the application interface language in Preferences, save the change successfully, and see the updated localized UI on the Main Page.
- The user account is valid and active.
- The user is authenticated.
- The user has access to the Wikipedia Main Page and Preferences page.
- The default or cleanup language can be restored after test execution.
- Test data for target languages and expected localized search control texts is available.
The following language/localization pairs are covered:
- Spanish →
Buscar en Wikipedia/Buscar - Portuguese →
Procurar em Wikipedia/Procurar - French →
Rechercher sur Wikipedia/Rechercher - German →
Wikipedia durchsuchen/Suchen - Ukrainian →
Пошук у Wikipedia/Знайти - Polish →
Przeszukaj Wikipedię/Szukaj
- Open the Wikipedia Main Page.
- Open the user menu.
- Navigate to the Preferences page.
- Select a target interface language from the available test data.
- Save the updated language preference.
- Return to the Wikipedia Main Page by clicking the Wikipedia logo.
- Verify that the search input placeholder matches the expected localized value.
- Verify that the search button text matches the expected localized value.
- Restore the interface language to English after test execution.
- The selected interface language is saved successfully.
- The user is redirected or returned to the Main Page.
- The Main Page UI reflects the chosen language.
- The search input placeholder displays the expected localized text.
- The search button displays the expected localized text.
- The interface language is reset to English during test cleanup.
- The user remains authenticated.
- The interface language is restored to English.
- The test is data-driven and should run once per configured language.
- Verification is based on stable, user-visible UI elements rather than internal implementation details.
- Cleanup is mandatory to keep the account state consistent across runs.
Make sure your .env file exists and contains valid credentials.
Run:
npx playwright install --with-deps chromiumCheck that:
.envexists in the project root;- you run container with
--env-file .env; - variable names match exactly.
Run:
npm run reportCheck GitHub repository secrets:
WIKI_USERNAMEWIKI_PASSWORD
Possible next production improvements:
- add more Wikipedia preference scenarios;
- add negative and validation-oriented tests;
- add multi-browser execution;
- add richer tagging and suite segmentation;
- publish HTML reports automatically to Pages or external storage;
- integrate linting, formatting, and pre-commit quality gates.
This repository is intended as an automation framework example / portfolio-style QA project. Add your preferred license if the repository is going to be published publicly.
