1 import { And, Given, Then, When } from 'cypress-cucumber-preprocessor/steps';
3 import { UrlsCollection } from './urls.po';
5 const urlsCollection = new UrlsCollection();
7 Given('I am logged in', () => {
11 Given('I am on the {string} page', (page: string) => {
12 cy.visit(urlsCollection.pages[page].url);
13 cy.get(urlsCollection.pages[page].id).should('exist');
16 Then('I should be on the {string} page', (page: string) => {
17 cy.get(urlsCollection.pages[page].id).should('exist');
20 And('I should see a button to {string}', (button: string) => {
21 cy.get(`[aria-label="${button}"]`).should('be.visible');
24 When('I click on {string} button', (button: string) => {
25 cy.get(`[aria-label="${button}"]`).first().click();
28 Then('I should see the modal', () => {
29 cy.get('cd-modal').should('exist');
32 Then('I should not see the modal', () => {
33 cy.get('cd-modal').should('not.exist');
36 And('I go to the {string} tab', (names: string) => {
37 for (const name of names.split(', ')) {
38 cy.contains('.nav.nav-tabs a', name).click();