-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdatabase.js
More file actions
55 lines (52 loc) · 1.57 KB
/
database.js
File metadata and controls
55 lines (52 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Cypress.Commands.add("testdbdelete", (table, ids, emails = null) => {
cy.request({
method: "POST",
url: "/ajax.php?file=testdbdelete",
body: {
table: table,
ids: ids,
emails: emails
},
form: true
}).then(response => {
expect(response.status).to.eq(200);
expect(response.body).to.contain("true");
});
});
Cypress.Commands.add("testauth0user", (email) => {
cy.request({
method: "POST",
url: "/ajax.php?file=testauth0user",
body: {
email: email
},
form: true
}).then(response => {
expect(response.status).to.eq(200);
expect(response.body).to.contain("true");
});
});
Cypress.Commands.add("checkHistoryLog", (tablename, recordId, expectedChange) => {
cy.request({
method: "POST",
url: "/ajax.php?file=testhistorycheck",
body: {
tablename: tablename,
record_id: recordId,
expected_change: expectedChange
},
form: true
}).then(response => {
expect(response.status).to.eq(200);
const body = typeof response.body === 'string' ? JSON.parse(response.body) : response.body;
expect(body.found).to.eq(true);
expect(body.count).to.be.greaterThan(0);
});
});
Cypress.Commands.add("getBeneficiaryIdFromRow", (lastname) => {
return cy.getRowWithText(lastname).then($row => {
const id = $row.closest('tr').attr('data-id');
expect(id).to.not.be.undefined;
return parseInt(id);
});
});