| 1 | import { When, Then, Given } from "@badeball/cypress-cucumber-preprocessor"; |
| 2 | |
| 3 | export const navigateTo = (handle: string) => { |
| 4 | cy.visit(Cypress.env("BASE_URL") + "/" + handle); |
| 5 | cy.location("pathname").should("match", new RegExp(`.*${handle}$`)); |
| 6 | }; |
| 7 | |
| 8 | Given("I am on {string} page", (handle: string) => { |
| 9 | navigateTo(handle); |
| 10 | }); |
| 11 | |
| 12 | When("I navigate to {string} page", (handle: string) => { |
| 13 | cy.visit(Cypress.env("BASE_URL") + "/" + handle); |
| 14 | }); |
| 15 | |
| 16 | Then("I should be on {string} page", (handle: string) => { |
| 17 | cy.location("pathname").should("match", new RegExp(`.*${handle}$`)); |
| 18 | }); |