-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcypress.config.cjs
More file actions
50 lines (42 loc) · 1.39 KB
/
cypress.config.cjs
File metadata and controls
50 lines (42 loc) · 1.39 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
const { defineConfig } = require("cypress");
const { existsSync } = require("fs");
const { generateLogins } = require("./tests/e2e/test-utils.cjs");
const users = new Map();
let baseUrl = process.env.CYPRESS_APP_BASE_URL;
if (existsSync("./cypress.env.json")) {
baseUrl = require("./cypress.env.json").APP_BASE_URL;
}
module.exports = defineConfig({
// This is necessary to handle signup/login scenarios with redirection
chromeWebSecurity: false,
downloadsFolder: "tests/e2e/downloads",
fixturesFolder: "tests/e2e/fixtures",
screenshotsFolder: "tests/e2e/screenshots",
videosFolder: "tests/e2e/videos",
viewportWidth: 1625,
viewportHeight: 728,
e2e: {
supportFile: "tests/e2e/support/index.js",
specPattern: [
// Execute "setup tests" first in order to create test users
"tests/e2e/specs/setup/*.cy.{js,jsx,ts,tsx}",
// Then run all feature tests
"tests/e2e/specs/features/*.cy.{js,jsx,ts,tsx}",
// Finally, execute "teardown tests" to delete users
"tests/e2e/specs/teardown/*.cy.{js,jsx,ts,tsx}"
],
baseUrl,
setupNodeEvents(on) {
on("task", {
"create-user": ({ key, firstname, lastname }) => {
const user = { firstname, lastname, ...generateLogins() };
users.set(key, user);
return user;
},
"get-user": key => {
return users.get(key);
}
});
}
}
});