1
|
|
|
// / <reference types="Cypress" /> |
2
|
|
|
|
3
|
|
|
describe('Tax: Test crud operations', () => { |
4
|
|
|
before(() => { |
5
|
|
|
cy.setToInitialState() |
|
|
|
|
6
|
|
|
.then(() => { |
7
|
|
|
cy.loginViaApi(); |
|
|
|
|
8
|
|
|
}) |
9
|
|
|
.then(() => { |
10
|
|
|
return cy.createDefaultFixture('tax'); |
|
|
|
|
11
|
|
|
}) |
12
|
|
|
.then(() => { |
13
|
|
|
cy.openInitialPage(`${Cypress.env('admin')}#/sw/settings/tax/index`); |
|
|
|
|
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(); |
|
|
|
|
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({ |
|
|
|
|
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
|
|
|
|
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.