View | Details | Raw Unified | Return to bug 33625
Collapse All | Expand All

(-)a/t/cypress/integration/ERM/Agreements_spec.ts (-19 / +54 lines)
Lines 164-188 describe("Agreement CRUD operations", () => { Link Here
164
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement);
164
        cy.intercept("GET", "/api/v1/erm/agreements/*", agreement);
165
        cy.visit("/cgi-bin/koha/erm/agreements");
165
        cy.visit("/cgi-bin/koha/erm/agreements");
166
        cy.get("#agreements_list").contains("Showing 1 to 1 of 1 entries");
166
        cy.get("#agreements_list").contains("Showing 1 to 1 of 1 entries");
167
        cy.get(".filters").find("label").should(($labels) => {
167
        cy.get(".filters")
168
              expect($labels).to.have.length(2)
168
            .find("label")
169
              expect($labels.eq(0)).to.contain('Filter by expired')
169
            .should($labels => {
170
              expect($labels.eq(1)).to.contain('Show mine only')
170
                expect($labels).to.have.length(2);
171
        }); // Filter options appear
171
                expect($labels.eq(0)).to.contain("Filter by expired");
172
                expect($labels.eq(1)).to.contain("Show mine only");
173
            }); // Filter options appear
172
174
173
        // Test filtering
175
        // Test filtering
174
        cy.intercept("GET", "/api/v1/erm/agreements?max_expiration_date=*", []).as("getActiveAgreements");
176
        cy.intercept(
177
            "GET",
178
            "/api/v1/erm/agreements?max_expiration_date=*",
179
            []
180
        ).as("getActiveAgreements");
175
        cy.get("#expired_filter").check();
181
        cy.get("#expired_filter").check();
176
        cy.get("#filter_table").click();
182
        cy.get("#filter_table").click();
177
        cy.wait('@getActiveAgreements')
183
        cy.wait("@getActiveAgreements")
178
            .its('request.url')
184
            .its("request.url")
179
            .should('include', 'max_expiration_date='+dates["today_iso"]); // Defaults to today
185
            .should("include", "max_expiration_date=" + dates["today_iso"]); // Defaults to today
180
        cy.get("#max_expiration_date_filter").should("have.value", dates["today_iso"]); // Input box reflects default
186
        cy.get("#max_expiration_date_filter").should(
181
        cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["today_iso"]); // Browser url also updated
187
            "have.value",
188
            dates["today_iso"]
189
        ); // Input box reflects default
190
        cy.url().should(
191
            "include",
192
            "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date=" +
193
                dates["today_iso"]
194
        ); // Browser url also updated
182
195
183
        // Now test that the url for this particular state works
196
        // Now test that the url for this particular state works
184
        cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["today_iso"]);
197
        cy.visit(
185
        cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["today_iso"]);
198
            "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date=" +
199
                dates["today_iso"]
200
        );
201
        cy.wait("@getActiveAgreements")
202
            .its("request.url")
203
            .should("include", "max_expiration_date=" + dates["today_iso"]);
186
204
187
        // Now test with a user entered date
205
        // Now test with a user entered date
188
        cy.get("#max_expiration_date_filter+input").click({ force: true });
206
        cy.get("#max_expiration_date_filter+input").click({ force: true });
Lines 192-211 describe("Agreement CRUD operations", () => { Link Here
192
            .next("span")
210
            .next("span")
193
            .click(); // select tomorrow
211
            .click(); // select tomorrow
194
        cy.get("#filter_table").click();
212
        cy.get("#filter_table").click();
195
        cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["tomorrow_iso"]);
213
        cy.wait("@getActiveAgreements")
196
        cy.get("#max_expiration_date_filter").should("have.value", dates["tomorrow_iso"]);
214
            .its("request.url")
215
            .should("include", "max_expiration_date=" + dates["tomorrow_iso"]);
216
        cy.get("#max_expiration_date_filter").should(
217
            "have.value",
218
            dates["tomorrow_iso"]
219
        );
197
        // Assert that browser url changed again to reflect the user entered date
220
        // Assert that browser url changed again to reflect the user entered date
198
        cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["tomorrow_iso"]);
221
        cy.url().should(
222
            "include",
223
            "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date=" +
224
                dates["tomorrow_iso"]
225
        );
199
226
200
        // Now test that the url for the updated state works
227
        // Now test that the url for the updated state works
201
        cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["tomorrow_iso"]);
228
        cy.visit(
202
        cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["tomorrow_iso"]);
229
            "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date=" +
230
                dates["tomorrow_iso"]
231
        );
232
        cy.wait("@getActiveAgreements")
233
            .its("request.url")
234
            .should("include", "max_expiration_date=" + dates["tomorrow_iso"]);
203
235
204
        // Verify that the date input is automatically filled if "by_expired" ticked but date is empty
236
        // Verify that the date input is automatically filled if "by_expired" ticked but date is empty
205
        cy.get("#max_expiration_date_filter+input").clear();
237
        cy.get("#max_expiration_date_filter+input").clear();
206
        cy.get("#expired_filter").check();
238
        cy.get("#expired_filter").check();
207
        cy.get("#filter_table").click();
239
        cy.get("#filter_table").click();
208
        cy.get("#max_expiration_date_filter").should('have.value', dates["today_iso"]);
240
        cy.get("#max_expiration_date_filter").should(
241
            "have.value",
242
            dates["today_iso"]
243
        );
209
244
210
        // Test filter button with show mine_only ticked
245
        // Test filter button with show mine_only ticked
211
    });
246
    });
(-)a/t/cypress/integration/ERM/Searchbar_spec.ts (-2 / +1 lines)
Lines 26-32 describe("Searchbar header changes", () => { Link Here
26
26
27
    it("Should change to licenses when in licenses", () => {
27
    it("Should change to licenses when in licenses", () => {
28
        cy.visit("/cgi-bin/koha/erm/licenses");
28
        cy.visit("/cgi-bin/koha/erm/licenses");
29
        cy.get("#license_search_tab").parent().should("have.class", "active")
29
        cy.get("#license_search_tab").parent().should("have.class", "active");
30
    });
30
    });
31
31
32
    it("Should change to packages when in local packages", () => {
32
    it("Should change to packages when in local packages", () => {
33
- 

Return to bug 33625