Bugzilla – Attachment 149603 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.17 KB, created by
Martin Renvoize
on 2023-04-13 13:40:26 UTC
(
hide
)
Description:
Bug 33490: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2023-04-13 13:40:26 UTC
Size:
3.17 KB
patch
obsolete
>From b441c9c1af775dbf056ecee53140b3f90d8f50b4 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. >--- > t/cypress/integration/Agreements_spec.ts | 38 ++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > >diff --git a/t/cypress/integration/Agreements_spec.ts b/t/cypress/integration/Agreements_spec.ts >index 8dd209ee8d..5bfd27fae3 100644 >--- a/t/cypress/integration/Agreements_spec.ts >+++ b/t/cypress/integration/Agreements_spec.ts >@@ -163,6 +163,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.40.0
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