Lines 7-28
function get_packages_to_relate() {
Link Here
|
7 |
{ |
7 |
{ |
8 |
package_id: 1, |
8 |
package_id: 1, |
9 |
description: "a package", |
9 |
description: "a package", |
10 |
name: "first package name" |
10 |
name: "first package name", |
11 |
}, |
11 |
}, |
12 |
{ |
12 |
{ |
13 |
package_id: 2, |
13 |
package_id: 2, |
14 |
description: "a second package", |
14 |
description: "a second package", |
15 |
name: "second package name" |
15 |
name: "second package name", |
16 |
} |
16 |
}, |
17 |
] |
17 |
]; |
18 |
} |
18 |
} |
19 |
|
19 |
|
20 |
describe("Title CRUD operations", () => { |
20 |
describe("Title CRUD operations", () => { |
21 |
beforeEach(() => { |
21 |
beforeEach(() => { |
22 |
cy.login(); |
22 |
cy.login(); |
23 |
cy.title().should("eq", "Koha staff interface"); |
23 |
cy.title().should("eq", "Koha staff interface"); |
24 |
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}'); |
24 |
cy.intercept( |
25 |
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}'); |
25 |
"GET", |
|
|
26 |
"/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", |
27 |
'{"value":"1"}' |
28 |
); |
29 |
cy.intercept( |
30 |
"GET", |
31 |
"/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", |
32 |
'{"value":"local"}' |
33 |
); |
26 |
}); |
34 |
}); |
27 |
|
35 |
|
28 |
it("Import titles", () => { |
36 |
it("Import titles", () => { |
Lines 32-50
describe("Title CRUD operations", () => {
Link Here
|
32 |
// Create a list in case none exists |
40 |
// Create a list in case none exists |
33 |
cy.visit("/cgi-bin/koha/virtualshelves/shelves.pl"); |
41 |
cy.visit("/cgi-bin/koha/virtualshelves/shelves.pl"); |
34 |
cy.contains("New list").click(); |
42 |
cy.contains("New list").click(); |
35 |
cy.get("#shelfname").type('list name'); |
43 |
cy.get("#shelfname").type("list name"); |
36 |
cy.contains("Save").click(); |
44 |
cy.contains("Save").click(); |
37 |
|
45 |
|
38 |
// First attempt to import list has no packages |
46 |
// First attempt to import list has no packages |
39 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
47 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
40 |
statusCode: 200, |
48 |
statusCode: 200, |
41 |
body: [] |
49 |
body: [], |
42 |
}).as("get-empty-packages"); |
50 |
}).as("get-empty-packages"); |
43 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
51 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
44 |
cy.wait(500); |
52 |
cy.wait(500); |
45 |
cy.get("#toolbar a").contains("Import from list").click(); |
53 |
cy.get("#toolbar a").contains("Import from list").click(); |
46 |
cy.get("h2").contains("Import from a list"); |
54 |
cy.get("h2").contains("Import from a list"); |
47 |
cy.get("#package_list .vs__selected").should('not.exist'); |
55 |
cy.get("#package_list .vs__selected").should("not.exist"); |
48 |
|
56 |
|
49 |
// Make sure packages are returned |
57 |
// Make sure packages are returned |
50 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
58 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
Lines 59-68
describe("Title CRUD operations", () => {
Link Here
|
59 |
// Prepare background job response to the POST |
67 |
// Prepare background job response to the POST |
60 |
cy.intercept("POST", "/api/v1/erm/eholdings/local/titles/import", { |
68 |
cy.intercept("POST", "/api/v1/erm/eholdings/local/titles/import", { |
61 |
statusCode: 200, |
69 |
statusCode: 200, |
62 |
body: {job_id: 1}, |
70 |
body: { job_id: 1 }, |
63 |
}).as("get-job-response"); |
71 |
}).as("get-job-response"); |
64 |
cy.get("#list_list tbody tr:first td a").contains("Import").click(); |
72 |
cy.get("#list_list tbody tr:first td a").contains("Import").click(); |
65 |
cy.get("main div[class='dialog message']").contains("Import in progress, see job #1"); |
73 |
cy.get("main div[class='dialog message']").contains( |
|
|
74 |
"Import in progress, see job #1" |
75 |
); |
66 |
}); |
76 |
}); |
67 |
|
77 |
|
68 |
it("List title", () => { |
78 |
it("List title", () => { |
Lines 106-120
describe("Title CRUD operations", () => {
Link Here
|
106 |
}); |
116 |
}); |
107 |
|
117 |
|
108 |
it("Add title", () => { |
118 |
it("Add title", () => { |
109 |
|
119 |
cy.intercept( |
110 |
cy.intercept({ |
120 |
{ |
111 |
method: "GET", |
121 |
method: "GET", |
112 |
url: "/api/v1/erm/eholdings/local/packages*", |
122 |
url: "/api/v1/erm/eholdings/local/packages*", |
113 |
times: 1 |
123 |
times: 1, |
114 |
}, |
124 |
}, |
115 |
{ |
125 |
{ |
116 |
body: [], |
126 |
body: [], |
117 |
}); |
127 |
} |
|
|
128 |
); |
118 |
|
129 |
|
119 |
// Click the button in the toolbar |
130 |
// Click the button in the toolbar |
120 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
131 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
Lines 133-144
describe("Title CRUD operations", () => {
Link Here
|
133 |
cy.get("#title_publication_title").type(erm_title.publication_title); |
144 |
cy.get("#title_publication_title").type(erm_title.publication_title); |
134 |
cy.get("#title_print_identifier").type(erm_title.print_identifier); |
145 |
cy.get("#title_print_identifier").type(erm_title.print_identifier); |
135 |
cy.get("#title_online_identifier").type(erm_title.online_identifier); |
146 |
cy.get("#title_online_identifier").type(erm_title.online_identifier); |
136 |
cy.get("#title_date_first_issue_online").type(erm_title.date_first_issue_online); |
147 |
cy.get("#title_date_first_issue_online").type( |
137 |
cy.get("#title_num_first_vol_online").type(erm_title.num_first_vol_online); |
148 |
erm_title.date_first_issue_online |
138 |
cy.get("#title_num_first_issue_online").type(erm_title.num_first_issue_online); |
149 |
); |
139 |
cy.get("#title_date_last_issue_online").type(erm_title.date_last_issue_online); |
150 |
cy.get("#title_num_first_vol_online").type( |
140 |
cy.get("#title_num_last_vol_online").type(erm_title.num_last_vol_online); |
151 |
erm_title.num_first_vol_online |
141 |
cy.get("#title_num_last_issue_online").type(erm_title.num_last_issue_online); |
152 |
); |
|
|
153 |
cy.get("#title_num_first_issue_online").type( |
154 |
erm_title.num_first_issue_online |
155 |
); |
156 |
cy.get("#title_date_last_issue_online").type( |
157 |
erm_title.date_last_issue_online |
158 |
); |
159 |
cy.get("#title_num_last_vol_online").type( |
160 |
erm_title.num_last_vol_online |
161 |
); |
162 |
cy.get("#title_num_last_issue_online").type( |
163 |
erm_title.num_last_issue_online |
164 |
); |
142 |
cy.get("#title_title_url").type(erm_title.title_url); |
165 |
cy.get("#title_title_url").type(erm_title.title_url); |
143 |
cy.get("#title_first_author").type(erm_title.first_author); |
166 |
cy.get("#title_first_author").type(erm_title.first_author); |
144 |
cy.get("#title_embargo_info").type(erm_title.embargo_info); |
167 |
cy.get("#title_embargo_info").type(erm_title.embargo_info); |
Lines 149-166
describe("Title CRUD operations", () => {
Link Here
|
149 |
erm_title.publication_type + "{enter}", |
172 |
erm_title.publication_type + "{enter}", |
150 |
{ force: true } |
173 |
{ force: true } |
151 |
); |
174 |
); |
152 |
cy.get("#title_date_monograph_published_print").type(erm_title.date_monograph_published_print); |
175 |
cy.get("#title_date_monograph_published_print").type( |
153 |
cy.get("#title_date_monograph_published_online").type(erm_title.date_monograph_published_online); |
176 |
erm_title.date_monograph_published_print |
|
|
177 |
); |
178 |
cy.get("#title_date_monograph_published_online").type( |
179 |
erm_title.date_monograph_published_online |
180 |
); |
154 |
cy.get("#title_monograph_volume").type(erm_title.monograph_volume); |
181 |
cy.get("#title_monograph_volume").type(erm_title.monograph_volume); |
155 |
cy.get("#title_monograph_edition").type(erm_title.monograph_edition); |
182 |
cy.get("#title_monograph_edition").type(erm_title.monograph_edition); |
156 |
cy.get("#title_first_editor").type(erm_title.first_editor); |
183 |
cy.get("#title_first_editor").type(erm_title.first_editor); |
157 |
cy.get("#title_parent_publication_title_id").type(erm_title.parent_publication_title_id); |
184 |
cy.get("#title_parent_publication_title_id").type( |
158 |
cy.get("#title_preceeding_publication_title_id").type(erm_title.preceeding_publication_title_id); |
185 |
erm_title.parent_publication_title_id |
|
|
186 |
); |
187 |
cy.get("#title_preceeding_publication_title_id").type( |
188 |
erm_title.preceeding_publication_title_id |
189 |
); |
159 |
cy.get("#title_access_type").type(erm_title.access_type); |
190 |
cy.get("#title_access_type").type(erm_title.access_type); |
160 |
|
191 |
|
161 |
cy.get("#resources").contains( |
192 |
cy.get("#resources").contains("There are no packages created yet"); |
162 |
"There are no packages created yet" |
|
|
163 |
); |
164 |
|
193 |
|
165 |
// Submit the form, get 500 |
194 |
// Submit the form, get 500 |
166 |
cy.intercept("POST", "/api/v1/erm/eholdings/local/titles", { |
195 |
cy.intercept("POST", "/api/v1/erm/eholdings/local/titles", { |
Lines 185-198
describe("Title CRUD operations", () => {
Link Here
|
185 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
214 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
186 |
statusCode: 200, |
215 |
statusCode: 200, |
187 |
body: get_packages_to_relate(), |
216 |
body: get_packages_to_relate(), |
188 |
}).as('get-related-packages'); |
217 |
}).as("get-related-packages"); |
189 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles/add"); |
218 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles/add"); |
190 |
cy.get("#resources").contains("Add to another package").click(); |
219 |
cy.get("#resources").contains("Add to another package").click(); |
191 |
cy.get("#resources").contains("Package 1"); |
220 |
cy.get("#resources").contains("Package 1"); |
192 |
cy.get("#resources #resource_package_id_0 .vs__search").type( |
221 |
cy.get("#resources #resource_package_id_0 .vs__search").type( |
193 |
related_package.package.name |
222 |
related_package.package.name |
194 |
); |
223 |
); |
195 |
cy.get("#resources #resource_package_id_0 .vs__dropdown-menu li").eq(0).click( { force: true } ); //click first package suggestion |
224 |
cy.get("#resources #resource_package_id_0 .vs__dropdown-menu li") |
|
|
225 |
.eq(0) |
226 |
.click({ force: true }); //click first package suggestion |
196 |
}); |
227 |
}); |
197 |
|
228 |
|
198 |
it("Edit title", () => { |
229 |
it("Edit title", () => { |
Lines 217-223
describe("Title CRUD operations", () => {
Link Here
|
217 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
248 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
218 |
statusCode: 200, |
249 |
statusCode: 200, |
219 |
body: get_packages_to_relate(), |
250 |
body: get_packages_to_relate(), |
220 |
}).as('get-related-packages'); |
251 |
}).as("get-related-packages"); |
221 |
|
252 |
|
222 |
cy.get("#titles_list table tbody tr:first").contains("Edit").click(); |
253 |
cy.get("#titles_list table tbody tr:first").contains("Edit").click(); |
223 |
cy.wait("@get-title"); |
254 |
cy.wait("@get-title"); |
Lines 225-257
describe("Title CRUD operations", () => {
Link Here
|
225 |
cy.get("#titles_add h2").contains("Edit title"); |
256 |
cy.get("#titles_add h2").contains("Edit title"); |
226 |
|
257 |
|
227 |
// Form has been correctly filled in |
258 |
// Form has been correctly filled in |
228 |
cy.get("#title_publication_title").should("have.value", erm_title.publication_title); |
259 |
cy.get("#title_publication_title").should( |
229 |
cy.get("#title_print_identifier").should("have.value", erm_title.print_identifier); |
260 |
"have.value", |
230 |
cy.get("#title_online_identifier").should("have.value", erm_title.online_identifier); |
261 |
erm_title.publication_title |
231 |
cy.get("#title_date_first_issue_online").should("have.value", erm_title.date_first_issue_online); |
262 |
); |
232 |
cy.get("#title_num_first_vol_online").should("have.value", erm_title.num_first_vol_online); |
263 |
cy.get("#title_print_identifier").should( |
233 |
cy.get("#title_num_first_issue_online").should("have.value", erm_title.num_first_issue_online); |
264 |
"have.value", |
234 |
cy.get("#title_date_last_issue_online").should("have.value", erm_title.date_last_issue_online); |
265 |
erm_title.print_identifier |
235 |
cy.get("#title_num_last_vol_online").should("have.value", erm_title.num_last_vol_online); |
266 |
); |
236 |
cy.get("#title_num_last_issue_online").should("have.value", erm_title.num_last_issue_online); |
267 |
cy.get("#title_online_identifier").should( |
|
|
268 |
"have.value", |
269 |
erm_title.online_identifier |
270 |
); |
271 |
cy.get("#title_date_first_issue_online").should( |
272 |
"have.value", |
273 |
erm_title.date_first_issue_online |
274 |
); |
275 |
cy.get("#title_num_first_vol_online").should( |
276 |
"have.value", |
277 |
erm_title.num_first_vol_online |
278 |
); |
279 |
cy.get("#title_num_first_issue_online").should( |
280 |
"have.value", |
281 |
erm_title.num_first_issue_online |
282 |
); |
283 |
cy.get("#title_date_last_issue_online").should( |
284 |
"have.value", |
285 |
erm_title.date_last_issue_online |
286 |
); |
287 |
cy.get("#title_num_last_vol_online").should( |
288 |
"have.value", |
289 |
erm_title.num_last_vol_online |
290 |
); |
291 |
cy.get("#title_num_last_issue_online").should( |
292 |
"have.value", |
293 |
erm_title.num_last_issue_online |
294 |
); |
237 |
cy.get("#title_title_url").should("have.value", erm_title.title_url); |
295 |
cy.get("#title_title_url").should("have.value", erm_title.title_url); |
238 |
cy.get("#title_first_author").should("have.value", erm_title.first_author); |
296 |
cy.get("#title_first_author").should( |
239 |
cy.get("#title_embargo_info").should("have.value", erm_title.embargo_info); |
297 |
"have.value", |
240 |
cy.get("#title_coverage_depth").should("have.value", erm_title.coverage_depth); |
298 |
erm_title.first_author |
|
|
299 |
); |
300 |
cy.get("#title_embargo_info").should( |
301 |
"have.value", |
302 |
erm_title.embargo_info |
303 |
); |
304 |
cy.get("#title_coverage_depth").should( |
305 |
"have.value", |
306 |
erm_title.coverage_depth |
307 |
); |
241 |
cy.get("#title_notes").should("have.value", erm_title.notes); |
308 |
cy.get("#title_notes").should("have.value", erm_title.notes); |
242 |
cy.get("#title_publisher_name").should("have.value", erm_title.publisher_name); |
309 |
cy.get("#title_publisher_name").should( |
243 |
cy.get("#title_publication_type .vs__selected").contains('Journal'); |
310 |
"have.value", |
244 |
cy.get("#title_date_monograph_published_print").should("have.value", erm_title.date_monograph_published_print); |
311 |
erm_title.publisher_name |
245 |
cy.get("#title_date_monograph_published_online").should("have.value", erm_title.date_monograph_published_online); |
312 |
); |
246 |
cy.get("#title_monograph_volume").should("have.value", erm_title.monograph_volume); |
313 |
cy.get("#title_publication_type .vs__selected").contains("Journal"); |
247 |
cy.get("#title_monograph_edition").should("have.value", erm_title.monograph_edition); |
314 |
cy.get("#title_date_monograph_published_print").should( |
248 |
cy.get("#title_first_editor").should("have.value", erm_title.first_editor); |
315 |
"have.value", |
249 |
cy.get("#title_parent_publication_title_id").should("have.value", erm_title.parent_publication_title_id); |
316 |
erm_title.date_monograph_published_print |
250 |
cy.get("#title_preceeding_publication_title_id").should("have.value", erm_title.preceeding_publication_title_id); |
317 |
); |
251 |
cy.get("#title_access_type").should("have.value", erm_title.access_type); |
318 |
cy.get("#title_date_monograph_published_online").should( |
|
|
319 |
"have.value", |
320 |
erm_title.date_monograph_published_online |
321 |
); |
322 |
cy.get("#title_monograph_volume").should( |
323 |
"have.value", |
324 |
erm_title.monograph_volume |
325 |
); |
326 |
cy.get("#title_monograph_edition").should( |
327 |
"have.value", |
328 |
erm_title.monograph_edition |
329 |
); |
330 |
cy.get("#title_first_editor").should( |
331 |
"have.value", |
332 |
erm_title.first_editor |
333 |
); |
334 |
cy.get("#title_parent_publication_title_id").should( |
335 |
"have.value", |
336 |
erm_title.parent_publication_title_id |
337 |
); |
338 |
cy.get("#title_preceeding_publication_title_id").should( |
339 |
"have.value", |
340 |
erm_title.preceeding_publication_title_id |
341 |
); |
342 |
cy.get("#title_access_type").should( |
343 |
"have.value", |
344 |
erm_title.access_type |
345 |
); |
252 |
|
346 |
|
253 |
//Test related content |
347 |
//Test related content |
254 |
cy.get("#resources #resource_package_id_0 .vs__selected").contains("package name"); |
348 |
cy.get("#resources #resource_package_id_0 .vs__selected").contains( |
|
|
349 |
"package name" |
350 |
); |
255 |
|
351 |
|
256 |
// Submit the form, get 500 |
352 |
// Submit the form, get 500 |
257 |
cy.intercept("PUT", "/api/v1/erm/eholdings/local/titles/*", { |
353 |
cy.intercept("PUT", "/api/v1/erm/eholdings/local/titles/*", { |
Lines 289-315
describe("Title CRUD operations", () => {
Link Here
|
289 |
{ |
385 |
{ |
290 |
method: "GET", |
386 |
method: "GET", |
291 |
url: "/api/v1/erm/eholdings/local/titles/*", |
387 |
url: "/api/v1/erm/eholdings/local/titles/*", |
292 |
times: 1 |
388 |
times: 1, |
293 |
}, |
389 |
}, |
294 |
{ |
390 |
{ |
295 |
body: { |
391 |
body: { |
296 |
publication_title: "publication title", |
392 |
publication_title: "publication title", |
297 |
resources: [], |
393 |
resources: [], |
298 |
title_id: 1, |
394 |
title_id: 1, |
299 |
} |
395 |
}, |
300 |
} |
396 |
} |
301 |
).as("get-title"); |
397 |
).as("get-title"); |
302 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
398 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
303 |
let title_link = cy.get( |
399 |
let title_link = cy.get("#titles_list table tbody tr:first td:first a"); |
304 |
"#titles_list table tbody tr:first td:first a" |
|
|
305 |
); |
306 |
title_link.should( |
400 |
title_link.should( |
307 |
"have.text", |
401 |
"have.text", |
308 |
erm_title.publication_title + " (#" + erm_title.title_id + ")" |
402 |
erm_title.publication_title + " (#" + erm_title.title_id + ")" |
309 |
); |
403 |
); |
310 |
cy.get( |
404 |
cy.get("#titles_list table tbody tr:first td:first a").click(); |
311 |
"#titles_list table tbody tr:first td:first a" |
|
|
312 |
).click(); |
313 |
cy.wait("@get-title"); |
405 |
cy.wait("@get-title"); |
314 |
cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! |
406 |
cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! |
315 |
cy.get("#eholdings_title_show h2").contains( |
407 |
cy.get("#eholdings_title_show h2").contains( |
Lines 336-346
describe("Title CRUD operations", () => {
Link Here
|
336 |
// cy.get("#package_list tbody tr:first td a").contains("first package name").click(); |
428 |
// cy.get("#package_list tbody tr:first td a").contains("first package name").click(); |
337 |
cy.intercept( |
429 |
cy.intercept( |
338 |
"GET", |
430 |
"GET", |
339 |
"/api/v1/erm/eholdings/local/resources/"+related_package.resource_id, |
431 |
"/api/v1/erm/eholdings/local/resources/" + |
|
|
432 |
related_package.resource_id, |
340 |
related_package |
433 |
related_package |
341 |
).as("get-related-package"); |
434 |
).as("get-related-package"); |
342 |
cy.get("table#package_list").contains("first package name").click(); |
435 |
cy.get("table#package_list").contains("first package name").click(); |
343 |
cy.contains("Resource #"+related_package.resource_id); |
436 |
cy.contains("Resource #" + related_package.resource_id); |
344 |
cy.contains(related_package.package.name); |
437 |
cy.contains(related_package.package.name); |
345 |
}); |
438 |
}); |
346 |
|
439 |
|
Lines 357-372
describe("Title CRUD operations", () => {
Link Here
|
357 |
"X-Total-Count": "1", |
450 |
"X-Total-Count": "1", |
358 |
}, |
451 |
}, |
359 |
}); |
452 |
}); |
360 |
cy.intercept( |
453 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/titles/*", erm_title); |
361 |
"GET", |
|
|
362 |
"/api/v1/erm/eholdings/local/titles/*", |
363 |
erm_title |
364 |
); |
365 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
454 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
366 |
|
455 |
|
367 |
cy.get("#titles_list table tbody tr:first") |
456 |
cy.get("#titles_list table tbody tr:first").contains("Delete").click(); |
368 |
.contains("Delete") |
|
|
369 |
.click(); |
370 |
cy.get(".dialog.alert.confirmation h1").contains("remove this title"); |
457 |
cy.get(".dialog.alert.confirmation h1").contains("remove this title"); |
371 |
cy.contains(erm_title.publication_title); |
458 |
cy.contains(erm_title.publication_title); |
372 |
|
459 |
|
Lines 385-396
describe("Title CRUD operations", () => {
Link Here
|
385 |
statusCode: 204, |
472 |
statusCode: 204, |
386 |
body: null, |
473 |
body: null, |
387 |
}); |
474 |
}); |
388 |
cy.get("#titles_list table tbody tr:first") |
475 |
cy.get("#titles_list table tbody tr:first").contains("Delete").click(); |
389 |
.contains("Delete") |
|
|
390 |
.click(); |
391 |
cy.get(".dialog.alert.confirmation h1").contains("remove this title"); |
476 |
cy.get(".dialog.alert.confirmation h1").contains("remove this title"); |
392 |
cy.contains("Yes, delete").click(); |
477 |
cy.contains("Yes, delete").click(); |
393 |
cy.get("main div[class='dialog message']").contains("Local title").contains("deleted"); |
478 |
cy.get("main div[class='dialog message']") |
|
|
479 |
.contains("Local title") |
480 |
.contains("deleted"); |
394 |
|
481 |
|
395 |
// Delete from show |
482 |
// Delete from show |
396 |
// Click the "name" link from the list |
483 |
// Click the "name" link from the list |
Lines 407-444
describe("Title CRUD operations", () => {
Link Here
|
407 |
{ |
494 |
{ |
408 |
method: "GET", |
495 |
method: "GET", |
409 |
url: "/api/v1/erm/eholdings/local/titles/*", |
496 |
url: "/api/v1/erm/eholdings/local/titles/*", |
410 |
times: 1 |
497 |
times: 1, |
411 |
}, |
498 |
}, |
412 |
{ |
499 |
{ |
413 |
body: { |
500 |
body: { |
414 |
publication_title: "publication title", |
501 |
publication_title: "publication title", |
415 |
resources: [], |
502 |
resources: [], |
416 |
title_id: 1, |
503 |
title_id: 1, |
417 |
} |
504 |
}, |
418 |
} |
505 |
} |
419 |
).as("get-title"); |
506 |
).as("get-title"); |
420 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
507 |
cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); |
421 |
let title_link = cy.get( |
508 |
let title_link = cy.get("#titles_list table tbody tr:first td:first a"); |
422 |
"#titles_list table tbody tr:first td:first a" |
|
|
423 |
); |
424 |
title_link.should( |
509 |
title_link.should( |
425 |
"have.text", |
510 |
"have.text", |
426 |
erm_title.publication_title + " (#" + erm_title.title_id + ")" |
511 |
erm_title.publication_title + " (#" + erm_title.title_id + ")" |
427 |
); |
512 |
); |
428 |
cy.get( |
513 |
cy.get("#titles_list table tbody tr:first td:first a").click(); |
429 |
"#titles_list table tbody tr:first td:first a" |
|
|
430 |
).click(); |
431 |
cy.wait("@get-title"); |
514 |
cy.wait("@get-title"); |
432 |
cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! |
515 |
cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! |
433 |
cy.get("#eholdings_title_show h2").contains( |
516 |
cy.get("#eholdings_title_show h2").contains( |
434 |
"Title #" + erm_title.title_id |
517 |
"Title #" + erm_title.title_id |
435 |
); |
518 |
); |
436 |
|
519 |
|
437 |
cy.get('#eholdings_title_show .action_links .fa-trash').click(); |
520 |
cy.get("#eholdings_title_show .action_links .fa-trash").click(); |
438 |
cy.get(".dialog.alert.confirmation h1").contains("remove this title"); |
521 |
cy.get(".dialog.alert.confirmation h1").contains("remove this title"); |
439 |
cy.contains("Yes, delete").click(); |
522 |
cy.contains("Yes, delete").click(); |
440 |
|
523 |
|
441 |
//Make sure we return to list after deleting from show |
524 |
//Make sure we return to list after deleting from show |
442 |
cy.get("#titles_list table tbody tr:first") |
525 |
cy.get("#titles_list table tbody tr:first"); |
443 |
}); |
526 |
}); |
444 |
}); |
527 |
}); |
445 |
- |
|
|