- Prerequisites
- Installation
- Running the App
- Running the Tests
- Adding New Steps and Features
- Instructions
-
Node.js (v14 or later recommended)
-
Nx CLI (optional, but helpful). You can install it globally:
npm install -g nx
Or just use
npx nx <command>
within the project.Learn more about nx: https://nx.dev/
-
Clone this repository (or download the source).
-
Install dependencies:
npm install
or
yarn
Install playwright:
npx playwright install
-
Serve the app locally:
nx serve my-calculator-workspace
Nx will compile and run the React app on http://localhost:4200 by default.
-
Open your browser at http://localhost:4200.
We use Cucumber + Playwright for E2E tests. The tests are located in the e2e project, typically named my-calculator-workspace-e2e
.
-
In one terminal:
nx serve my-calculator-workspace
-
In another terminal:
npm run cucumber
If you have issues, try also this command
nx e2e my-calculator-workspace-e2e
You can add or modify test scenarios in the Cucumber feature files and step definitions under:
apps/
my-calculator-workspace-e2e/
src/
features/ <-- .feature files here
steps/ <-- .steps.ts files here
- Feature Files: Write your Gherkin (
.feature
) scenarios infeatures/
. - Step Definitions: Implement the test logic in
.steps.ts
files understeps/
. - Aditional Objects: Feel free to structure any Page Object Model (POM) elements however you prefer.
When you run npm run cucumber
or nx e2e my-calculator-workspace-e2e
, Nx will execute all scenarios in features/
and use the step definitions in steps/
.
-
Add some end-to-end tests in a way you believe is most efficient.
-
You can use the blank feature and step files as a starting point, but feel free to create your own approach if you prefer.
-
Creating a Page Object Model (POM) to assist your tests is encouraged.
-
Avoid modifying the application’s source files directly, if possible.
Happy Testing!