A minimal, modular Playwright framework for end-to-end (E2E) browser automation and API testing. Designed for scalability, maintainability, and ease of use.
- Page Object Model (POM) structure ready to use
- API placeholder and datatypes
- Test data generation utilities
- Factory pattern for test data
- Fixtures for test setup
- HTML reporting
npm installnpx playwright testView the HTML report:
npx playwright show-reportapi/placeholder.api.ts— API endpoint definitions and configurations
components/AbstractComponent.ts— Abstract base class for UI components
config/timeouts.ts— Centralized timeout configurations
data/— Test data files and datasetsfactory/UserFactory.ts— Factory for generating user test data
fixtures/fixture-pom.ts— Playwright fixtures for Page Object Model setup
global.setup.ts— Global test setup configurationglobal.teardown.ts— Global test teardown configurationpom/— Page Object Model implementationBasePage.ts— Base class for all page objectsPageManager.ts— Central manager for page objectspages/samplePage.ts— Example page object
tests/— Test specificationsAPI/— API test specssample.api.ts— Example API test
UI/— UI/E2E test specssample.spec.ts— Example UI test
types/— TypeScript type definitionsenums/logger.ts— Logger enumeration typesrest.ts— REST API enumeration types
types/api.d.ts— API-related type definitionspost.d.ts— Post-related type definitionsuser.d.ts— User data type definitions
utils/— Utility functions and helpersapi/api.helpers.ts— API testing helper functions
generators/dataGenerator.ts— Utility for generating random or dynamic test data
logger/logger.ts— Logging utility functions
runner/sharedPage.ts— Shared page state management utilities
playwright.config.ts— Playwright configuration filetsconfig.json— TypeScript configurationpackage.json— Project dependencies and scripts
Page Object Model (POM) fixture is being create in order to reduce amount of code duplications and let engineer to reuse pages from one single instance of calling fixture in the test execution
import { test } from '../../fixtures/fixture-pom';
test('Simple test', async ({ pm }) => {
await pm.samplePage.goto()
});Shared page stage design is designed to let engineer create single-runner suites with one shared context, since in Playwright each test with default page fixture will create new separate isolated context
let page: Page;
test.beforeAll(async ({ browser }) => {
await setupSharedPage(browser, 'URL');
page = getSharedPage();
});
test.afterAll(async () => {
await teardownSharedPage();
});
test.describe('Shared page suite', () => {
test('Test 1', async () => {
// Actions
});
test('Test 2', async () => {
// Actions
});
});