This repository contains an automated end-to-end test suite built with Playwright and Cucumber, executed via a TestNG runner. The framework is designed around configurability, maintainability, and clear, evidence-backed reporting.
Two feature areas are currently covered:
- Contact Us form — successful submission, validation error handling.
- Login Portal — native JS alert verification for valid and invalid credentials.
Key capabilities:
- Cross-browser execution — Chromium and Firefox, selectable at runtime.
- Externalized configuration — browser, base URL, headless mode, and timing are driven entirely from a properties file and may be overridden via JVM system properties.
- Dependency injection — step definition and hook classes are wired together via Cucumber's PicoContainer integration, avoiding static shared state between scenarios.
- Tag-based scenario selection — scenarios are tagged (
@contact-us,@login,@smoke,@demo-failure) so runs can be filtered to a subset without editing feature files. - Allure reporting — every scenario is reported with a full step timeline; failed scenarios automatically capture and attach a screenshot of the application state at the point of failure.
- Randomized test data — the successful-submission scenario uses Datafaker to generate random names, emails, and messages at runtime, rather than relying on hardcoded values.
- Continuous integration — a Jenkins pipeline (see
Jenkinsfile) builds the project, runs the suite headless, publishes a Test Result Trend graph, and archives the Allure report as a build artifact.
All environment values are defined in src/test/resources/config/config.properties:
| Key | Description |
|---|---|
browser |
Target browser (chromium or firefox) |
base.url |
Base URL of the application under test |
headless |
Whether to run headless (true/false) |
step.delay.ms |
Pause applied after each Gherkin step |
login.portal.path |
Path appended to base.url for the Login Portal page |
Any key may be overridden at runtime via a JVM system property without modifying the properties file, for example:
java -Dbrowser=firefox -cp "$CP" org.testng.TestNG -testclass runner.TestRunnermvn dependency:build-classpath -Dmdep.outputFile=/tmp/cp.txt -q
CP=$(cat /tmp/cp.txt):target/classes:target/test-classes
java -cp "$CP" org.testng.TestNG -testclass runner.TestRunnerTo run a specific subset of scenarios, override the tag filter at runtime:
java -Dcucumber.filter.tags="@login" -cp "$CP" org.testng.TestNG -testclass runner.TestRunnerThe Jenkinsfile defines a declarative pipeline with two build parameters:
| Parameter | Description |
|---|---|
BROWSER |
chromium or firefox |
CUCUMBER_TAGS |
Cucumber tag expression to filter scenarios for that run |
The pipeline checks out the repo, builds it, runs the suite headless, publishes JUnit-format test results (for the build's Test Result Trend graph), generates the Allure report, and archives both the Allure results and report as build artifacts.
A Jenkins pipeline job (playwright-cucumber-automation) is already configured against this repository, pulling main and executing Jenkinsfile directly — no additional Jenkins-side scripting is needed. To reproduce this setup on another Jenkins instance:
- Install the TestNG Results plugin (required for the
junit/TestNG report publishing step to have a matching test framework on the classpath). - Create a new Pipeline job.
- Under Pipeline, choose Pipeline script from SCM, set the SCM to Git, point it at this repository's URL and the
mainbranch, and set the script path toJenkinsfile. - Run the job once — this registers the
BROWSERandCUCUMBER_TAGSparameters (declared inside the Jenkinsfile itself) so subsequent runs can be triggered with Build with Parameters.
Generate and view the Allure report:
mvn io.qameta.allure:allure-maven:2.12.0:serveWhen a scenario fails, a screenshot of the current page state is automatically captured and attached to that scenario's entry in the report (see Hooks.java/BrowserManager.java), providing immediate visual context for the failure without needing to re-run the test.
This project is licensed under the MIT License.
