Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search e2e Tests: Fix b0rked WooCommerce test #4906

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/search/e2e/integration/features/woocommerce.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ describe('WooCommerce Feature', { tags: '@slow' }, () => {
cy.get('.woocommerce-orders-table tbody tr').should('have.length', 1);

// VIP: Use Search Dev Tools instead of Debug Bar
// cy.searchDevToolsResponseOK('shop_order');
cy.searchDevToolsResponseOK('shop_order', 2);
cy.get('#vip-search-dev-tools-mount').click();
cy.get('h3.vip-h3').first().click();
cy.get('strong.vip-h4.wp_query').first().click();
cy.get('ol.wp_query.vip-collapse-ol').first().should('contain.text','orderby: "date"');
cy.get('h3.vip-h3').eq(2).click();
cy.get('strong.vip-h4.wp_query').eq(2).click();
cy.get('ol.wp_query.vip-collapse-ol').eq(2).should('contain.text','orderby: "date"');
cy.get('#vip-search-dev-tools-mount').click();

cy.logout();
Expand Down
7 changes: 4 additions & 3 deletions tests/search/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,12 @@ Cypress.Commands.add('createUser', (userData) => {
});

// VIP: Check that Search Dev Tools returns a 200 status and a certain text in the response body
Cypress.Commands.add('searchDevToolsResponseOK', (bodyText) => {
// If there's more than one ES query, use the index to select the correct one
Cypress.Commands.add('searchDevToolsResponseOK', (bodyText, index = 0) => {
cy.get('#vip-search-dev-tools-mount').click();
cy.get('h3.vip-h3').first().should('contain.text','(200)');
cy.get('h3.vip-h3').eq( index ).should('contain.text','(200)');
if ( bodyText ) {
cy.get('.line-numbers').first().should('contain.text', bodyText);
cy.get('.line-numbers').eq( index ).should('contain.text', bodyText);
}
cy.get('#vip-search-dev-tools-mount').click();
});
Expand Down
Loading