This repository contains End-to-End (E2E) automated tests written with Cypress.
- Node.js (LTS recommended)
- npm (comes with Node.js)
Verify:
node -v
npm -v- Pull the latest code:
git pull- Install dependencies (run in the project root where
package.jsonis):
npm install- (Recommended) Confirm Cypress is installed:
npx cypress verifyCreate a new test file under cypress/e2e/ (Cypress will show it in the UI).
Naming convention:
e2e_<feature>_<scenario>.cy.js
Example:
cypress/e2e/e2e_login_happy.cy.js
Starter template:
describe("Feature: Login", () => {
it("logs in successfully", () => {
cy.visit(Cypress.env("BASE_URL"));
});
});This repo enables Cypress Studio (Record) in cypress.config.js:
experimentalStudio: true;If you do not see Studio in the UI, check your Cypress version and upgrade if needed.
Use Cypress UI runner:
npx cypress openIn the Cypress window:
- Select E2E Testing
- Choose a browser
- Click your spec file in
cypress/e2e/ - Use Studio / Record to record steps (if available)
- Save the recorded steps into the spec
After recording, it’s recommended to:
- Replace hard-coded values with
Cypress.env(...) - Add assertions like
should('be.visible')to stabilize the flow - Avoid fragile selectors like
nth-child(...)when possible
Run all specs:
npx cypress runRun a single spec:
npx cypress run --spec "cypress/e2e/e2e_mainflow_testcase.cy.js"This project is configured to generate a Mochawesome HTML report.
After npx cypress run, open:
cypress/reports/html/index.html
Windows quick open:
start cypress\reports\html\index.html- Custom Cypress commands:
cypress/support/commands.js - Global setup/hooks:
cypress/support/e2e.js
cypress/e2e/e2e_mainflow_testcase.cy.jscypress/e2e/e2e_adminCancelFlow_testcase.cy.js