Skip to content

Commit

Permalink
Fix cypress multilingual
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuess committed Jun 17, 2024
1 parent 1b87e16 commit 3dd350e
Showing 1 changed file with 61 additions and 66 deletions.
127 changes: 61 additions & 66 deletions acceptance/cypress/tests/language.multilingual.cy.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,65 @@
describe('Searchkit block tests – search - multilingual', () => {
before(() => {
cy.intercept('GET', `/**/*?expand*`).as('content');
cy.intercept('GET', '/**/Document').as('schema');

cy.autologin();

cy.createContent({
contentType: 'Document',
contentId: 'searching',
contentTitle: 'Searching and Finding',
path: '/en',
});

cy.createContent({
contentType: 'Document',
contentId: 'garden-in-february',
contentTitle: 'The garden in february',
path: '/en',
});

cy.createContent({
contentType: 'Document',
contentId: 'der-garten-im-februar',
contentTitle: 'Der Garten im Februar',
path: '/de',
});


// Add search block to /suche
cy.visit('/en/searching');
cy.get('a.edit').click();

cy.getSlate().click();
cy.get('.button .block-add-button').click({ force: true });
cy.get('div[aria-label="Unfold Common blocks"]').click();
cy.get('.blocks-chooser .common .button.searchkitblock').click({
force: true,
});

cy.get('#toolbar-save').click();
cy.wait('@content');
before(() => {
cy.intercept('GET', `/**/*?expand*`).as('content');
cy.intercept('GET', '/**/Document').as('schema');

cy.autologin();

cy.createContent({
contentType: 'Document',
contentId: 'garden-in-february',
contentTitle: 'The garden in february',
path: 'en',
});

beforeEach(() => {
cy.intercept('GET', `/**/*?expand*`).as('content');
cy.intercept('GET', '/**/Document').as('schema');
cy.intercept('GET', '/**/@kitsearch').as('kitsearch');

cy.autologin();

cy.visit('/en/searching');
cy.wait(1000);

cy.createContent({
contentType: 'Document',
contentId: 'der-garten-im-februar',
contentTitle: 'Der Garten im Februar',
path: 'de',
});

after(() => {
cy.removeContent({ path: 'en/garden-in-february' });
cy.removeContent({ path: 'en/searching' });
cy.removeContent({ path: 'de/der-garten-im-februar' });
});


it('I can search within language', function () {
cy.get('.searchbar-wrapper input').type('februax{enter}');
cy.get('.block.searchkitsearch').contains('The garden in february');
cy.get('.block.searchkitsearch').should('not.contain', 'Der Garten im Februar');
});


// Add search block
cy.visit('/en/edit');

cy.getSlate().clear().type('{enter}');
cy.get('.button .block-add-button').click({ force: true });
cy.get('.blocks-chooser .title').contains('Common').click();
cy.get('.blocks-chooser .common')
.contains('Searchkit')
.click({ force: true });

cy.get('#toolbar-save').click();
cy.wait('@content');
});

beforeEach(() => {
cy.intercept('GET', `/**/*?expand*`).as('content');
cy.intercept('GET', '/**/Document').as('schema');
cy.intercept('GET', '/**/@kitsearch').as('kitsearch');

cy.autologin();

cy.visit('/en');
cy.wait('@content');
});

after(() => {
cy.removeContent({ path: 'en/garden-in-february' });
cy.removeContent({ path: 'de/der-garten-im-februar' });
});

it('I can search within language', function () {
cy.get('.searchbar-wrapper input').type('february{enter}');
cy.get('.block.searchkitsearch').contains('The garden in february');
});

it('I can search within language', function () {
cy.get('.searchbar-wrapper input').type('februax{enter}');
cy.get('.block.searchkitsearch').contains('The garden in february');
cy.get('.block.searchkitsearch').should(
'not.contain',
'Der Garten im Februar',
);
});
});

0 comments on commit 3dd350e

Please sign in to comment.