Passed
Push — master ( 62b83c...ad4843 )
by Christian
43:25 queued 29:41
created

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

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 107
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 78
mnd 0
bc 0
fnc 7
dl 0
loc 107
rs 10
bpm 0
cpm 1
noi 7
c 0
b 0
f 0
1
// / <reference types="Cypress" />
2
3
describe('Tax: Test crud operations', () => {
4
    before(() => {
5
        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...
6
            .then(() => {
7
                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...
8
            })
9
            .then(() => {
10
                return cy.createDefaultFixture('tax');
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...
11
            })
12
            .then(() => {
13
                cy.openInitialPage(`${Cypress.env('admin')}#/sw/settings/tax/index`);
0 ignored issues
show
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...
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
    });
16
    it('@setting: test the default sorting and page', () => {
17
        cy.get('.sw-data-grid__row--3 > .sw-data-grid__cell--name > .sw-data-grid__cell-content > .sw-data-grid__cell-value').contains('Standard rate').click();
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...
18
19
        cy.testListing({
20
            sorting: {
21
                text: 'Country',
22
                propertyName: 'country.name',
23
                sortDirection: 'ASC',
24
                location: 0
25
            },
26
            page: 1,
27
            limit: 25,
28
            changesUrl: false
29
        });
30
    });
31
32
    it('@setting: test the sorting and limit function', () => {
33
        cy.testListing({
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...
34
            sorting: {
35
                text: 'Country',
36
                propertyName: 'country.name',
37
                sortDirection: 'ASC',
38
                location: 0
39
            },
40
            page: 1,
41
            limit: 25,
42
            changesUrl: false
43
        });
44
45
        cy.log('change Sorting direction from ASC to DESC');
46
        cy.get('.sw-data-grid__cell--0 > .sw-data-grid__cell-content').click('right');
47
        cy.get('.sw-data-grid-skeleton').should('not.exist');
48
49
        cy.testListing({
50
            sorting: {
51
                text: 'Country',
52
                propertyName: 'country.name',
53
                sortDirection: 'DESC',
54
                location: 0
55
            },
56
            page: 1,
57
            limit: 25,
58
            changesUrl: false
59
        });
60
61
        cy.log('change items per page to 10');
62
        cy.get('#perPage').select('10');
63
        cy.log('change Sorting direction from DESC to ASC');
64
65
        cy.testListing({
66
            sorting: {
67
                text: 'Country',
68
                propertyName: 'country.name',
69
                sortDirection: 'DESC',
70
                location: 0
71
            },
72
            page: 1,
73
            limit: 10,
74
            changesUrl: false
75
        });
76
77
        cy.log('go to second page');
78
        cy.get(':nth-child(2) > .sw-pagination__list-button').click();
79
        cy.get('.sw-data-grid-skeleton').should('not.exist');
80
81
        cy.testListing({
82
            sorting: {
83
                text: 'Country',
84
                propertyName: 'country.name',
85
                sortDirection: 'DESC',
86
                location: 0
87
            },
88
            page: 2,
89
            limit: 10,
90
            changesUrl: false
91
        });
92
93
        cy.log('change sorting to Rate');
94
        cy.get('.sw-data-grid__cell--2 > .sw-data-grid__cell-content').click('right');
95
        cy.get('.sw-data-grid-skeleton').should('not.exist');
96
97
        cy.testListing({
98
            sorting: {
99
                text: 'Rate',
100
                propertyName: 'taxRate',
101
                sortDirection: 'ASC',
102
                location: 2
103
            },
104
            page: 2,
105
            limit: 10,
106
            changesUrl: false
107
        });
108
    });
109
});
110