Line 0
Link Here
|
0 |
- |
1 |
describe("Acquisitions menu", () => { |
|
|
2 |
beforeEach(() => { |
3 |
cy.login(); |
4 |
cy.title().should("eq", "Koha staff interface"); |
5 |
|
6 |
cy.set_syspref("EDIFACT", 0); |
7 |
cy.set_syspref("MarcOrderingAutomation", 0); |
8 |
cy.visit("/cgi-bin/koha/acqui/acqui-home.pl"); |
9 |
}); |
10 |
|
11 |
it("Should render a left menu", () => { |
12 |
cy.get(".sidebar_menu").should("be.visible"); |
13 |
cy.get(".sidebar_menu a").should("have.length", 14); |
14 |
}); |
15 |
|
16 |
it("Should show/hide links based on sysprefs", () => { |
17 |
cy.set_syspref("EDIFACT", 1).then(() => { |
18 |
cy.reload(true); |
19 |
cy.get(".sidebar_menu a").should("have.length", 17); |
20 |
}); |
21 |
}); |
22 |
|
23 |
it("Should show/hide links based on permissions", () => { |
24 |
cy.get(".sidebar_menu").should("be.visible"); |
25 |
|
26 |
cy.query( |
27 |
"UPDATE borrowers SET flags=2052 WHERE borrowernumber=51" |
28 |
).then(() => { |
29 |
cy.reload(true); |
30 |
cy.get(".sidebar_menu a").should("have.length", 8); |
31 |
cy.query("UPDATE borrowers SET flags=1 WHERE borrowernumber=51"); |
32 |
}); |
33 |
}); |
34 |
it("Should correctly apply the 'current' class", () => { |
35 |
cy.get(".sidebar_menu").should("be.visible"); |
36 |
|
37 |
cy.get(".sidebar_menu a") |
38 |
.contains("Acquisitions home") |
39 |
.should("have.class", "current"); |
40 |
cy.get(".sidebar_menu a").contains("Budgets").click(); |
41 |
cy.get(".sidebar_menu a") |
42 |
.contains("Budgets") |
43 |
.should("have.class", "current"); |
44 |
}); |
45 |
}); |