Lines 18-23
function get_license() {
Link Here
|
18 |
started_on: dates["today_iso"], |
18 |
started_on: dates["today_iso"], |
19 |
ended_on: dates["tomorrow_iso"], |
19 |
ended_on: dates["tomorrow_iso"], |
20 |
user_roles: [], |
20 |
user_roles: [], |
|
|
21 |
vendor_id: 1, |
22 |
vendor: [cy.get_vendors_to_relate()[0]], |
21 |
documents: [ |
23 |
documents: [ |
22 |
{ |
24 |
{ |
23 |
license_id: 1, |
25 |
license_id: 1, |
Lines 85-90
describe("License CRUD operations", () => {
Link Here
|
85 |
|
87 |
|
86 |
// Fill in the form for normal attributes |
88 |
// Fill in the form for normal attributes |
87 |
let license = get_license(); |
89 |
let license = get_license(); |
|
|
90 |
let vendors = cy.get_vendors_to_relate(); |
88 |
|
91 |
|
89 |
cy.get("#licenses_add").contains("Submit").click(); |
92 |
cy.get("#licenses_add").contains("Submit").click(); |
90 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
93 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
Lines 101-106
describe("License CRUD operations", () => {
Link Here
|
101 |
force: true, |
104 |
force: true, |
102 |
}); |
105 |
}); |
103 |
|
106 |
|
|
|
107 |
// vendors |
108 |
cy.get("#license_vendor_id .vs__selected").should("not.exist"); //no vendor pre-selected for new license |
109 |
|
110 |
cy.get("#license_vendor_id .vs__search").type( |
111 |
vendors[0].name + "{enter}", |
112 |
{ force: true } |
113 |
); |
114 |
cy.get("#license_vendor_id .vs__selected").contains(vendors[0].name); |
115 |
|
104 |
cy.get("#started_on+input").click(); |
116 |
cy.get("#started_on+input").click(); |
105 |
cy.get(".flatpickr-calendar") |
117 |
cy.get(".flatpickr-calendar") |
106 |
.eq(0) |
118 |
.eq(0) |
Lines 152-157
describe("License CRUD operations", () => {
Link Here
|
152 |
it("Edit license", () => { |
164 |
it("Edit license", () => { |
153 |
let license = get_license(); |
165 |
let license = get_license(); |
154 |
let licenses = [license]; |
166 |
let licenses = [license]; |
|
|
167 |
let vendors = cy.get_vendors_to_relate(); |
168 |
|
169 |
// Intercept vendors request |
170 |
cy.intercept("GET", "/api/v1/acquisitions/vendors?_per_page=-1", { |
171 |
statusCode: 200, |
172 |
body: vendors, |
173 |
}).as("get-vendor-options"); |
174 |
|
155 |
// Click the 'Edit' button from the list |
175 |
// Click the 'Edit' button from the list |
156 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
176 |
cy.intercept("GET", "/api/v1/erm/licenses*", { |
157 |
statusCode: 200, |
177 |
statusCode: 200, |
Lines 172-177
describe("License CRUD operations", () => {
Link Here
|
172 |
|
192 |
|
173 |
// Form has been correctly filled in |
193 |
// Form has been correctly filled in |
174 |
cy.get("#license_name").should("have.value", license.name); |
194 |
cy.get("#license_name").should("have.value", license.name); |
|
|
195 |
|
196 |
cy.get("#license_vendor_id .vs__selected").contains( |
197 |
license.vendor[0].name |
198 |
); |
199 |
|
200 |
cy.get("#license_vendor_id .vs__search").type( |
201 |
vendors[1].name + "{enter}", |
202 |
{ force: true } |
203 |
); |
204 |
|
175 |
cy.get("#license_description").should( |
205 |
cy.get("#license_description").should( |
176 |
"have.value", |
206 |
"have.value", |
177 |
license.description |
207 |
license.description |
178 |
- |
|
|