|
Lines 4-9
describe("kohaTable (using REST API)", () => {
Link Here
|
| 4 |
beforeEach(() => { |
4 |
beforeEach(() => { |
| 5 |
cy.login(); |
5 |
cy.login(); |
| 6 |
cy.title().should("eq", "Koha staff interface"); |
6 |
cy.title().should("eq", "Koha staff interface"); |
|
|
7 |
cy.window().then(win => { |
| 8 |
win.localStorage.clear(); |
| 9 |
}); |
| 7 |
}); |
10 |
}); |
| 8 |
|
11 |
|
| 9 |
afterEach(() => {}); |
12 |
afterEach(() => {}); |
|
Lines 64-69
describe("kohaTable (using REST API)", () => {
Link Here
|
| 64 |
); |
67 |
); |
| 65 |
}); |
68 |
}); |
| 66 |
}); |
69 |
}); |
|
|
70 |
|
| 71 |
it("All columns displayed", () => { |
| 72 |
cy.task("buildSampleObjects", { |
| 73 |
object: "library", |
| 74 |
count: RESTdefaultPageSize, |
| 75 |
values: { library_hours: [] }, |
| 76 |
}).then(libraries => { |
| 77 |
cy.intercept("GET", "/api/v1/libraries*", { |
| 78 |
statusCode: 200, |
| 79 |
body: libraries, |
| 80 |
headers: { |
| 81 |
"X-Base-Total-Count": baseTotalCount, |
| 82 |
"X-Total-Count": baseTotalCount, |
| 83 |
}, |
| 84 |
}); |
| 85 |
|
| 86 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 87 |
|
| 88 |
cy.window().then(win => { |
| 89 |
win.table_settings.columns = win.table_settings.columns.map( |
| 90 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
| 91 |
); |
| 92 |
cy.get(`#${table_id} th`).should( |
| 93 |
"have.length", |
| 94 |
win.table_settings.columns.length |
| 95 |
); |
| 96 |
}); |
| 97 |
}); |
| 98 |
}); |
| 99 |
|
| 100 |
it("One column hidden by default", () => { |
| 101 |
cy.task("buildSampleObjects", { |
| 102 |
object: "library", |
| 103 |
count: RESTdefaultPageSize, |
| 104 |
values: { library_hours: [] }, |
| 105 |
}).then(libraries => { |
| 106 |
cy.intercept("GET", "/api/v1/libraries*", { |
| 107 |
statusCode: 200, |
| 108 |
body: libraries, |
| 109 |
headers: { |
| 110 |
"X-Base-Total-Count": baseTotalCount, |
| 111 |
"X-Total-Count": baseTotalCount, |
| 112 |
}, |
| 113 |
}); |
| 114 |
|
| 115 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 116 |
|
| 117 |
cy.window().then(win => { |
| 118 |
win.table_settings.columns = win.table_settings.columns.map( |
| 119 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
| 120 |
); |
| 121 |
win.table_settings.columns.find( |
| 122 |
c => c.columnname == "library_code" |
| 123 |
).is_hidden = 1; |
| 124 |
cy.get(`#${table_id} th`).should( |
| 125 |
"have.length", |
| 126 |
win.table_settings.columns.length - 1 |
| 127 |
); |
| 128 |
cy.get(`#${table_id} th`).contains("Name"); |
| 129 |
cy.get(`#${table_id} th`) |
| 130 |
.contains("Code") |
| 131 |
.should("not.exist"); |
| 132 |
}); |
| 133 |
}); |
| 134 |
}); |
| 135 |
|
| 136 |
/* TODO Missing mock, we assume that 'Save state' is ON */ |
| 137 |
it("One column hidden by default then shown by user", () => { |
| 138 |
cy.task("buildSampleObjects", { |
| 139 |
object: "library", |
| 140 |
count: RESTdefaultPageSize, |
| 141 |
values: { library_hours: [] }, |
| 142 |
}).then(libraries => { |
| 143 |
cy.intercept("GET", "/api/v1/libraries*", { |
| 144 |
statusCode: 200, |
| 145 |
body: libraries, |
| 146 |
headers: { |
| 147 |
"X-Base-Total-Count": baseTotalCount, |
| 148 |
"X-Total-Count": baseTotalCount, |
| 149 |
}, |
| 150 |
}); |
| 151 |
|
| 152 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 153 |
|
| 154 |
cy.window().then(win => { |
| 155 |
win.table_settings.columns = win.table_settings.columns.map( |
| 156 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
| 157 |
); |
| 158 |
win.table_settings.columns.find( |
| 159 |
c => c.columnname == "library_code" |
| 160 |
).is_hidden = 1; |
| 161 |
cy.get(`#${table_id} th`).should( |
| 162 |
"have.length", |
| 163 |
win.table_settings.columns.length - 1 |
| 164 |
); |
| 165 |
cy.get(`#${table_id} th`).contains("Name"); |
| 166 |
cy.get(`#${table_id} th`) |
| 167 |
.contains("Code") |
| 168 |
.should("not.exist"); |
| 169 |
cy.get(`#${table_id}_wrapper .buttons-colvis`).click(); |
| 170 |
cy.get(`#${table_id}_wrapper .dt-button-collection`) |
| 171 |
.contains("Code") |
| 172 |
.click(); |
| 173 |
cy.get(`#${table_id} th`).should( |
| 174 |
"have.length", |
| 175 |
win.table_settings.columns.length |
| 176 |
); |
| 177 |
cy.get(`#${table_id} th`).contains("Name"); |
| 178 |
cy.get(`#${table_id} th`).contains("Code"); |
| 179 |
}); |
| 180 |
|
| 181 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 182 |
|
| 183 |
cy.window().then(win => { |
| 184 |
win.table_settings.columns = win.table_settings.columns.map( |
| 185 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
| 186 |
); |
| 187 |
win.table_settings.columns.find( |
| 188 |
c => c.columnname == "library_code" |
| 189 |
).is_hidden = 1; |
| 190 |
cy.get(`#${table_id} th`).should( |
| 191 |
"have.length", |
| 192 |
win.table_settings.columns.length |
| 193 |
); |
| 194 |
cy.get(`#${table_id} th`).contains("Name"); |
| 195 |
cy.get(`#${table_id} th`).contains("Code"); |
| 196 |
}); |
| 197 |
}); |
| 198 |
}); |
| 67 |
}); |
199 |
}); |
| 68 |
|
200 |
|
| 69 |
describe("Patrons search", () => { |
201 |
describe("Patrons search", () => { |
| 70 |
- |
|
|