Bugzilla – Attachment 150194 Details for
Bug 33490
Agreements - Filter by expired results in error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33490: Unit tests
Bug-33490-Unit-tests.patch (text/plain), 3.26 KB, created by
Jonathan Druart
on 2023-04-25 12:47:17 UTC
(
hide
)
Description:
Bug 33490: Unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-04-25 12:47:17 UTC
Size:
3.26 KB
patch
obsolete
>From 1a0d5d01cb72d075784ea890c25b0fa4234868e2 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 13 Apr 2023 14:38:58 +0100 >Subject: [PATCH] Bug 33490: Unit tests > >This patch adds cypress tests for the filter by expired functionality in >the ERM Agreements page. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/cypress/integration/ERM/Agreements_spec.ts | 38 ++++++++++++++++++++ > 1 file changed, 38 insertions(+) > >diff --git a/t/cypress/integration/ERM/Agreements_spec.ts b/t/cypress/integration/ERM/Agreements_spec.ts >index 52f3a370cec..48e222d1013 100644 >--- a/t/cypress/integration/ERM/Agreements_spec.ts >+++ b/t/cypress/integration/ERM/Agreements_spec.ts >@@ -156,6 +156,44 @@ describe("Agreement CRUD operations", () => { > cy.intercept("GET", "/api/v1/erm/agreements/*", agreement); > cy.visit("/cgi-bin/koha/erm/agreements"); > cy.get("#agreements_list").contains("Showing 1 to 1 of 1 entries"); >+ cy.get(".filters").find("label").should(($labels) => { >+ expect($labels).to.have.length(2) >+ expect($labels.eq(0)).to.contain('Filter by expired') >+ expect($labels.eq(1)).to.contain('Show mine only') >+ }); // Filter options appear >+ >+ // Test filtering >+ cy.intercept("GET", "/api/v1/erm/agreements?max_expiration_date=*", []).as("getActiveAgreements"); >+ cy.get("#expired_filter").check(); >+ cy.get("#filter_table").click(); >+ cy.wait('@getActiveAgreements') >+ .its('request.url') >+ .should('include', 'max_expiration_date='+dates["today_iso"]); // Defaults to today >+ cy.get("#max_expiration_date_filter").should("have.value", dates["today_iso"]); // Input box reflects default >+ cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true"); // Browser url also updated >+ >+ // Now test that the url for this particular state works >+ cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true"); >+ cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["today_iso"]); >+ >+ // Now test with a user entered date >+ cy.get("#max_expiration_date_filter+input").click({ force: true }); >+ cy.get(".flatpickr-calendar") >+ .eq(0) >+ .find("span.today") >+ .next("span") >+ .click(); // select tomorrow >+ cy.get("#filter_table").click(); >+ cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["tomorrow_iso"]); >+ cy.get("#max_expiration_date_filter").should("have.value", dates["tomorrow_iso"]); >+ // Assert that browser url changed again to reflect the user entered date >+ cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["tomorrow_iso"]); >+ >+ // Now test that the url for the updated state works >+ cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["tomorrow_iso"]); >+ cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["tomorrow_iso"]); >+ >+ // Test filter button with show mine_only ticked > }); > > it("Add agreement", () => { >-- >2.25.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 33490
:
149519
|
149521
|
149522
|
149523
|
149603
|
149604
|
149615
|
149643
|
149652
|
149661
|
149672
|
149673
|
149674
|
149675
|
149676
|
150038
|
150039
|
150040
|
150048
| 150194 |
150195
|
150196
|
150197
|
150198
|
150199
|
150200
|
150201