From 4f54f3b3943aab55062f0a8488f3ae18fd5b2288 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Thu, 17 Mar 2022 15:48:32 -0300 Subject: [PATCH] Synonyms tests: wp-cli --- .../features/search/synonyms.spec.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/cypress/integration/features/search/synonyms.spec.js b/tests/cypress/integration/features/search/synonyms.spec.js index 5f6c027b2a..b4922b4603 100644 --- a/tests/cypress/integration/features/search/synonyms.spec.js +++ b/tests/cypress/integration/features/search/synonyms.spec.js @@ -125,4 +125,22 @@ describe('Post Search Feature - Synonyms Functionality', () => { 'bar', ).should('exist'); }); + it('Can preserve synonyms if a sync is performed', () => { + cy.visitAdminPage('admin.php?page=elasticpress-synonyms'); + cy.get('.page-title-action').then(($button) => { + if ($button.text() === 'Switch to Advanced Text Editor') { + $button.click(); + } + }); + + cy.get('#ep-synonym-input').clearThenType('foo => bar{enter}list,of,words'); + cy.get('#synonym-root .button-primary').click(); + + cy.wpCli('elasticpress index --setup --yes'); + + cy.visitAdminPage('admin.php?page=elasticpress-synonyms'); + cy.get('#ep-synonym-input') + .should('contain', 'foo => bar') + .should('contain', 'list, of, words'); + }); });