Lines 1-39
Link Here
|
1 |
describe("Sticky toolbar", () => { |
1 |
describe("Sticky toolbar - basic behavior", () => { |
2 |
beforeEach(() => { |
2 |
beforeEach(() => { |
3 |
cy.login(); |
3 |
cy.login(); |
4 |
cy.title().should("eq", "Koha staff interface"); |
4 |
cy.title().should("eq", "Koha staff interface"); |
5 |
}); |
5 |
}); |
6 |
|
6 |
|
7 |
it("Should open non-Vue links correctly in the same tab", () => { |
|
|
8 |
const vendor = cy.getVendor(); |
9 |
vendor.baskets_count = 1; |
10 |
// Click the "name" link from the list |
11 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
12 |
statusCode: 200, |
13 |
body: [vendor], |
14 |
headers: { |
15 |
"X-Base-Total-Count": "1", |
16 |
"X-Total-Count": "1", |
17 |
}, |
18 |
}).as("get-vendors"); |
19 |
cy.intercept( |
20 |
"GET", |
21 |
new RegExp("/api/v1/acquisitions/vendors/(?!config$).+"), |
22 |
vendor |
23 |
).as("get-vendor"); |
24 |
|
25 |
cy.visit("/cgi-bin/koha/acquisition/vendors"); |
26 |
cy.wait("@get-vendors"); |
27 |
|
28 |
const name_link = cy.get( |
29 |
"#vendors_list table tbody tr:first td:first a" |
30 |
); |
31 |
name_link.click(); |
32 |
cy.wait("@get-vendor"); |
33 |
cy.get("#toolbar a").contains("Receive shipments").click(); |
34 |
cy.get("h1").contains("Receive shipment from vendor " + vendor.name); |
35 |
}); |
36 |
|
37 |
it("Should stick on scroll", () => { |
7 |
it("Should stick on scroll", () => { |
38 |
cy.visit("/cgi-bin/koha/acqui/acqui-home.pl"); |
8 |
cy.visit("/cgi-bin/koha/acqui/acqui-home.pl"); |
39 |
|
9 |
|
Lines 46-48
describe("Sticky toolbar", () => {
Link Here
|
46 |
cy.get("#toolbar").should("not.have.class", "floating"); |
16 |
cy.get("#toolbar").should("not.have.class", "floating"); |
47 |
}); |
17 |
}); |
48 |
}); |
18 |
}); |
|
|
19 |
|
20 |
describe("Sticky toolbar - vendors", () => { |
21 |
beforeEach(() => { |
22 |
cy.login(); |
23 |
cy.title().should("eq", "Koha staff interface"); |
24 |
|
25 |
cy.task("buildSampleObject", { |
26 |
object: "vendor", |
27 |
values: { active: 1 }, |
28 |
}) |
29 |
.then(generatedVendor => { |
30 |
delete generatedVendor.list_currency; |
31 |
delete generatedVendor.invoice_currency; |
32 |
return cy.task("insertObject", { |
33 |
type: "vendor", |
34 |
object: generatedVendor, |
35 |
}); |
36 |
}) |
37 |
.then(vendor => { |
38 |
cy.wrap(vendor).as("vendor"); |
39 |
return cy.task("buildSampleObject", { |
40 |
object: "basket", |
41 |
values: { vendor_id: vendor.id }, |
42 |
}); |
43 |
}) |
44 |
.then(generatedBasket => { |
45 |
return cy.task("insertObject", { |
46 |
type: "basket", |
47 |
object: generatedBasket, |
48 |
}); |
49 |
}) |
50 |
.then(basket => { |
51 |
cy.wrap(basket).as("basket"); |
52 |
}); |
53 |
}); |
54 |
afterEach(function () { |
55 |
cy.task("deleteSampleObjects", [ |
56 |
{ vendor: this.vendor, basket: this.basket }, |
57 |
]); |
58 |
}); |
59 |
it("Should open non-Vue links correctly in the same tab", function () { |
60 |
cy.visit(`/cgi-bin/koha/acquisition/vendors/${this.vendor.id}`); |
61 |
|
62 |
cy.get("#toolbar a").contains("Receive shipments").click(); |
63 |
cy.get("h1").contains( |
64 |
`Receive shipment from vendor ${this.vendor.name}` |
65 |
); |
66 |
}); |
67 |
}); |