Lines 18-24
function get_agreement() {
Link Here
|
18 |
name: "agreement 1", |
18 |
name: "agreement 1", |
19 |
renewal_priority: "", |
19 |
renewal_priority: "", |
20 |
status: "active", |
20 |
status: "active", |
21 |
vendor_id: null, |
21 |
vendor_id: 1, |
|
|
22 |
vendor: [cy.get_vendors_to_relate()[0]], |
22 |
periods: [ |
23 |
periods: [ |
23 |
{ |
24 |
{ |
24 |
started_on: dates["today_iso"], |
25 |
started_on: dates["today_iso"], |
Lines 259-264
describe("Agreement CRUD operations", () => {
Link Here
|
259 |
|
260 |
|
260 |
// Fill in the form for normal attributes |
261 |
// Fill in the form for normal attributes |
261 |
let agreement = get_agreement(); |
262 |
let agreement = get_agreement(); |
|
|
263 |
let vendors = cy.get_vendors_to_relate(); |
262 |
|
264 |
|
263 |
cy.get("#agreements_add").contains("Submit").click(); |
265 |
cy.get("#agreements_add").contains("Submit").click(); |
264 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
266 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
Lines 277-282
describe("Agreement CRUD operations", () => {
Link Here
|
277 |
{ force: true } |
279 |
{ force: true } |
278 |
); |
280 |
); |
279 |
|
281 |
|
|
|
282 |
// vendors |
283 |
cy.get("#agreement_vendor_id .vs__selected").should("not.exist"); //no vendor pre-selected for new agreement |
284 |
|
285 |
cy.get("#agreement_vendor_id .vs__search").type( |
286 |
vendors[0].name + "{enter}", |
287 |
{ force: true } |
288 |
); |
289 |
cy.get("#agreement_vendor_id .vs__selected").contains(vendors[0].name); |
290 |
|
280 |
cy.contains("Add new period").click(); |
291 |
cy.contains("Add new period").click(); |
281 |
cy.get("#agreements_add").contains("Submit").click(); |
292 |
cy.get("#agreements_add").contains("Submit").click(); |
282 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
293 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
Lines 446-451
describe("Agreement CRUD operations", () => {
Link Here
|
446 |
let licenses_to_relate = get_licenses_to_relate(); |
457 |
let licenses_to_relate = get_licenses_to_relate(); |
447 |
let agreement = get_agreement(); |
458 |
let agreement = get_agreement(); |
448 |
let agreements = [agreement]; |
459 |
let agreements = [agreement]; |
|
|
460 |
let vendors = cy.get_vendors_to_relate(); |
461 |
|
462 |
// Intercept vendors request |
463 |
cy.intercept("GET", "/api/v1/acquisitions/vendors?_per_page=-1", { |
464 |
statusCode: 200, |
465 |
body: vendors, |
466 |
}).as("get-vendor-options"); |
449 |
|
467 |
|
450 |
// Intercept initial /agreements request once |
468 |
// Intercept initial /agreements request once |
451 |
cy.intercept( |
469 |
cy.intercept( |
Lines 502-507
describe("Agreement CRUD operations", () => {
Link Here
|
502 |
agreements[0].description |
520 |
agreements[0].description |
503 |
); |
521 |
); |
504 |
cy.get("#agreement_status .vs__selected").contains("Active"); |
522 |
cy.get("#agreement_status .vs__selected").contains("Active"); |
|
|
523 |
cy.get("#agreement_vendor_id .vs__selected").contains( |
524 |
agreement.vendor[0].name |
525 |
); |
526 |
|
527 |
cy.get("#agreement_vendor_id .vs__search").type( |
528 |
vendors[1].name + "{enter}", |
529 |
{ force: true } |
530 |
); |
531 |
|
505 |
cy.get("#agreement_is_perpetual_no").should("be.checked"); |
532 |
cy.get("#agreement_is_perpetual_no").should("be.checked"); |
506 |
cy.get("#started_on_0").invoke("val").should("eq", dates["today_iso"]); |
533 |
cy.get("#started_on_0").invoke("val").should("eq", dates["today_iso"]); |
507 |
cy.get("#ended_on_0").invoke("val").should("eq", dates["tomorrow_iso"]); |
534 |
cy.get("#ended_on_0").invoke("val").should("eq", dates["tomorrow_iso"]); |