A modern end-to-end testing framework built with Playwright + Cucumber.js + TypeScript for testing Google Maps functionality. Features Page Object Model, structured logging, automated screenshots on failure, and comprehensive CI/CD integration.
- Modern Stack: Playwright + Cucumber.js + TypeScript with ES modules
- Page Object Model: Centralized
Commonclass for reusable page interactions - Structured Logging: Custom tslog configuration with timestamp formatting
- Browser Management: Flexible browser selection (Chrome, Firefox, Safari)
- Screenshot Capture: Automatic full-page and viewport screenshots on test failures
- File Operations: Automated download handling and route data extraction
- CI/CD Ready: GitHub Actions workflow with headless execution
- Type Safety: Full TypeScript support with proper type annotations
- Node.js (LTS version recommended)
- npm or yarn
- VS Code with Playwright Test extension (recommended)
-
Clone the repository
git clone https://github.com/pgundlupetvenkatesh/e2ePlaywrightCukeDemo.git cd e2ePlaywrightCukeDemo -
Install dependencies
npm install
-
Install Playwright browsers
npx playwright install --with-deps
# Run Google Maps tests
npm test -- -t @google-map
# Run Google Maps test and view Allure Report
npm run test:report
# Run specific feature tests
npm test -- -t @tirekick
# Run in headless mode
HEADLESS=true npm test -- -t @google-map
# Run with specific browser, defaults to Chromium
BROWSER=firefox npm test -- -t @google-map# Validate all feature files and step definitions
npx cucumber-js --dry-run
# Validate specific tags
HEADLESS=true npx cucumber-js --dry-run -t @tirekick# Verbose Playwright API logging
DEBUG=pw:api npm test -- -t @google-map
# Full debug logging (including network)
DEBUG=* npm test -- -t @google-mapβββ features/
β βββ google_maps_demo.feature # Google Maps test scenarios
β βββ tirekick.feature # Basic functionality tests
β βββ step_definitions/
β βββ generic_steps.ts # Step definitions with Page Object Model
βββ pages/
β βββ common.ts # Page Object Model utilities
βββ features/support/
β βββ hooks.ts # Cucumber hooks (setup/teardown)
β βββ helpers/
β β βββ browser_manager.ts # Browser configuration
β β βββ logger.ts # Structured logging setup
β β βββ helper.ts # Utility functions (file ops, URL parsing)
β β βββ common.ts # Shared utilities (deprecated - moved to pages/)
β βββ output/ # Test output files
β βββ downloads/ # Downloaded files
β βββ screenshots/ # Failure screenshots (gitignored)
βββ .github/workflows/
β βββ playwright.yml # CI/CD pipeline
βββ cucumber.json # Cucumber configuration
βββ playwright.config.ts # Playwright configuration
βββ package.json # Dependencies and scripts
Set the BROWSER environment variable:
BROWSER=chrome # Default
BROWSER=firefox
BROWSER=webkit # SafariHEADLESS=true npm test -- -t @google-mapAfter test execution, open cucumber-report.html in your browser for detailed results with screenshots.

- Install Allure Report here
- Install Allure-playwright adapter.
npm install --save-dev @playwright/test allure-playwright
- Routes data: Saved to
features/support/output/directions.txt
- Screenshots: Automatically captured on failures in
features/support/screenshots/ - Downloads: Handled automatically in
features/support/downloads/
Custom formatted logs show:
12.05.2025 12:34:24:177 INFO[e2e-playwright-cuke-demo] Browser launched successfully
12.05.2025 12:34:24:485 INFO[e2e-playwright-cuke-demo] Page created successfully
The Common class provides reusable methods:
const obj = new Common(page);
await obj.fillIn("Sacramento CA", searchBox);
const values = await obj.getValsByEleAttr(locator, "aria-label");Helper functions in helper.ts handle:
- File Operations: Writing test data to files with automatic directory creation
- URL Parsing: Extracting coordinates from Google Maps URLs
- Data Processing: Route information extraction and formatting
// File operations
await writeToFile("routes.txt", routeData);
// URL coordinate extraction
const coords = await extractCoordinatesFromURL(page.url());Browser setup and teardown handled in hooks.ts:
- Single browser instance per test suite
- Automatic context creation with dark mode
- Download handling and cookie management
Custom tslog configuration with consistent formatting across all test files.
GitHub Actions automatically runs tests on push/PR to main branches:
- Validates all feature files with dry-run
- Executes tests in headless mode
- Generates and uploads test reports
"Steps are undefined"
- Ensure feature files and step definitions are properly configured in
cucumber.json - Run
npx cucumber-js --dry-runto validate step mappings
Browser launch failures
- Run
npx playwright install --with-depsto install browser binaries - Check
BROWSERenvironment variable
Module resolution errors
- Project uses ES modules - ensure
importstatements use.tsextensions - Check
package.jsonhas"type": "module"
- Use
DEBUG=pw:apifor Playwright API logging - Check
features/support/screenshots/for failure screenshots - Review
cucumber-report.htmlfor detailed step-by-step results
Current test scenarios:
- β Google Maps navigation and search
- β Route calculation and extraction
- β Location validation
- β File operations and data persistence
- Browser context(desired capabilities)
This project is licensed under the MIT License - see the LICENSE file for details.
Built using Playwright, Cucumber.js, and TypeScript