-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.js
44 lines (40 loc) · 1.08 KB
/
cypress.config.js
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
const { defineConfig } = require("cypress");
module.exports = defineConfig({
env: {
MAILOSAUR_API_KEY: "00aFft9D0JHFaMhJ",
"db": {
"host": "localhost",
"user": "root",
"password": "rootpassword"
},
},
defaultCommandTimeout: 10000,
viewportWidth: 1280,
projectId: "thrjkc",
e2e: {
baseUrl: "https://stage.backendless.com",
chromeWebSecurity: false,
setupNodeEvents(on, config) {
on("task", {
queryDb: (query) => {
return queryTestDb(query, config);
},
});
},
}
})
const mysql = require("mysql");
function queryTestDb(query, config) {
const connection = mysql.createConnection(config.env.db);
connection.connect();
return new Promise((resolve, reject) => {
connection.query(query, (error, results) => {
if (error) {
reject(error);
} else {
connection.end();
return resolve(results);
}
});
});
}