Lines 2-28
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_package() { |
|
|
6 |
return { |
7 |
package_id: 1, |
8 |
name: "package 1", |
9 |
package_type: "complete", |
10 |
content_type: "Print", |
11 |
package_agreements: [ |
12 |
{ |
13 |
agreement: { |
14 |
agreement_id: 2, |
15 |
description: "agreement description", |
16 |
name: "agreement name", |
17 |
}, |
18 |
agreement_id: 2, |
19 |
package_id: 1, |
20 |
}, |
21 |
], |
22 |
resources_count: 0, |
23 |
}; |
24 |
} |
25 |
|
26 |
describe("Package CRUD operations", () => { |
5 |
describe("Package CRUD operations", () => { |
27 |
beforeEach(() => { |
6 |
beforeEach(() => { |
28 |
cy.login(); |
7 |
cy.login(); |
Lines 58-64
describe("Package CRUD operations", () => {
Link Here
|
58 |
cy.get("#packages_list").contains("There are no packages defined"); |
37 |
cy.get("#packages_list").contains("There are no packages defined"); |
59 |
|
38 |
|
60 |
// GET packages returns something |
39 |
// GET packages returns something |
61 |
let erm_package = get_package(); |
40 |
let erm_package = cy.get_package(); |
62 |
let packages = [erm_package]; |
41 |
let packages = [erm_package]; |
63 |
|
42 |
|
64 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
43 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
Lines 88-94
describe("Package CRUD operations", () => {
Link Here
|
88 |
cy.left_menu_active_item_is("Packages"); |
67 |
cy.left_menu_active_item_is("Packages"); |
89 |
|
68 |
|
90 |
// Fill in the form for normal attributes |
69 |
// Fill in the form for normal attributes |
91 |
let erm_package = get_package(); |
70 |
let erm_package = cy.get_package(); |
92 |
|
71 |
|
93 |
cy.get("#packages_add").contains("Submit").click(); |
72 |
cy.get("#packages_add").contains("Submit").click(); |
94 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
73 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
Lines 146-152
describe("Package CRUD operations", () => {
Link Here
|
146 |
}); |
125 |
}); |
147 |
|
126 |
|
148 |
it("Edit package", () => { |
127 |
it("Edit package", () => { |
149 |
let erm_package = get_package(); |
128 |
let erm_package = cy.get_package(); |
150 |
let packages = [erm_package]; |
129 |
let packages = [erm_package]; |
151 |
// Click the 'Edit' button from the list |
130 |
// Click the 'Edit' button from the list |
152 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
131 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
Lines 205-211
describe("Package CRUD operations", () => {
Link Here
|
205 |
}); |
184 |
}); |
206 |
|
185 |
|
207 |
it("Show package", () => { |
186 |
it("Show package", () => { |
208 |
let erm_package = get_package(); |
187 |
let erm_package = cy.get_package(); |
209 |
let packages = [erm_package]; |
188 |
let packages = [erm_package]; |
210 |
// Click the "name" link from the list |
189 |
// Click the "name" link from the list |
211 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
190 |
cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { |
Lines 277-283
describe("Package CRUD operations", () => {
Link Here
|
277 |
}); |
256 |
}); |
278 |
|
257 |
|
279 |
it("Delete package", () => { |
258 |
it("Delete package", () => { |
280 |
let erm_package = get_package(); |
259 |
let erm_package = cy.get_package(); |
281 |
let packages = [erm_package]; |
260 |
let packages = [erm_package]; |
282 |
|
261 |
|
283 |
// Click the 'Delete' button from the list |
262 |
// Click the 'Delete' button from the list |