Skip to content

Commit

Permalink
fix: migrate deprecated And's
Browse files Browse the repository at this point in the history
  • Loading branch information
victorcg88 committed Sep 26, 2024
1 parent 290eb39 commit 5b3da45
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 43 deletions.
2 changes: 0 additions & 2 deletions tests/e2e/cucumber/my-history.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Feature: My History component

# TODO: Enable test after solving deprecated 'And'
@skip
Scenario Outline: 1. Click on a history query closes the modal and searches that query
Given start page with "<view>" size view
When search bar is clicked
Expand Down
32 changes: 16 additions & 16 deletions tests/e2e/cucumber/my-history.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Then } from '@badeball/cypress-cucumber-preprocessor';
import { Then, When } from '@badeball/cypress-cucumber-preprocessor';

// And('my history button is clicked', () => {
// cy.getByDataTest('my-history-button').click();
// });
When('my history button is clicked', () => {
cy.getByDataTest('my-history-button').click();
});

// And('my history queries are displayed', () => {
// cy.getByDataTest('my-history-query').should('have.length.at.least', 1);
// });
Then('my history queries are displayed', () => {
cy.getByDataTest('my-history-query').should('have.length.at.least', 1);
});

// And('my history query number {int} is clicked', (position: number) => {
// cy.getByDataTest('my-history-query').eq(position).getByDataTest('history-query').click();
// });
When('my history query number {int} is clicked', (position: number) => {
cy.getByDataTest('my-history-query').eq(position).getByDataTest('history-query').click();
});

// And('my history query number {int} delete button is clicked', (position: number) => {
// cy.getByDataTest('my-history-query')
// .eq(position)
// .getByDataTest('remove-history-query')
// .trigger('click');
// });
When('my history query number {int} delete button is clicked', (position: number) => {
cy.getByDataTest('my-history-query')
.eq(position)
.getByDataTest('remove-history-query')
.trigger('click');
});

Then('my history is visible', () => {
cy.getByDataTest('my-history-queries').should('be.visible');
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/cucumber/no-results.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Feature: No-results component

# TODO: Enable test after solving deprecated 'And'
@skip
Scenario Outline: 1. No results message exists and contains the query
Given start page with "<view>" size view
When search bar is clicked
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/cucumber/no-results.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Then('no results message is displayed', () => {
cy.getByDataTest('no-results-message').should('exist');
});

// And('there are no results', () => {
// cy.getByDataTest('search-grid-result').should('not.exist');
// });
Then('there are no results', () => {
cy.getByDataTest('search-grid-result').should('not.exist');
});
8 changes: 0 additions & 8 deletions tests/e2e/cucumber/predictive-components.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Feature: Predictive components

# TODO: Enable test after solving deprecated 'And'
@skip
Scenario Outline: 1. Predictive components are displayed as expected
Given start page with "<view>" size view
When search bar is clicked
Expand All @@ -21,8 +19,6 @@ Feature: Predictive components
| dress | macbook-13 |
| dress | iphone-x |

# TODO: Enable test after solving deprecated 'And'
@skip
Scenario Outline: 2. Related tags interaction
Given start page with "<view>" size view
When search bar is clicked
Expand All @@ -40,8 +36,6 @@ Feature: Predictive components
| tshirt | 1 | macbook-13 |
| tshirt | 1 | iphone-x |

# TODO: Enable test after solving deprecated 'And'
@skip
Scenario Outline: 3. Clear a history query
Given start page with "<view>" size view
When search bar is clicked
Expand All @@ -56,8 +50,6 @@ Feature: Predictive components
| shirt, shoe, skirt | 0 | macbook-13 |
| shirt, shoe, skirt | 0 | iphone-x |

# TODO: Enable test after solving deprecated 'And'
@skip
Scenario Outline: 4. Clear all history queries
Given start page with "<view>" size view
When search bar is clicked
Expand Down
24 changes: 12 additions & 12 deletions tests/e2e/cucumber/predictive-components.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Then, When } from '@badeball/cypress-cucumber-preprocessor';

// And('recommendations are displayed', () => {
// cy.getByDataTest('recommendation-item').should('have.length.at.least', 1);
// });
Then('recommendations are displayed', () => {
cy.getByDataTest('recommendation-item').should('have.length.at.least', 1);
});

// And('search input is focused', () => {
// cy.getByDataTest('search-input').should('be.focused');
// });
Then('search input is focused', () => {
cy.getByDataTest('search-input').should('be.focused');
});

// And('popular searches are displayed', () => {
// cy.getByDataTest('popular-search').should('have.length.at.least', 1);
// });
Then('popular searches are displayed', () => {
cy.getByDataTest('popular-search').should('have.length.at.least', 1);
});

Then('query suggestions are displayed', () => {
cy.getByDataTest('query-suggestion').should('have.length.at.least', 1);
Expand Down Expand Up @@ -83,9 +83,9 @@ Then(
);

// Scenario 4
// And('an empty search-box', () => {
// cy.clearSearchInput();
// });
When('an empty search-box', () => {
cy.clearSearchInput();
});

When('clear history queries button is clicked', () => {
cy.getByDataTest('clear-history-queries').click();
Expand Down

0 comments on commit 5b3da45

Please sign in to comment.