Skip to content

Commit

Permalink
Cherry-pick facet tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
burhandodhy committed Oct 11, 2022
1 parent 5b75651 commit ca2c87f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/cypress/integration/features/facets.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ describe('Facets Feature', () => {
cy.openBlockSettingsSidebar();
cy.get('.block-editor-block-inspector select').select('post_tag');
cy.get('.block-editor-block-inspector input[type="radio"][value="name"]').click();

// Make sure it waits for the correct request.
cy.intercept('/wp-json/elasticpress/v1/facets/block-preview*orderby=name&order=asc*').as(
'blockPreview1',
);
cy.get('.block-editor-block-inspector input[type="radio"][value="asc"]').click();
cy.wait('@blockPreview1');

/**
* Verify the block has the expected output in the editor based on the
Expand Down Expand Up @@ -321,7 +327,12 @@ describe('Facets Feature', () => {
cy.get('.block-editor-block-inspector input[type="text"]').clearThenType(
'Search Meta 1',
);

cy.intercept(
'/wp-json/elasticpress/v1/facets/meta/block-preview*facet=meta_field_1*',
).as('blockPreview1');
cy.get('.block-editor-block-inspector select').select('meta_field_1');
cy.wait('@blockPreview1');

/**
* Verify that the blocks are inserted into the editor, and contain the
Expand All @@ -345,7 +356,12 @@ describe('Facets Feature', () => {
);
cy.get('.block-editor-block-inspector select').select('meta_field_2');
cy.get('.block-editor-block-inspector input[type="radio"][value="name"]').click();

cy.intercept(
'/wp-json/elasticpress/v1/facets/meta/block-preview*orderby=name&order=asc*',
).as('blockPreview2');
cy.get('.block-editor-block-inspector input[type="radio"][value="asc"]').click();
cy.wait('@blockPreview2');

/**
* Verify the block has the expected output in the editor based on the
Expand Down

0 comments on commit ca2c87f

Please sign in to comment.