Bug 33480: (QA follow-up) Add cypress tests:
Add tests for vendor aliases Test plan: perl /kohadevbox/misc4dev/run_tests.pl --run-cypress-tests-only Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
26141598a8
commit
23744e7ef1
|
|
@ -242,6 +242,8 @@ describe("Agreement CRUD operations", () => {
|
|||
});
|
||||
|
||||
it("Add agreement", () => {
|
||||
let agreement = get_agreement();
|
||||
let vendors = cy.get_vendors_to_relate();
|
||||
// No agreement, no license yet
|
||||
cy.intercept("GET", "/api/v1/erm/agreements*", {
|
||||
statusCode: 200,
|
||||
|
|
@ -251,6 +253,11 @@ describe("Agreement CRUD operations", () => {
|
|||
statusCode: 200,
|
||||
body: [],
|
||||
});
|
||||
//Intercept vendors request
|
||||
cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
|
||||
statusCode: 200,
|
||||
body: vendors,
|
||||
});
|
||||
|
||||
// Click the button in the toolbar
|
||||
cy.visit("/cgi-bin/koha/erm/agreements");
|
||||
|
|
@ -259,9 +266,6 @@ describe("Agreement CRUD operations", () => {
|
|||
cy.left_menu_active_item_is("Agreements");
|
||||
|
||||
// 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(
|
||||
"have.length",
|
||||
|
|
@ -288,6 +292,11 @@ describe("Agreement CRUD operations", () => {
|
|||
);
|
||||
cy.get("#agreement_vendor_id .vs__selected").contains(vendors[0].name);
|
||||
|
||||
// vendor aliases
|
||||
cy.get("#agreement_vendor_id .vs__search").click();
|
||||
cy.get("#agreement_vendor_id #vs1__option-1").contains(vendors[1].name);
|
||||
cy.get("#agreement_vendor_id #vs1__option-1 cite").contains(vendors[1].aliases[0].alias);
|
||||
|
||||
cy.contains("Add new period").click();
|
||||
cy.get("#agreements_add").contains("Submit").click();
|
||||
cy.get("input:invalid,textarea:invalid,select:invalid").should(
|
||||
|
|
@ -460,7 +469,7 @@ describe("Agreement CRUD operations", () => {
|
|||
let vendors = cy.get_vendors_to_relate();
|
||||
|
||||
// Intercept vendors request
|
||||
cy.intercept("GET", "/api/v1/acquisitions/vendors?_per_page=-1", {
|
||||
cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
|
||||
statusCode: 200,
|
||||
body: vendors,
|
||||
}).as("get-vendor-options");
|
||||
|
|
@ -520,6 +529,8 @@ describe("Agreement CRUD operations", () => {
|
|||
agreements[0].description
|
||||
);
|
||||
cy.get("#agreement_status .vs__selected").contains("Active");
|
||||
|
||||
//vendors
|
||||
cy.get("#agreement_vendor_id .vs__selected").contains(
|
||||
agreement.vendor[0].name
|
||||
);
|
||||
|
|
@ -529,6 +540,11 @@ describe("Agreement CRUD operations", () => {
|
|||
{ force: true }
|
||||
);
|
||||
|
||||
//vendor aliases
|
||||
cy.get("#agreement_vendor_id .vs__search").click();
|
||||
cy.get("#agreement_vendor_id #vs1__option-1").contains(vendors[1].name);
|
||||
cy.get("#agreement_vendor_id #vs1__option-1 cite").contains(vendors[1].aliases[0].alias);
|
||||
|
||||
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"]);
|
||||
|
|
|
|||
|
|
@ -80,6 +80,13 @@ describe("License CRUD operations", () => {
|
|||
});
|
||||
|
||||
it("Add license", () => {
|
||||
let license = get_license();
|
||||
let vendors = cy.get_vendors_to_relate();
|
||||
//Intercept vendors request
|
||||
cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
|
||||
statusCode: 200,
|
||||
body: vendors,
|
||||
});
|
||||
// Click the button in the toolbar
|
||||
cy.visit("/cgi-bin/koha/erm/licenses");
|
||||
cy.contains("New license").click();
|
||||
|
|
@ -87,9 +94,6 @@ describe("License CRUD operations", () => {
|
|||
cy.left_menu_active_item_is("Licenses");
|
||||
|
||||
// Fill in the form for normal attributes
|
||||
let license = get_license();
|
||||
let vendors = cy.get_vendors_to_relate();
|
||||
|
||||
cy.get("#licenses_add").contains("Submit").click();
|
||||
cy.get("input:invalid,textarea:invalid,select:invalid").should(
|
||||
"have.length",
|
||||
|
|
@ -108,6 +112,11 @@ describe("License CRUD operations", () => {
|
|||
// vendors
|
||||
cy.get("#license_vendor_id .vs__selected").should("not.exist"); //no vendor pre-selected for new license
|
||||
|
||||
// vendor aliases
|
||||
cy.get("#license_vendor_id .vs__search").click();
|
||||
cy.get("#license_vendor_id #vs1__option-1").contains(vendors[1].name);
|
||||
cy.get("#license_vendor_id #vs1__option-1 cite").contains(vendors[1].aliases[0].alias);
|
||||
|
||||
cy.get("#license_vendor_id .vs__search").type(
|
||||
vendors[0].name + "{enter}",
|
||||
{ force: true }
|
||||
|
|
@ -168,7 +177,7 @@ describe("License CRUD operations", () => {
|
|||
let vendors = cy.get_vendors_to_relate();
|
||||
|
||||
// Intercept vendors request
|
||||
cy.intercept("GET", "/api/v1/acquisitions/vendors?_per_page=-1", {
|
||||
cy.intercept("GET", "/api/v1/acquisitions/vendors*", {
|
||||
statusCode: 200,
|
||||
body: vendors,
|
||||
}).as("get-vendor-options");
|
||||
|
|
@ -195,6 +204,7 @@ describe("License CRUD operations", () => {
|
|||
// Form has been correctly filled in
|
||||
cy.get("#license_name").should("have.value", license.name);
|
||||
|
||||
//vendors
|
||||
cy.get("#license_vendor_id .vs__selected").contains(
|
||||
license.vendor[0].name
|
||||
);
|
||||
|
|
@ -204,6 +214,11 @@ describe("License CRUD operations", () => {
|
|||
{ force: true }
|
||||
);
|
||||
|
||||
//vendor aliases
|
||||
cy.get("#license_vendor_id .vs__search").click();
|
||||
cy.get("#license_vendor_id #vs1__option-1").contains(vendors[1].name);
|
||||
cy.get("#license_vendor_id #vs1__option-1 cite").contains(vendors[1].aliases[0].alias);
|
||||
|
||||
cy.get("#license_description").should(
|
||||
"have.value",
|
||||
license.description
|
||||
|
|
|
|||
|
|
@ -123,7 +123,9 @@ cy.get_vendors_to_relate = () => {
|
|||
{
|
||||
"id": 2,
|
||||
"name": "My Vendor 2",
|
||||
"aliases": [],
|
||||
"aliases": [
|
||||
{"alias": "alias", alias_id: 1, vendor_id: 2}
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue