|
Lines 111-113
describe("ExtendedPatronAttributes", () => {
Link Here
|
| 111 |
}); |
111 |
}); |
| 112 |
}); |
112 |
}); |
| 113 |
}); |
113 |
}); |
| 114 |
- |
114 |
|
|
|
115 |
describe("Filters", () => { |
| 116 |
const table_id = "memberresultst"; |
| 117 |
|
| 118 |
beforeEach(() => { |
| 119 |
cleanup(); |
| 120 |
cy.login(); |
| 121 |
cy.title().should("eq", "Koha staff interface"); |
| 122 |
cy.window().then(win => { |
| 123 |
win.localStorage.clear(); |
| 124 |
}); |
| 125 |
}); |
| 126 |
|
| 127 |
it("Keep filters in the column filters", () => { |
| 128 |
cy.task("buildSampleObjects", { |
| 129 |
object: "patron", |
| 130 |
count: RESTdefaultPageSize, |
| 131 |
values: {}, |
| 132 |
}).then(patrons => { |
| 133 |
// Needs more properties to not explode |
| 134 |
// account_balace: balance_str.escapeHtml(...).format_price is not a function |
| 135 |
patrons = patrons.map(p => ({ ...p, account_balance: 0 })); |
| 136 |
|
| 137 |
cy.intercept("GET", "/api/v1/patrons*", { |
| 138 |
statusCode: 200, |
| 139 |
body: patrons, |
| 140 |
headers: { |
| 141 |
"X-Base-Total-Count": baseTotalCount, |
| 142 |
"X-Total-Count": baseTotalCount, |
| 143 |
}, |
| 144 |
}); |
| 145 |
|
| 146 |
cy.visit("/cgi-bin/koha/members/members-home.pl"); |
| 147 |
|
| 148 |
cy.window().then(win => { |
| 149 |
win.categories_map = patrons.reduce((map, p) => { |
| 150 |
map[p.category_id] = p.category_id; |
| 151 |
return map; |
| 152 |
}, {}); |
| 153 |
}); |
| 154 |
cy.get("form.patron_search_form .branchcode_filter").select("CPL"); |
| 155 |
cy.get("form.patron_search_form .categorycode_filter").select("S"); |
| 156 |
cy.get("form.patron_search_form input[type='submit']").click(); |
| 157 |
|
| 158 |
cy.get(`#${table_id}_wrapper .dt-info`).contains( |
| 159 |
`Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` |
| 160 |
); |
| 161 |
|
| 162 |
cy.get(`#${table_id} thead tr`).should("have.length", 2); |
| 163 |
|
| 164 |
cy.get( |
| 165 |
`#${table_id} thead tr th[data-filter='libraries'] select` |
| 166 |
).should("have.value", "^CPL$"); |
| 167 |
// Lowercase see bug 32517 and related code in datatables.js |
| 168 |
cy.get( |
| 169 |
`#${table_id} thead tr th[data-filter='categories'] select` |
| 170 |
).should("have.value", "^s$"); |
| 171 |
|
| 172 |
cy.get(`form.patron_search_form input.clear_search`).click(); |
| 173 |
cy.get("form.patron_search_form input[type='submit']").click(); |
| 174 |
cy.get( |
| 175 |
`#${table_id} thead tr th[data-filter='libraries'] select` |
| 176 |
).should("have.value", null); |
| 177 |
// Lowercase see bug 32517 and related code in datatables.js |
| 178 |
cy.get( |
| 179 |
`#${table_id} thead tr th[data-filter='categories'] select` |
| 180 |
).should("have.value", null); |
| 181 |
}); |
| 182 |
}); |
| 183 |
}); |