Lines 2-56
import { mount } from "@cypress/vue";
Link Here
|
2 |
const dayjs = require("dayjs"); /* Cannot use our calendar JS code, it's in an include file (!) |
2 |
const dayjs = require("dayjs"); /* Cannot use our calendar JS code, it's in an include file (!) |
3 |
Also note that moment.js is deprecated */ |
3 |
Also note that moment.js is deprecated */ |
4 |
|
4 |
|
5 |
function get_title() { |
|
|
6 |
return { |
7 |
access_type: "access type", |
8 |
biblio_id: null, |
9 |
coverage_depth: "coverage depth", |
10 |
date_first_issue_online: "date first", |
11 |
date_last_issue_online: "date last", |
12 |
date_monograph_published_online: "date mono online", |
13 |
date_monograph_published_print: "date mono print", |
14 |
embargo_info: "embargo info", |
15 |
external_id: "", |
16 |
first_author: "first author", |
17 |
first_editor: "first editor", |
18 |
monograph_edition: "monograph edition", |
19 |
monograph_volume: "monograph volume", |
20 |
notes: "notes", |
21 |
num_first_issue_online: "num first issue", |
22 |
num_first_vol_online: "num first vol", |
23 |
num_last_issue_online: "num last issue", |
24 |
num_last_vol_online: "num last vol", |
25 |
online_identifier: "online identifier", |
26 |
parent_publication_title_id: "parent id", |
27 |
preceeding_publication_title_id: "preceeding id", |
28 |
print_identifier: "print identifier", |
29 |
publication_title: "publication title", |
30 |
publication_type: "journal", |
31 |
publisher_name: "publication name", |
32 |
resources: [ |
33 |
{ |
34 |
ended_on: null, |
35 |
package: { |
36 |
content_type: "", |
37 |
package_id: 1, |
38 |
name: "first package name" |
39 |
}, |
40 |
package_id: 1, |
41 |
resource_id: 2, |
42 |
title: { |
43 |
biblio_id: 439, |
44 |
title_id: 1, |
45 |
}, |
46 |
title_id: 1 |
47 |
} |
48 |
], |
49 |
title_id: 1, |
50 |
title_url: "title url" |
51 |
}; |
52 |
} |
53 |
|
54 |
function get_packages_to_relate() { |
5 |
function get_packages_to_relate() { |
55 |
return [ |
6 |
return [ |
56 |
{ |
7 |
{ |
Lines 82-88
describe("Title CRUD operations", () => {
Link Here
|
82 |
}); |
33 |
}); |
83 |
|
34 |
|
84 |
it("Import titles", () => { |
35 |
it("Import titles", () => { |
85 |
let erm_title = get_title(); |
36 |
let erm_title = cy.get_title(); |
86 |
let resource = erm_title.resources[0]; |
37 |
let resource = erm_title.resources[0]; |
87 |
|
38 |
|
88 |
// Create a list in case none exists |
39 |
// Create a list in case none exists |
Lines 146-152
describe("Title CRUD operations", () => {
Link Here
|
146 |
cy.get("#titles_list").contains("There are no titles defined"); |
97 |
cy.get("#titles_list").contains("There are no titles defined"); |
147 |
|
98 |
|
148 |
// GET titles returns something |
99 |
// GET titles returns something |
149 |
let erm_title = get_title(); |
100 |
let erm_title = cy.get_title(); |
150 |
let titles = [erm_title]; |
101 |
let titles = [erm_title]; |
151 |
|
102 |
|
152 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/titles*", { |
103 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/titles*", { |
Lines 179-185
describe("Title CRUD operations", () => {
Link Here
|
179 |
cy.get("#titles_add h2").contains("New title"); |
130 |
cy.get("#titles_add h2").contains("New title"); |
180 |
|
131 |
|
181 |
// Fill in the form for normal attributes |
132 |
// Fill in the form for normal attributes |
182 |
let erm_title = get_title(); |
133 |
let erm_title = cy.get_title(); |
183 |
|
134 |
|
184 |
cy.get("#titles_add").contains("Submit").click(); |
135 |
cy.get("#titles_add").contains("Submit").click(); |
185 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
136 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
Lines 252-258
describe("Title CRUD operations", () => {
Link Here
|
252 |
}); |
203 |
}); |
253 |
|
204 |
|
254 |
it("Edit title", () => { |
205 |
it("Edit title", () => { |
255 |
let erm_title = get_title(); |
206 |
let erm_title = cy.get_title(); |
256 |
let titles = [erm_title]; |
207 |
let titles = [erm_title]; |
257 |
// Click the 'Edit' button from the list |
208 |
// Click the 'Edit' button from the list |
258 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/titles*", { |
209 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/titles*", { |
Lines 329-335
describe("Title CRUD operations", () => {
Link Here
|
329 |
}); |
280 |
}); |
330 |
|
281 |
|
331 |
it("Show title", () => { |
282 |
it("Show title", () => { |
332 |
let erm_title = get_title(); |
283 |
let erm_title = cy.get_title(); |
333 |
let titles = [erm_title]; |
284 |
let titles = [erm_title]; |
334 |
// Click the "name" link from the list |
285 |
// Click the "name" link from the list |
335 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/titles*", { |
286 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/titles*", { |
Lines 401-407
describe("Title CRUD operations", () => {
Link Here
|
401 |
}); |
352 |
}); |
402 |
|
353 |
|
403 |
it("Delete title", () => { |
354 |
it("Delete title", () => { |
404 |
let erm_title = get_title(); |
355 |
let erm_title = cy.get_title(); |
405 |
let titles = [erm_title]; |
356 |
let titles = [erm_title]; |
406 |
|
357 |
|
407 |
// Click the 'Delete' button from the list |
358 |
// Click the 'Delete' button from the list |