Line 0
Link Here
|
0 |
- |
1 |
import { mount } from "@cypress/vue"; |
|
|
2 |
const dayjs = require("dayjs"); /* Cannot use our calendar JS code, it's in an include file (!) |
3 |
Also note that moment.js is deprecated */ |
4 |
|
5 |
describe("Breadcrumbs tests", () => { |
6 |
beforeEach(() => { |
7 |
cy.login(); |
8 |
cy.title().should("eq", "Koha staff interface"); |
9 |
}); |
10 |
|
11 |
it("Breadcrumbs", () => { |
12 |
cy.visit("/cgi-bin/koha/admin/admin-home.pl"); |
13 |
cy.contains("Record sources").click(); |
14 |
cy.get("#breadcrumbs").contains("Administration"); |
15 |
cy.get(".item-last").contains("Record sources"); |
16 |
// use the 'New' button |
17 |
cy.contains("New record source").click(); |
18 |
cy.wait(500); |
19 |
cy.get(".item-last").contains("Add record source"); |
20 |
cy.get("#breadcrumbs") |
21 |
.contains("Record sources") |
22 |
.should("have.attr", "href") |
23 |
.and("equal", "/cgi-bin/koha/admin/record-sources"); |
24 |
}); |
25 |
}); |
26 |
|
27 |
describe("Record sources CRUD tests", () => { |
28 |
beforeEach(() => { |
29 |
cy.login(); |
30 |
cy.title().should("eq", "Koha staff interface"); |
31 |
}); |
32 |
|
33 |
it("Add", () => { |
34 |
cy.visit("/cgi-bin/koha/admin/admin-home.pl"); |
35 |
cy.contains("Record sources").click(); |
36 |
// use the 'New' button |
37 |
cy.contains("New record source").click(); |
38 |
// fill the form |
39 |
cy.get("#name").type("Poop"); |
40 |
|
41 |
// Submit the form, get 500 |
42 |
cy.intercept("POST", "/api/v1/record_sources", { |
43 |
statusCode: 201, |
44 |
body: {} |
45 |
}); |
46 |
cy.get("#record_source_edit").contains("Submit").click(); |
47 |
}); |
48 |
|
49 |
it("Edit", () => { |
50 |
cy.visit("/cgi-bin/koha/admin/admin-home.pl"); |
51 |
cy.contains("Record sources").click(); |
52 |
cy.get("#breadcrumbs").contains("Administration"); |
53 |
cy.get(".item-last").contains("Record sources"); |
54 |
}); |
55 |
|
56 |
it("List", () => { |
57 |
cy.visit("/cgi-bin/koha/admin/admin-home.pl"); |
58 |
cy.contains("Record sources").click(); |
59 |
cy.get("#breadcrumbs").contains("Administration"); |
60 |
cy.get(".item-last").contains("Record sources"); |
61 |
}); |
62 |
|
63 |
it("Delete", () => { |
64 |
cy.visit("/cgi-bin/koha/admin/admin-home.pl"); |
65 |
cy.contains("Record sources").click(); |
66 |
cy.get("#breadcrumbs").contains("Administration"); |
67 |
cy.get(".item-last").contains("Record sources"); |
68 |
}); |
69 |
}); |