Skip to content

Commit

Permalink
LF-4026 PR #2931 feedback - make custom commands called only in comma…
Browse files Browse the repository at this point in the history
…nds.js regular functions
  • Loading branch information
kathyavini committed Jan 30, 2024
1 parent 1408363 commit afa7a6e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/end-to-end/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@ Cypress.Commands.add(

cy.intercept('POST', '**/user').as('createUser');
cy.get(Selectors.WELCOME_GET_STARTED).should('exist').and('not.be.disabled').click();
cy.addFarm('UBC FARM', '49.250833, -123.2410777');
cy.onboardCompleteQuestions('Manager');
cy.acceptSlideMenuSpotlights(crop_menu_name);

addFarm('UBC FARM', '49.250833, -123.2410777');

onboardCompleteQuestions('Manager');

acceptSlideMenuSpotlights(crop_menu_name);

cy.createFirstLocation(map_menu_name, fieldString);
cy.visit('/');
} else {
Expand All @@ -87,7 +91,7 @@ Cypress.Commands.add(
},
);

Cypress.Commands.add('addFarm', (farmName, location) => {
const addFarm = (farmName, location) => {
cy.intercept('GET', '**/maps.googleapis.com/maps/api/js/GeocodeService.*').as(
'googleMapGeocodeCall',
);
Expand All @@ -100,9 +104,9 @@ Cypress.Commands.add('addFarm', (farmName, location) => {
cy.wait('@googleMapGeocodeCall');
cy.waitForReact();
cy.get(Selectors.ADD_FARM_CONTINUE).should('not.be.disabled').click();
});
};

Cypress.Commands.add('onboardCompleteQuestions', (role) => {
const onboardCompleteQuestions = (role) => {
// cy.clock();
cy.url().should('include', '/role_selection');
// cy.tick();
Expand Down Expand Up @@ -160,7 +164,7 @@ Cypress.Commands.add('onboardCompleteQuestions', (role) => {
// Outro
cy.url().should('include', '/outro');
cy.get(Selectors.OUTRO_FINISH).should('exist').and('not.be.disabled').click();
});
};

Cypress.Commands.add('createFirstLocation', (map_menu_name, fieldString) => {
cy.intercept('GET', '**/maps.googleapis.com/maps/api/**').as('googleMapsApiCall');
Expand Down Expand Up @@ -227,7 +231,7 @@ Cypress.Commands.add('createFirstLocation', (map_menu_name, fieldString) => {
.should('not.be.empty');
});

Cypress.Commands.add('acceptSlideMenuSpotlights', (crop_menu_name) => {
const acceptSlideMenuSpotlights = (crop_menu_name) => {
// Check the spotlights
cy.get(Selectors.SPOTLIGHT_NEXT).should('exist').and('not.be.disabled').click();
cy.get(Selectors.SPOTLIGHT_NEXT).should('exist').and('not.be.disabled').click();
Expand All @@ -244,4 +248,4 @@ Cypress.Commands.add('acceptSlideMenuSpotlights', (crop_menu_name) => {
.should('exist')
.and('not.be.disabled')
.click();
});
};

0 comments on commit afa7a6e

Please sign in to comment.