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