POM Export
Export any test suite as a production-ready Playwright project using the Page Object Model (POM) pattern, complete with page objects, specs, and configuration.
POM Export
Export any test suite as a production-ready Playwright project using the Page Object Model (POM) pattern. The exported ZIP file contains everything you need to run tests locally or in your CI/CD pipeline.
The Page Object Model is a design pattern that creates an abstraction layer between test code and page structure. Each page in your application gets its own class with locators and action methods, making tests more maintainable and readable.
What's Included
The exported ZIP contains three files:
| File | Description |
|---|---|
pages/<ClassName>.ts |
TypeScript Page Object class with locators and action methods for all elements referenced in the test suite |
tests/<suite-name>.spec.ts |
Playwright spec file that imports the page object and runs all test cases |
playwright.config.ts |
Pre-configured Playwright config with the suite's base URL |
Page Object Class
Contains typed Locator properties for every selector used in the test steps, plus helper methods for common interactions (click, fill, select, etc.). The class name is derived from the page URL:
| Page URL | Class Name |
|---|---|
/ | HomePage |
/login | LoginPage |
/products/detail | DetailPage |
/checkout/payment | PaymentPage |
Spec File
Uses the Page Object to execute each test case. Each test() block corresponds to a test case from the suite, with steps calling page object methods.
Config File
Sets up the base URL, browser settings, and standard Playwright configuration with sensible defaults.
How to Export
-
1
Open a Test Suite
Navigate to the test suite you want to export.
-
2
Click Export POM
Click the Export POM button in the suite toolbar.
-
3
Download ZIP
A ZIP file downloads containing the page object, spec, and config ā ready to run.
Running the Exported Tests
# Unzip the export
unzip my-suite-pom.zip -d my-tests
cd my-tests
# Install dependencies
npm init -y
npm install -D @playwright/test
npx playwright install
# Run the tests
npx playwright test
The exported code follows standard Playwright conventions and can be:
- Committed directly to your repository
- Integrated into CI/CD pipelines (GitHub Actions, GitLab CI, etc.)
- Extended with additional custom tests
- Used as a starting point for more complex test frameworks
Tip: Use the POM Export to run AegisRunner-generated tests in your own infrastructure, or to hand off tests to your development team as standard Playwright code.
API Reference
GET /api/v1/suites/{suiteId}/export/pom
Returns a ZIP file (application/zip) with the filename <suite-name>-pom.zip.
Returns 404 if POM code has not been generated for the suite.