This project covers web test automation, built on Node.js core + Cucumber-JS/Playwright frameworks + TypeScript language.
- Install Node.js 22.10.0
- Install Cucumber-JS 11.1.1
- Install Playwright 1.49
- With the install command:
npm install
Tests are available in the test folder, in the project root
Test execution is orchestrated by Cucumber-JS, meaning you use tags tied to specific test scenarios, which follow the pattern @
+ purpose (e.g., @smoke-test
). For this project, run the following commands:
-
Run all tests (no tag is required):
npm test
-
Run a specific group of test scenarios (specify the desired tag):
npm test --TAGS="@smoke-test"
-
Run a specific group of test scenarios and ignore another group (specify both tags):
npm test --TAGS="@smoke-test and not @skip"
-
Run test scenarios tagged A or B (specify the tags):
npm test --TAGS="@smoke-test or @functional-test"
-
Run test scenarios tagged A and B (specify the tags):
npm test --TAGS="@smoke-test and @functional-test"
Thanks to the workflow_dispatch
feature, you can run the GitHub Actions workflow remotely by tags—choosing the environment and whether to generate the QA Report in ClickUp (yes or no) using input parameters. Follow these steps:
- Go to the Actions tab of the repository on GitHub.
- Select the Project Example – Pipeline(CI) workflow.
- Click the Run workflow button.
- Choose the desired environment (dev or test).
- In the
tags
input field, enter the tags you want to run, for example:@smoke-test
. If left blank, all test scenarios will be executed. - The
qa_report
field defaults to “no.” If you want to generate the QA Report, select “yes.” - Click Run workflow to start execution.
- After this workflow completes, the “pages build and deployment” workflow is triggered automatically, producing a test report available at: Cucumber Report HTML.
This feature allows you to execute tests remotely without modifying the code locally—just configure the tags through the GitHub Actions interface.
Note: For the GitHub Actions CI workflow to run, you must set/include the following secrets in Settings → Secrets → Actions:
Fixed secrets:
BASEURL_DEV
BASEURL_TEST
PASSWORD_DEV
PASSWORD_TEST
USER_NAME_DEV
USER_NAME_TEST
Test reports are generated by Cucumber-JS in two ways:
When you run the tests (as described above), two files are created in the test-result
folder:
cucumber-report.json
– Contains the base structure and metadata of the report.cucumber-report.html
– A detailed HTML report showing:- Passed and failed tests.
- Execution success rate.
- Date and duration of the last run.
- Operating system used.
- Versions of Node.js and Cucumber-JS.
- A detailed list of features and scenarios executed.
To view the HTML report, just open the cucumber-report.html
file in your browser. 🚀
The report generation for remote runs is under maintenance and will be integrated into the CI/CD pipeline. The goal is to make them available via GitHub Actions.
The generated report can be accessed at Cucumber Report HTML.
The JSON report can be accessed directly at Cucumber Report JSON.
If you want to generate the HTML report locally, follow these steps using the Cucumber HTML Formatter:
-
Install the tool (if you don’t have it yet):
npm install --save-dev @cucumber/html-formatter
-
Download the report JSON:
wget -O report.json https://leonardomelgarejo.github.io/test-automation-example/report.json
-
Generate the HTML report:
npx @cucumber/html-formatter report.json > cucumber-report.html
-
Open the report in your browser:
-
On macOS:
open cucumber-report.html
-
On Linux:
xdg-open cucumber-report.html
-
On Windows (CMD or PowerShell):
start cucumber-report.html
-
Currently, the CI pipeline includes the following steps:
- test: Run the automated tests.
- deploy-report: Deploy the test report to GitHub Pages.
Package | Version | Function |
---|---|---|
@cucumber/cucumber |
11.1.1 | BDD framework for test automation |
@playwright/test |
1.49.1 | Web and API test automation |
dotenv |
16.4.7 | Environment variable management |
ts-node |
10.9.2 | Allows running TypeScript without compiling to JavaScript |
Adjustments for the .env.test
file:
Make sure to create the .env.test
file in the helper/env
directory with the following environment variables:
mkdir -p helper/env
echo "USER_NAME=User example" > helper/env/.env.test
echo "PASSWORD=Password example" >> helper/env/.env.test
echo "BASEURL=http://example.com" >> helper/env/.env.test
echo "ENV=test" >> helper/env/.env.test