Passed
Push — master ( 3ff367...d46e79 )
by Christian
32:54 queued 20:32
created

src/Administration/Resources/app/administration/test/e2e/cypress/integration/settings/sw-settings-search/crud.spec.js   A

Complexity

Total Complexity 9
Complexity/F 1

Size

Lines of Code 71
Function Count 9

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 9
eloc 36
mnd 0
bc 0
fnc 9
dl 0
loc 71
rs 10
bpm 0
cpm 1
noi 7
c 0
b 0
f 0
1
/// <reference types="Cypress" />
2
3
import CategoryPageObject from '../../../support/pages/module/sw-category.page-object';
4
5
describe('Product Search: Test crud operations', () => {
6
    before(() => {
7
        cy.onlyOnFeature('FEATURE_NEXT_10552');
0 ignored issues
show
Bug introduced by
The variable cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
8
    });
9
10
    beforeEach(() => {
11
        cy.setToInitialState()
0 ignored issues
show
Bug introduced by
The variable cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
12
            .then(() => {
13
                cy.loginViaApi();
0 ignored issues
show
Bug introduced by
The variable cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
14
            })
15
            .then(() => {
16
                cy.openInitialPage(`${Cypress.env('admin')}#/sw/settings/search/index`);
0 ignored issues
show
Bug introduced by
The variable cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable Cypress seems to be never declared. If this is a global, consider adding a /** global: Cypress */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
17
            });
18
    });
19
20
    it('@base @settings: create search configuration for search behaviour', () => {
21
        // Request we want to wait for later
22
        cy.server();
0 ignored issues
show
Bug introduced by
The variable cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
23
        cy.route({
24
            url: '/api/v*/product-search-config/*',
25
            method: 'patch'
26
        }).as('saveData');
27
28
        // Make sure that everything need to load first.
29
        cy.wait(3000);
30
31
        // Change value of Minimal search term length
32
        cy.get('.sw-settings-search__search-behaviour-term-length input').clear().type('10');
33
34
        // Check for Or Behaviour option
35
        cy.get('input[type="radio"]#sw-field--searchBehaviourConfigs-andLogic-1').check();
36
37
        cy.get('.sw-settings-search__button-save').click();
38
39
        // Verify save search config method
40
        cy.wait('@saveData').then((xhr) => {
41
            expect(xhr).to.have.property('status', 204);
42
        });
43
    });
44
45
    it('@base @settings: create search configuration for search behaviour bases on another language', () => {
46
        const page = new CategoryPageObject();
47
        // Request we want to wait for later
48
        cy.server();
0 ignored issues
show
Bug introduced by
The variable cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
49
        cy.route({
50
            url: '/api/v*/product-search-config/*',
51
            method: 'patch'
52
        }).as('saveData');
53
54
        // Make sure that everything need to load first.
55
        cy.wait(3000);
56
57
        // Choose German language
58
        page.changeTranslation('Deutsch', 0);
59
60
        // change value of Minimal search term length
61
        cy.get('.sw-settings-search__search-behaviour-term-length input').clear().type('19');
62
63
        // Check for Or Behaviour option
64
        cy.get('input[type="radio"]#sw-field--searchBehaviourConfigs-andLogic-1').check();
65
66
        cy.get('.sw-settings-search__button-save').click();
67
68
        // Verify save search config method
69
        cy.wait('@saveData').then((xhr) => {
70
            expect(xhr).to.have.property('status', 204);
71
        });
72
    });
73
});
74