Bugzilla – Attachment 153088 Details for
Bug 34217
Add missing cypress tests for vendors in agreements and licenses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34217: Add vendor tests for agreements
Bug-34217-Add-vendor-tests-for-agreements.patch (text/plain), 3.71 KB, created by
Pedro Amorim
on 2023-07-06 10:15:05 UTC
(
hide
)
Description:
Bug 34217: Add vendor tests for agreements
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-07-06 10:15:05 UTC
Size:
3.71 KB
patch
obsolete
>From 93eb8b4744d7c6e8caba70b76172611b9617c118 Mon Sep 17 00:00:00 2001 >From: John Doe <you@example.com> >Date: Thu, 6 Jul 2023 10:14:11 +0000 >Subject: [PATCH] Bug 34217: Add vendor tests for agreements > >--- > t/cypress/integration/ERM/Agreements_spec.ts | 29 +++++++++++++++++++- > t/cypress/support/index.js | 15 ++++++++++ > 2 files changed, 43 insertions(+), 1 deletion(-) > >diff --git a/t/cypress/integration/ERM/Agreements_spec.ts b/t/cypress/integration/ERM/Agreements_spec.ts >index 5638fb9d9e..6fb7d88007 100644 >--- a/t/cypress/integration/ERM/Agreements_spec.ts >+++ b/t/cypress/integration/ERM/Agreements_spec.ts >@@ -18,7 +18,8 @@ function get_agreement() { > name: "agreement 1", > renewal_priority: "", > status: "active", >- vendor_id: null, >+ vendor_id: 1, >+ vendor: [cy.get_vendors_to_relate()[0]], > periods: [ > { > started_on: dates["today_iso"], >@@ -263,6 +264,7 @@ describe("Agreement CRUD operations", () => { > > // Fill in the form for normal attributes > let agreement = get_agreement(); >+ let vendors = cy.get_vendors_to_relate(); > > cy.get("#agreements_add").contains("Submit").click(); > cy.get("input:invalid,textarea:invalid,select:invalid").should( >@@ -281,6 +283,15 @@ describe("Agreement CRUD operations", () => { > { force: true } > ); > >+ // vendors >+ cy.get("#agreement_vendor_id .vs__selected").should("not.exist"); //no vendor pre-selected for new agreement >+ >+ cy.get("#agreement_vendor_id .vs__search").type( >+ vendors[0].name + "{enter}", >+ { force: true } >+ ); >+ cy.get("#agreement_vendor_id .vs__selected").contains(vendors[0].name); >+ > cy.contains("Add new period").click(); > cy.get("#agreements_add").contains("Submit").click(); > cy.get("input:invalid,textarea:invalid,select:invalid").should( >@@ -450,6 +461,13 @@ describe("Agreement CRUD operations", () => { > let licenses_to_relate = get_licenses_to_relate(); > let agreement = get_agreement(); > let agreements = [agreement]; >+ let vendors = cy.get_vendors_to_relate(); >+ >+ // Intercept vendors request >+ cy.intercept("GET", "/api/v1/acquisitions/vendors?_per_page=-1", { >+ statusCode: 200, >+ body: vendors, >+ }).as("get-vendor-options"); > > // Intercept initial /agreements request once > cy.intercept( >@@ -505,6 +523,15 @@ describe("Agreement CRUD operations", () => { > agreements[0].description > ); > cy.get("#agreement_status .vs__selected").contains("Active"); >+ cy.get("#agreement_vendor_id .vs__selected").contains( >+ agreement.vendor[0].name >+ ); >+ >+ cy.get("#agreement_vendor_id .vs__search").type( >+ vendors[1].name + "{enter}", >+ { force: true } >+ ); >+ > cy.get("#agreement_is_perpetual_no").should("be.checked"); > cy.get("#started_on_0").invoke("val").should("eq", dates["today_iso"]); > cy.get("#ended_on_0").invoke("val").should("eq", dates["tomorrow_iso"]); >diff --git a/t/cypress/support/index.js b/t/cypress/support/index.js >index 5ced7d5f02..fc43c5782a 100644 >--- a/t/cypress/support/index.js >+++ b/t/cypress/support/index.js >@@ -86,4 +86,19 @@ cy.get_agreements_to_relate = () => { > name: "fourth agreement name" > }, > ] >+} >+ >+cy.get_vendors_to_relate = () => { >+ return [ >+ { >+ "id": 1, >+ "name": "My Vendor", >+ "aliases": [], >+ }, >+ { >+ "id": 2, >+ "name": "My Vendor 2", >+ "aliases": [], >+ } >+ ] > } >\ No newline at end of file >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34217
:
153088
|
153266
|
153722
|
154794
|
154996
|
154997
|
154998
|
155257
|
155258
|
155259
|
155260