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 263-268
describe("Agreement CRUD operations", () => {
Link Here
|
263 |
|
264 |
|
264 |
// Fill in the form for normal attributes |
265 |
// Fill in the form for normal attributes |
265 |
let agreement = get_agreement(); |
266 |
let agreement = get_agreement(); |
|
|
267 |
let vendors = cy.get_vendors_to_relate(); |
266 |
|
268 |
|
267 |
cy.get("#agreements_add").contains("Submit").click(); |
269 |
cy.get("#agreements_add").contains("Submit").click(); |
268 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
270 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
Lines 281-286
describe("Agreement CRUD operations", () => {
Link Here
|
281 |
{ force: true } |
283 |
{ force: true } |
282 |
); |
284 |
); |
283 |
|
285 |
|
|
|
286 |
// vendors |
287 |
cy.get("#agreement_vendor_id .vs__selected").should("not.exist"); //no vendor pre-selected for new agreement |
288 |
|
289 |
cy.get("#agreement_vendor_id .vs__search").type( |
290 |
vendors[0].name + "{enter}", |
291 |
{ force: true } |
292 |
); |
293 |
cy.get("#agreement_vendor_id .vs__selected").contains(vendors[0].name); |
294 |
|
284 |
cy.contains("Add new period").click(); |
295 |
cy.contains("Add new period").click(); |
285 |
cy.get("#agreements_add").contains("Submit").click(); |
296 |
cy.get("#agreements_add").contains("Submit").click(); |
286 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
297 |
cy.get("input:invalid,textarea:invalid,select:invalid").should( |
Lines 450-455
describe("Agreement CRUD operations", () => {
Link Here
|
450 |
let licenses_to_relate = get_licenses_to_relate(); |
461 |
let licenses_to_relate = get_licenses_to_relate(); |
451 |
let agreement = get_agreement(); |
462 |
let agreement = get_agreement(); |
452 |
let agreements = [agreement]; |
463 |
let agreements = [agreement]; |
|
|
464 |
let vendors = cy.get_vendors_to_relate(); |
465 |
|
466 |
// Intercept vendors request |
467 |
cy.intercept("GET", "/api/v1/acquisitions/vendors?_per_page=-1", { |
468 |
statusCode: 200, |
469 |
body: vendors, |
470 |
}).as("get-vendor-options"); |
453 |
|
471 |
|
454 |
// Intercept initial /agreements request once |
472 |
// Intercept initial /agreements request once |
455 |
cy.intercept( |
473 |
cy.intercept( |
Lines 505-510
describe("Agreement CRUD operations", () => {
Link Here
|
505 |
agreements[0].description |
523 |
agreements[0].description |
506 |
); |
524 |
); |
507 |
cy.get("#agreement_status .vs__selected").contains("Active"); |
525 |
cy.get("#agreement_status .vs__selected").contains("Active"); |
|
|
526 |
cy.get("#agreement_vendor_id .vs__selected").contains( |
527 |
agreement.vendor[0].name |
528 |
); |
529 |
|
530 |
cy.get("#agreement_vendor_id .vs__search").type( |
531 |
vendors[1].name + "{enter}", |
532 |
{ force: true } |
533 |
); |
534 |
|
508 |
cy.get("#agreement_is_perpetual_no").should("be.checked"); |
535 |
cy.get("#agreement_is_perpetual_no").should("be.checked"); |
509 |
cy.get("#started_on_0").invoke("val").should("eq", dates["today_iso"]); |
536 |
cy.get("#started_on_0").invoke("val").should("eq", dates["today_iso"]); |
510 |
cy.get("#ended_on_0").invoke("val").should("eq", dates["tomorrow_iso"]); |
537 |
cy.get("#ended_on_0").invoke("val").should("eq", dates["tomorrow_iso"]); |