Bugzilla – Attachment 182981 Details for
Bug 40067
"Receive shipments" should not open in a new tab/window
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40067: Add a cypress test
Bug-40067-Add-a-cypress-test.patch (text/plain), 7.67 KB, created by
Matt Blenkinsop
on 2025-06-05 09:42:01 UTC
(
hide
)
Description:
Bug 40067: Add a cypress test
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-06-05 09:42:01 UTC
Size:
7.67 KB
patch
obsolete
>From 296e25887bc9b3ac8916c21761dfc30625ef1cb1 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Date: Thu, 5 Jun 2025 10:04:15 +0100 >Subject: [PATCH] Bug 40067: Add a cypress test > >--- > .../integration/Acquisitions/Vendors_spec.ts | 71 ++----------------- > t/cypress/integration/Toolbar_spec.ts | 33 +++++++++ > t/cypress/support/e2e.js | 61 ++++++++++++++++ > 3 files changed, 99 insertions(+), 66 deletions(-) > create mode 100644 t/cypress/integration/Toolbar_spec.ts > >diff --git a/t/cypress/integration/Acquisitions/Vendors_spec.ts b/t/cypress/integration/Acquisitions/Vendors_spec.ts >index 7935d40d4f6..b82e30f071e 100644 >--- a/t/cypress/integration/Acquisitions/Vendors_spec.ts >+++ b/t/cypress/integration/Acquisitions/Vendors_spec.ts >@@ -1,64 +1,3 @@ >-const getVendor = () => { >- return { >- accountnumber: "69823", >- active: true, >- address1: "6897 Library Rd", >- address2: "Springfield, MA 44224", >- address3: null, >- address4: null, >- aliases: [{ alias: "Test alias" }], >- baskets: [], >- baskets_count: 0, >- contacts: [ >- { >- name: "Test contact", >- position: "Test", >- email: "test@email.com", >- phone: "0123456789", >- notes: "Some interesting notes", >- altphone: "9876543210", >- fax: "Who uses fax these days?", >- acqprimary: false, >- orderacquisition: false, >- claimacquisition: false, >- serialsprimary: false, >- claimissues: false, >- }, >- ], >- deliverytime: 3, >- discount: 10, >- external_id: "test1234", >- fax: "555-555-9999", >- gst: false, >- id: 1, >- interfaces: [ >- { >- type: "interface", >- name: "fancy website", >- uri: "www.uri.com", >- login: "login", >- password: "password", >- account_email: "email@email.com", >- notes: "This is a website", >- }, >- ], >- invoice_currency: "USD", >- invoice_includes_gst: false, >- invoices_count: 0, >- list_currency: "USD", >- list_includes_gst: false, >- name: "My Vendor", >- notes: "Sample vendor", >- phone: "555-555-5555", >- postal: "567 Main St. PO Box 25 Springfield, MA 44224", >- subscriptions: [], >- subscriptions_count: 0, >- tax_rate: 0.1965, >- type: "Print books", >- url: "https://koha-community.org/", >- }; >-}; >- > describe("Vendor CRUD operations", () => { > beforeEach(() => { > cy.login(); >@@ -72,7 +11,7 @@ describe("Vendor CRUD operations", () => { > cy.visit("/cgi-bin/koha/acquisition/vendors"); > cy.get("#vendors_list").contains("There are no vendors defined"); > >- const vendor = getVendor(); >+ const vendor = cy.getVendor(); > cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { > statusCode: 200, > body: [vendor], >@@ -86,7 +25,7 @@ describe("Vendor CRUD operations", () => { > }); > > it("should add a vendor", () => { >- const vendor = getVendor(); >+ const vendor = cy.getVendor(); > > cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { > statusCode: 200, >@@ -180,7 +119,7 @@ describe("Vendor CRUD operations", () => { > }); > > it("should edit a vendor", () => { >- const vendor = getVendor(); >+ const vendor = cy.getVendor(); > > cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { > statusCode: 200, >@@ -219,7 +158,7 @@ describe("Vendor CRUD operations", () => { > }); > > it("should show a vendor", () => { >- const vendor = getVendor(); >+ const vendor = cy.getVendor(); > > // Click the "name" link from the list > cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { >@@ -249,7 +188,7 @@ describe("Vendor CRUD operations", () => { > }); > > it("should delete a vendor", () => { >- const vendor = getVendor(); >+ const vendor = cy.getVendor(); > > // Delete from list > // Click the 'Delete' button from the list >diff --git a/t/cypress/integration/Toolbar_spec.ts b/t/cypress/integration/Toolbar_spec.ts >new file mode 100644 >index 00000000000..ce2abf908a7 >--- /dev/null >+++ b/t/cypress/integration/Toolbar_spec.ts >@@ -0,0 +1,33 @@ >+describe("Sticky toolbar", () => { >+ beforeEach(() => { >+ cy.login(); >+ cy.title().should("eq", "Koha staff interface"); >+ }); >+ >+ it("Should open non-Vue links correctly in the same tab", () => { >+ const vendor = cy.getVendor(); >+ vendor.baskets_count = 1; >+ // Click the "name" link from the list >+ cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { >+ statusCode: 200, >+ body: [vendor], >+ headers: { >+ "X-Base-Total-Count": "1", >+ "X-Total-Count": "1", >+ }, >+ }); >+ cy.visit("/cgi-bin/koha/acquisition/vendors"); >+ cy.intercept( >+ "GET", >+ new RegExp("/api/v1/acquisitions/vendors/(?!config$).+"), >+ vendor >+ ).as("get-vendor"); >+ >+ const name_link = cy.get( >+ "#vendors_list table tbody tr:first td:first a" >+ ); >+ name_link.click(); >+ cy.get("#toolbar a").contains("Receive shipments").click(); >+ cy.get("h1").contains("Receive shipment from vendor " + vendor.name); >+ }); >+}); >diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js >index b94cc0637af..e420889c3b5 100644 >--- a/t/cypress/support/e2e.js >+++ b/t/cypress/support/e2e.js >@@ -1813,6 +1813,67 @@ cy.getSushiService = () => { > }; > }; > >+cy.getVendor = () => { >+ return { >+ accountnumber: "69823", >+ active: true, >+ address1: "6897 Library Rd", >+ address2: "Springfield, MA 44224", >+ address3: null, >+ address4: null, >+ aliases: [{ alias: "Test alias" }], >+ baskets: [], >+ baskets_count: 0, >+ contacts: [ >+ { >+ name: "Test contact", >+ position: "Test", >+ email: "test@email.com", >+ phone: "0123456789", >+ notes: "Some interesting notes", >+ altphone: "9876543210", >+ fax: "Who uses fax these days?", >+ acqprimary: false, >+ orderacquisition: false, >+ claimacquisition: false, >+ serialsprimary: false, >+ claimissues: false, >+ }, >+ ], >+ deliverytime: 3, >+ discount: 10, >+ external_id: "test1234", >+ fax: "555-555-9999", >+ gst: false, >+ id: 1, >+ interfaces: [ >+ { >+ type: "interface", >+ name: "fancy website", >+ uri: "www.uri.com", >+ login: "login", >+ password: "password", >+ account_email: "email@email.com", >+ notes: "This is a website", >+ }, >+ ], >+ invoice_currency: "USD", >+ invoice_includes_gst: false, >+ invoices_count: 0, >+ list_currency: "USD", >+ list_includes_gst: false, >+ name: "My Vendor", >+ notes: "Sample vendor", >+ phone: "555-555-5555", >+ postal: "567 Main St. PO Box 25 Springfield, MA 44224", >+ subscriptions: [], >+ subscriptions_count: 0, >+ tax_rate: 0.1965, >+ type: "Print books", >+ url: "https://koha-community.org/", >+ }; >+}; >+ > const mysql = require("cypress-mysql"); > mysql.addCommands(); > >-- >2.48.1
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 40067
:
182934
|
182949
|
182950
|
182951
|
182972
|
182981
|
183000
|
183001
|
183002
|
183003