Lines 1-64
Link Here
|
1 |
const getVendor = () => { |
|
|
2 |
return { |
3 |
accountnumber: "69823", |
4 |
active: true, |
5 |
address1: "6897 Library Rd", |
6 |
address2: "Springfield, MA 44224", |
7 |
address3: null, |
8 |
address4: null, |
9 |
aliases: [{ alias: "Test alias" }], |
10 |
baskets: [], |
11 |
baskets_count: 0, |
12 |
contacts: [ |
13 |
{ |
14 |
name: "Test contact", |
15 |
position: "Test", |
16 |
email: "test@email.com", |
17 |
phone: "0123456789", |
18 |
notes: "Some interesting notes", |
19 |
altphone: "9876543210", |
20 |
fax: "Who uses fax these days?", |
21 |
acqprimary: false, |
22 |
orderacquisition: false, |
23 |
claimacquisition: false, |
24 |
serialsprimary: false, |
25 |
claimissues: false, |
26 |
}, |
27 |
], |
28 |
deliverytime: 3, |
29 |
discount: 10, |
30 |
external_id: "test1234", |
31 |
fax: "555-555-9999", |
32 |
gst: false, |
33 |
id: 1, |
34 |
interfaces: [ |
35 |
{ |
36 |
type: "interface", |
37 |
name: "fancy website", |
38 |
uri: "www.uri.com", |
39 |
login: "login", |
40 |
password: "password", |
41 |
account_email: "email@email.com", |
42 |
notes: "This is a website", |
43 |
}, |
44 |
], |
45 |
invoice_currency: "USD", |
46 |
invoice_includes_gst: false, |
47 |
invoices_count: 0, |
48 |
list_currency: "USD", |
49 |
list_includes_gst: false, |
50 |
name: "My Vendor", |
51 |
notes: "Sample vendor", |
52 |
phone: "555-555-5555", |
53 |
postal: "567 Main St. PO Box 25 Springfield, MA 44224", |
54 |
subscriptions: [], |
55 |
subscriptions_count: 0, |
56 |
tax_rate: 0.1965, |
57 |
type: "Print books", |
58 |
url: "https://koha-community.org/", |
59 |
}; |
60 |
}; |
61 |
|
62 |
describe("Vendor CRUD operations", () => { |
1 |
describe("Vendor CRUD operations", () => { |
63 |
beforeEach(() => { |
2 |
beforeEach(() => { |
64 |
cy.login(); |
3 |
cy.login(); |
Lines 72-78
describe("Vendor CRUD operations", () => {
Link Here
|
72 |
cy.visit("/cgi-bin/koha/acquisition/vendors"); |
11 |
cy.visit("/cgi-bin/koha/acquisition/vendors"); |
73 |
cy.get("#vendors_list").contains("There are no vendors defined"); |
12 |
cy.get("#vendors_list").contains("There are no vendors defined"); |
74 |
|
13 |
|
75 |
const vendor = getVendor(); |
14 |
const vendor = cy.getVendor(); |
76 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
15 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
77 |
statusCode: 200, |
16 |
statusCode: 200, |
78 |
body: [vendor], |
17 |
body: [vendor], |
Lines 86-92
describe("Vendor CRUD operations", () => {
Link Here
|
86 |
}); |
25 |
}); |
87 |
|
26 |
|
88 |
it("should add a vendor", () => { |
27 |
it("should add a vendor", () => { |
89 |
const vendor = getVendor(); |
28 |
const vendor = cy.getVendor(); |
90 |
|
29 |
|
91 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
30 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
92 |
statusCode: 200, |
31 |
statusCode: 200, |
Lines 180-186
describe("Vendor CRUD operations", () => {
Link Here
|
180 |
}); |
119 |
}); |
181 |
|
120 |
|
182 |
it("should edit a vendor", () => { |
121 |
it("should edit a vendor", () => { |
183 |
const vendor = getVendor(); |
122 |
const vendor = cy.getVendor(); |
184 |
|
123 |
|
185 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
124 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
186 |
statusCode: 200, |
125 |
statusCode: 200, |
Lines 219-225
describe("Vendor CRUD operations", () => {
Link Here
|
219 |
}); |
158 |
}); |
220 |
|
159 |
|
221 |
it("should show a vendor", () => { |
160 |
it("should show a vendor", () => { |
222 |
const vendor = getVendor(); |
161 |
const vendor = cy.getVendor(); |
223 |
|
162 |
|
224 |
// Click the "name" link from the list |
163 |
// Click the "name" link from the list |
225 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
164 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
Lines 249-255
describe("Vendor CRUD operations", () => {
Link Here
|
249 |
}); |
188 |
}); |
250 |
|
189 |
|
251 |
it("should delete a vendor", () => { |
190 |
it("should delete a vendor", () => { |
252 |
const vendor = getVendor(); |
191 |
const vendor = cy.getVendor(); |
253 |
|
192 |
|
254 |
// Delete from list |
193 |
// Delete from list |
255 |
// Click the 'Delete' button from the list |
194 |
// Click the 'Delete' button from the list |