31
loading...
This website collects cookies to deliver better user experience
cd todomvc-typescript-react
npm install
npm start
npm install cypress cypress-cucumber-preprocessor --save-dev
// package.json
...
"scripts": {
...
"cy:open": "cypress open"
},
...
npm run cy:open
// cypress.json
{
"baseUrl": "http://localhost:4200/",
"testFiles": "**/*.{feature,features}"
}
const cucumber = require("cypress-cucumber-preprocessor").default;
module.exports = (on, config) => {
on("file:preprocessor", cucumber());
};
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
}
Feature: Home page
Scenario: See the home page
Given I navigate to the home page
When the home page has loaded
Then I see the home page
import { Given, Then, When } from "cypress-cucumber-preprocessor/steps";
Given("I navigate to the home page", () => {
cy.visit("/");
});
When("the home page has loaded", () => {
cy.get(".todoapp").should("be.visible");
});
Then("I see the home page", () => {
cy.get(".header").should("be.visible");
cy.get(".info").should("be.visible");
});
npm start
npm run cy:open