View | Details | Raw Unified | Return to bug 40067
Collapse All | Expand All

(-)a/t/cypress/integration/Acquisitions/Vendors_spec.ts (-66 / +5 lines)
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
(-)a/t/cypress/integration/Toolbar_spec.ts (+34 lines)
Line 0 Link Here
1
describe("Sticky toolbar", () => {
2
    beforeEach(() => {
3
        cy.login();
4
        cy.title().should("eq", "Koha staff interface");
5
    });
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
        });
19
        cy.visit("/cgi-bin/koha/acquisition/vendors");
20
        cy.intercept(
21
            "GET",
22
            new RegExp("/api/v1/acquisitions/vendors/(?!config$).+"),
23
            vendor
24
        ).as("get-vendor");
25
26
        const name_link = cy.get(
27
            "#vendors_list table tbody tr:first td:first a"
28
        );
29
        name_link.click();
30
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
31
        cy.get("#toolbar a").contains("Receive shipments").click();
32
        cy.get("h1").contains("Receive shipment from vendor " + vendor.name);
33
    });
34
});
(-)a/t/cypress/support/e2e.js (-1 / +61 lines)
Lines 1813-1818 cy.getSushiService = () => { Link Here
1813
    };
1813
    };
1814
};
1814
};
1815
1815
1816
cy.getVendor = () => {
1817
    return {
1818
        accountnumber: "69823",
1819
        active: true,
1820
        address1: "6897 Library Rd",
1821
        address2: "Springfield, MA 44224",
1822
        address3: null,
1823
        address4: null,
1824
        aliases: [{ alias: "Test alias" }],
1825
        baskets: [],
1826
        baskets_count: 0,
1827
        contacts: [
1828
            {
1829
                name: "Test contact",
1830
                position: "Test",
1831
                email: "test@email.com",
1832
                phone: "0123456789",
1833
                notes: "Some interesting notes",
1834
                altphone: "9876543210",
1835
                fax: "Who uses fax these days?",
1836
                acqprimary: false,
1837
                orderacquisition: false,
1838
                claimacquisition: false,
1839
                serialsprimary: false,
1840
                claimissues: false,
1841
            },
1842
        ],
1843
        deliverytime: 3,
1844
        discount: 10,
1845
        external_id: "test1234",
1846
        fax: "555-555-9999",
1847
        gst: false,
1848
        id: 1,
1849
        interfaces: [
1850
            {
1851
                type: "interface",
1852
                name: "fancy website",
1853
                uri: "www.uri.com",
1854
                login: "login",
1855
                password: "password",
1856
                account_email: "email@email.com",
1857
                notes: "This is a website",
1858
            },
1859
        ],
1860
        invoice_currency: "USD",
1861
        invoice_includes_gst: false,
1862
        invoices_count: 0,
1863
        list_currency: "USD",
1864
        list_includes_gst: false,
1865
        name: "My Vendor",
1866
        notes: "Sample vendor",
1867
        phone: "555-555-5555",
1868
        postal: "567 Main St. PO Box 25 Springfield, MA 44224",
1869
        subscriptions: [],
1870
        subscriptions_count: 0,
1871
        tax_rate: 0.1965,
1872
        type: "Print books",
1873
        url: "https://koha-community.org/",
1874
    };
1875
};
1876
1816
const mysql = require("cypress-mysql");
1877
const mysql = require("cypress-mysql");
1817
mysql.addCommands();
1878
mysql.addCommands();
1818
1879
1819
- 

Return to bug 40067