forked from CodeYourFuture/tech-products-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.js
39 lines (34 loc) · 988 Bytes
/
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
require("dotenv-expand/config");
const { defineConfig } = require("cypress");
const { clearDb, closeConnection, seed } = require("./e2e/db");
module.exports = defineConfig({
downloadsFolder: "e2e/downloads",
e2e: {
baseUrl: "http://localhost:4201",
async setupNodeEvents(on, config) {
loadEnvVars(config.env);
on("after:run", () => closeConnection());
on("task", { clearDb, seed, table });
return config;
},
specPattern: "e2e/integration/**/*.test.js",
supportFile: "e2e/support/index.js",
},
fixturesFolder: "e2e/fixtures",
screenshotsFolder: "e2e/screenshots",
video: false,
videosFolder: "e2e/videos",
});
function loadEnvVars(env, prefix = "CYPRESS_") {
const updates = Object.fromEntries(
Object.entries(process.env)
.filter(([key]) => key.startsWith(prefix))
.map(([key, value]) => [key.slice(prefix.length), value])
);
console.table(updates);
Object.assign(env, updates);
}
function table(data) {
console.table(data);
return null;
}