Lines 1-5
Link Here
|
1 |
import { mount } from "@cypress/vue"; |
1 |
import { mount } from "@cypress/vue"; |
2 |
|
2 |
|
|
|
3 |
const RESTdefaultPageSize = "20"; // FIXME Mock this |
4 |
const baseTotalCount = "42"; |
5 |
|
6 |
function build_libraries() { |
7 |
return cy |
8 |
.task("buildSampleObjects", { |
9 |
object: "library", |
10 |
count: RESTdefaultPageSize, |
11 |
values: { library_hours: [] }, |
12 |
}) |
13 |
.then(libraries => { |
14 |
cy.intercept("GET", "/api/v1/libraries*", { |
15 |
statusCode: 200, |
16 |
body: libraries, |
17 |
headers: { |
18 |
"X-Base-Total-Count": baseTotalCount, |
19 |
"X-Total-Count": baseTotalCount, |
20 |
}, |
21 |
}); |
22 |
}); |
23 |
} |
3 |
describe("kohaTable (using REST API)", () => { |
24 |
describe("kohaTable (using REST API)", () => { |
4 |
beforeEach(() => { |
25 |
beforeEach(() => { |
5 |
cy.login(); |
26 |
cy.login(); |
Lines 11-37
describe("kohaTable (using REST API)", () => {
Link Here
|
11 |
|
32 |
|
12 |
afterEach(() => {}); |
33 |
afterEach(() => {}); |
13 |
|
34 |
|
14 |
const RESTdefaultPageSize = "20"; // FIXME Mock this |
|
|
15 |
const baseTotalCount = "42"; |
16 |
|
17 |
describe("Simple tables", () => { |
35 |
describe("Simple tables", () => { |
18 |
const table_id = "libraries"; |
36 |
const table_id = "libraries"; |
19 |
|
37 |
|
20 |
it("Input search bar and clear filter ", () => { |
38 |
it("Input search bar and clear filter ", () => { |
21 |
cy.task("buildSampleObjects", { |
39 |
build_libraries().then(() => { |
22 |
object: "library", |
|
|
23 |
count: RESTdefaultPageSize, |
24 |
values: { library_hours: [] }, |
25 |
}).then(libraries => { |
26 |
cy.intercept("GET", "/api/v1/libraries*", { |
27 |
statusCode: 200, |
28 |
body: libraries, |
29 |
headers: { |
30 |
"X-Base-Total-Count": baseTotalCount, |
31 |
"X-Total-Count": baseTotalCount, |
32 |
}, |
33 |
}); |
34 |
|
35 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
40 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
36 |
|
41 |
|
37 |
cy.get(`#${table_id}_wrapper .dt-info`).contains( |
42 |
cy.get(`#${table_id}_wrapper .dt-info`).contains( |
Lines 69-88
describe("kohaTable (using REST API)", () => {
Link Here
|
69 |
}); |
74 |
}); |
70 |
|
75 |
|
71 |
it("All columns displayed", () => { |
76 |
it("All columns displayed", () => { |
72 |
cy.task("buildSampleObjects", { |
77 |
build_libraries().then(() => { |
73 |
object: "library", |
|
|
74 |
count: RESTdefaultPageSize, |
75 |
values: { library_hours: [] }, |
76 |
}).then(libraries => { |
77 |
cy.intercept("GET", "/api/v1/libraries*", { |
78 |
statusCode: 200, |
79 |
body: libraries, |
80 |
headers: { |
81 |
"X-Base-Total-Count": baseTotalCount, |
82 |
"X-Total-Count": baseTotalCount, |
83 |
}, |
84 |
}); |
85 |
|
86 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
78 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
87 |
|
79 |
|
88 |
cy.window().then(win => { |
80 |
cy.window().then(win => { |
Lines 98-117
describe("kohaTable (using REST API)", () => {
Link Here
|
98 |
}); |
90 |
}); |
99 |
|
91 |
|
100 |
it("One column hidden by default", () => { |
92 |
it("One column hidden by default", () => { |
101 |
cy.task("buildSampleObjects", { |
93 |
build_libraries().then(() => { |
102 |
object: "library", |
|
|
103 |
count: RESTdefaultPageSize, |
104 |
values: { library_hours: [] }, |
105 |
}).then(libraries => { |
106 |
cy.intercept("GET", "/api/v1/libraries*", { |
107 |
statusCode: 200, |
108 |
body: libraries, |
109 |
headers: { |
110 |
"X-Base-Total-Count": baseTotalCount, |
111 |
"X-Total-Count": baseTotalCount, |
112 |
}, |
113 |
}); |
114 |
|
115 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
94 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
116 |
|
95 |
|
117 |
cy.window().then(win => { |
96 |
cy.window().then(win => { |
Lines 134-153
describe("kohaTable (using REST API)", () => {
Link Here
|
134 |
}); |
113 |
}); |
135 |
|
114 |
|
136 |
it("One column hidden by default then shown by user - Save state OFF", () => { |
115 |
it("One column hidden by default then shown by user - Save state OFF", () => { |
137 |
cy.task("buildSampleObjects", { |
116 |
build_libraries().then(() => { |
138 |
object: "library", |
|
|
139 |
count: RESTdefaultPageSize, |
140 |
values: { library_hours: [] }, |
141 |
}).then(libraries => { |
142 |
cy.intercept("GET", "/api/v1/libraries*", { |
143 |
statusCode: 200, |
144 |
body: libraries, |
145 |
headers: { |
146 |
"X-Base-Total-Count": baseTotalCount, |
147 |
"X-Total-Count": baseTotalCount, |
148 |
}, |
149 |
}); |
150 |
|
151 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
117 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
152 |
|
118 |
|
153 |
cy.window().then(win => { |
119 |
cy.window().then(win => { |
Lines 201-220
describe("kohaTable (using REST API)", () => {
Link Here
|
201 |
}); |
167 |
}); |
202 |
|
168 |
|
203 |
it("One column hidden by default then shown by user - Save state is ON", () => { |
169 |
it("One column hidden by default then shown by user - Save state is ON", () => { |
204 |
cy.task("buildSampleObjects", { |
170 |
build_libraries().then(() => { |
205 |
object: "library", |
|
|
206 |
count: RESTdefaultPageSize, |
207 |
values: { library_hours: [] }, |
208 |
}).then(libraries => { |
209 |
cy.intercept("GET", "/api/v1/libraries*", { |
210 |
statusCode: 200, |
211 |
body: libraries, |
212 |
headers: { |
213 |
"X-Base-Total-Count": baseTotalCount, |
214 |
"X-Total-Count": baseTotalCount, |
215 |
}, |
216 |
}); |
217 |
|
218 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
171 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
219 |
|
172 |
|
220 |
cy.window().then(win => { |
173 |
cy.window().then(win => { |
221 |
- |
|
|