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