Skip to content

Commit

Permalink
After including fixtures package: remove settings in cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuess committed Oct 31, 2024
1 parent c489b8a commit 669d591
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 86 deletions.
12 changes: 0 additions & 12 deletions cypress/tests/monolingual/monolingual.search.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ describe('Searchkit block tests – search - monolingual', () => {
});

it('I can search with inflection', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.supportedLanguages = ['de'];
settings.isMultilingual = false;
});
cy.wait(2000);
cy.get('.searchbar-wrapper input').type('Männer{enter}');
cy.get('.block.searchkitsearch').contains('Testseite Mann');

Expand Down Expand Up @@ -117,12 +111,6 @@ describe('Searchkit block tests – search - monolingual', () => {
});

it('I can search for a compounded word', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.supportedLanguages = ['de'];
settings.isMultilingual = false;
});
cy.wait(2000);
cy.get('.searchbar-wrapper input').type('stelle{enter}');
cy.get('.block.searchkitsearch').contains('Testseite Lehrstellenbörsen');

Expand Down
17 changes: 6 additions & 11 deletions cypress/tests/multilingual/multilingual.language.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,14 @@ describe('Searchkit block tests – search - multilingual - language', () => {
cy.wait(5000);
});

it('I can search within language', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'en';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});

it('I can search within language', function () {
cy.get('.searchbar-wrapper input')
.type('februax{enter}')
.wait('@kitsearch')
.get('.block.searchkitsearch')
.should('not.contain', 'Der Garten im Februar')
.get('.block.searchkitsearch')
.wait('@kitsearch');
cy.screenshot();
cy.get('.block.searchkitsearch')
.should('not.contain', 'Der Garten im Februar');
cy.get('.block.searchkitsearch')
.contains('The garden in february');
});
});
10 changes: 0 additions & 10 deletions cypress/tests/multilingual/multilingual.search.anonymous.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,13 @@ describe('Searchkit block tests – search - multilingual - anonymous', () => {
});

it('I can search', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'en';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.get('.searchbar-wrapper input').type('february{enter}');
cy.get('.block.searchkitsearch').contains('The garden in february');
cy.get('.searchbar-wrapper input').clear().type('march{enter}');
cy.get('.block.searchkitsearch').contains('The garden in march');
});

it('As anonymous I see only published content', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'en';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.intercept('POST', '/**/@kitsearch').as('kitsearch');
cy.intercept('/**/@logout').as('logout');

Expand Down
59 changes: 6 additions & 53 deletions cypress/tests/multilingual/multilingual.search.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Searchkit block tests – search -multilingual - fuzzy etc', () => {
cy.intercept('GET', `/**/*?expand*`).as('content');
cy.intercept('GET', '/**/Document').as('schema');
// Wait a bit to previous teardown to complete correctly because Heisenbug in this point
cy.wait(3000);
cy.wait(2000);
// given a logged in editor and a page in edit mode
cy.autologin();

Expand Down Expand Up @@ -57,7 +57,7 @@ describe('Searchkit block tests – search -multilingual - fuzzy etc', () => {
path: '/de',
});
// Wait after creating content for ingest and OpenSearch to index
cy.wait(3000);
cy.wait(2000);

// Add search block
cy.visit('/de/suche/edit');
Expand All @@ -79,38 +79,21 @@ describe('Searchkit block tests – search -multilingual - fuzzy etc', () => {
cy.removeContent({ path: 'de/testseite-lsb' });
cy.removeContent({ path: 'de/testseite-s' });
cy.removeContent({ path: 'de/suche' });
cy.wait(5000);
cy.wait(2000);
});

it('I see all if no filter selected', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.wait(4000);
cy.get('.block.searchkitsearch').contains('Der Garten im Februar');
cy.screenshot();
});

it('I can search fuzzy', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.wait(4000);
cy.get('.searchbar-wrapper input').type('februax{enter}');
cy.get('.block.searchkitsearch').contains('Der Garten im Februar');
cy.get('.block.searchkitsearch').should('not.contain', 'März');
});

it('I can search with inflection', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.wait(4000);
cy.get('.searchbar-wrapper input').clear().type('Männer{enter}');
cy.get('.block.searchkitsearch').contains('Testseite Mann');

Expand All @@ -119,12 +102,6 @@ describe('Searchkit block tests – search -multilingual - fuzzy etc', () => {
});

it('I can search with decompounding', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.wait(4000);
cy.get('.searchbar-wrapper input').type('Garten{enter}');
cy.get('.block.searchkitsearch').contains('Garten-Blog');

Expand All @@ -133,36 +110,18 @@ describe('Searchkit block tests – search -multilingual - fuzzy etc', () => {
});

it('I can search with wildcard', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.wait(4000);
cy.get('.searchbar-wrapper input').type('Feb*{enter}');
cy.get('.block.searchkitsearch').contains('Der Garten im Februar');
});

it('I can search for an exact match', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.wait(4000);
cy.get('.searchbar-wrapper input').type('"Mann"{enter}');
cy.get('.block.searchkitsearch').contains('Testseite Mann');
cy.get('.searchbar-wrapper input').clear().type('"Mann"{enter}');
cy.get('.block.searchkitsearch').should('not.contain', 'Männer');
});

it('I can search for a compounded word', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.wait(4000);
cy.get('.searchbar-wrapper input').type('stelle{enter}');
cy.get('.block.searchkitsearch').contains('Testseite Lehrstellenbörsen');
cy.get('.searchbar-wrapper input').clear().type('Lehre{enter}');
Expand All @@ -175,12 +134,6 @@ describe('Searchkit block tests – search -multilingual - fuzzy etc', () => {

// Blocks text
it('I can search in blocks', function () {
cy.settings().then((settings) => {
settings.defaultLanguage = 'de';
settings.isMultilingual = true;
settings.supportedLanguages = ['de', 'en'];
});
cy.wait(4000);
cy.intercept('POST', '/**/@kitsearch').as('kitsearch');
cy.visit('/de/garten-blog/februar');
cy.get('a.edit').click();
Expand All @@ -193,10 +146,10 @@ describe('Searchkit block tests – search -multilingual - fuzzy etc', () => {
// cy.toolbarSave();
cy.get('#toolbar-save').click();
cy.wait('@content');

cy.log('I added a text block');
// Wait after creating content for ingest and OpenSearch to index
cy.wait(3000);
cy.wait(1000);

// Searching
cy.visit('de/suche');
Expand Down

0 comments on commit 669d591

Please sign in to comment.