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

(-)a/t/cypress/integration/DataTest_spec.ts (-1 / +70 lines)
Line 0 Link Here
0
- 
1
import { mount } from "@cypress/vue";
2
3
describe("Test data", () => {
4
    beforeEach(() => {
5
        cy.login();
6
        cy.title().should("eq", "Koha staff interface");
7
    });
8
9
    it("should create an object based on passed data", () => {
10
        const testPatronData = {
11
            firstname: "Cypress",
12
            surname: "Test",
13
        };
14
15
        cy.buildObject("Koha::Patrons", testPatronData);
16
        cy.query(
17
            "SELECT firstname, surname FROM borrowers WHERE firstname=?",
18
            "Cypress"
19
        ).then(result => {
20
            expect(result[0].surname).to.equal("Test");
21
        });
22
        cy.deleteDbRow("Koha::Patrons", testPatronData);
23
    });
24
25
    it("should create an object when no data values are passed", () => {
26
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
27
            expect(result[0].count).to.equal(53);
28
        });
29
        cy.buildObject("Koha::Patrons");
30
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
31
            expect(result[0].count).to.equal(54);
32
        });
33
        cy.deleteDbRow("Koha::Patrons", null, 1);
34
    });
35
36
    it("should cleanup the new database rows when the 'numberofRows' parameter is passed", () => {
37
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
38
            expect(result[0].count).to.equal(53);
39
        });
40
        cy.buildObject("Koha::Patrons");
41
        cy.buildObject("Koha::Patrons");
42
        cy.buildObject("Koha::Patrons");
43
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
44
            expect(result[0].count).to.equal(56);
45
        });
46
        cy.deleteDbRow("Koha::Patrons", null, 3);
47
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
48
            expect(result[0].count).to.equal(53);
49
        });
50
    });
51
52
    it("should cleanup the new database rows when the 'deleteParameters' parameter is passed", () => {
53
        const testPatronData = {
54
            firstname: "Cypress",
55
            surname: "Test",
56
        };
57
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
58
            expect(result[0].count).to.equal(53);
59
        });
60
        cy.buildObject("Koha::Patrons", testPatronData);
61
62
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
63
            expect(result[0].count).to.equal(54);
64
        });
65
        cy.deleteDbRow("Koha::Patrons", testPatronData);
66
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
67
            expect(result[0].count).to.equal(53);
68
        });
69
    });
70
});

Return to bug 36607