Lines 163-168
describe("Agreement CRUD operations", () => {
Link Here
|
163 |
cy.intercept("GET", "/api/v1/erm/agreements/*", agreement); |
163 |
cy.intercept("GET", "/api/v1/erm/agreements/*", agreement); |
164 |
cy.visit("/cgi-bin/koha/erm/agreements"); |
164 |
cy.visit("/cgi-bin/koha/erm/agreements"); |
165 |
cy.get("#agreements_list").contains("Showing 1 to 1 of 1 entries"); |
165 |
cy.get("#agreements_list").contains("Showing 1 to 1 of 1 entries"); |
|
|
166 |
cy.get(".filters").find("label").should(($labels) => { |
167 |
expect($labels).to.have.length(2) |
168 |
expect($labels.eq(0)).to.contain('Filter by expired') |
169 |
expect($labels.eq(1)).to.contain('Show mine only') |
170 |
}); // Filter options appear |
171 |
|
172 |
// Test filtering |
173 |
cy.intercept("GET", "/api/v1/erm/agreements?max_expiration_date=*", []).as("getActiveAgreements"); |
174 |
cy.get("#expired_filter").check(); |
175 |
cy.get("#filter_table").click(); |
176 |
cy.wait('@getActiveAgreements') |
177 |
.its('request.url') |
178 |
.should('include', 'max_expiration_date='+dates["today_iso"]); // Defaults to today |
179 |
cy.get("#max_expiration_date_filter").should("have.value", dates["today_iso"]); // Input box reflects default |
180 |
cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true"); // Browser url also updated |
181 |
|
182 |
// Now test that the url for this particular state works |
183 |
cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true"); |
184 |
cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["today_iso"]); |
185 |
|
186 |
// Now test with a user entered date |
187 |
cy.get("#max_expiration_date_filter+input").click({ force: true }); |
188 |
cy.get(".flatpickr-calendar") |
189 |
.eq(0) |
190 |
.find("span.today") |
191 |
.next("span") |
192 |
.click(); // select tomorrow |
193 |
cy.get("#filter_table").click(); |
194 |
cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["tomorrow_iso"]); |
195 |
cy.get("#max_expiration_date_filter").should("have.value", dates["tomorrow_iso"]); |
196 |
// Assert that browser url changed again to reflect the user entered date |
197 |
cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["tomorrow_iso"]); |
198 |
|
199 |
// Now test that the url for the updated state works |
200 |
cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["tomorrow_iso"]); |
201 |
cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["tomorrow_iso"]); |
202 |
|
203 |
// Test filter button with show mine_only ticked |
166 |
}); |
204 |
}); |
167 |
|
205 |
|
168 |
it("Add agreement", () => { |
206 |
it("Add agreement", () => { |
169 |
- |
|
|