-
Notifications
You must be signed in to change notification settings - Fork 16
/
cypress.config.ts
53 lines (51 loc) · 1.78 KB
/
cypress.config.ts
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
import { defineConfig } from "cypress";
import { grantAdminRole, deleteUser } from "./cypress/e2e/contexts/user/tasks";
import { deleteTorrent, deleteTorrentsInfoFromDatabase } from "./cypress/e2e/contexts/torrent/tasks";
import { deleteCategory, addCategory } from "./cypress/e2e/contexts/category/tasks";
import { deleteTags, addTag } from "./cypress/e2e/contexts/tag/tasks";
import type { DatabaseConfig } from "./cypress/e2e/common/database";
function databaseConfig (config: Cypress.PluginConfigOptions): DatabaseConfig {
return {
filepath: config.env.db_file_path
};
}
export default defineConfig({
e2e: {
baseUrl: "http://localhost:3000",
setupNodeEvents (on, config) {
on("task", {
// Category context
deleteCategory: ({ name }) => {
return deleteCategory(name, databaseConfig(config));
},
addCategory: ({ name }) => {
return addCategory(name, databaseConfig(config));
},
// Tag context
deleteTags: () => {
return deleteTags(databaseConfig(config));
},
addTag: ({ name }) => {
return addTag(name, databaseConfig(config));
},
// Torrent context
deleteTorrent: ({ infohash }) => {
return deleteTorrent(infohash, databaseConfig(config));
},
deleteTorrentsInfoFromDatabase: () => {
return deleteTorrentsInfoFromDatabase(databaseConfig(config));
},
// User context
grantAdminRole: ({ username }) => {
return grantAdminRole(username, databaseConfig(config));
},
deleteUser: ({ username }) => {
return deleteUser(username, databaseConfig(config));
}
});
}
},
env: {
db_file_path: "./storage/index/lib/database/e2e_testing_sqlite3.db"
}
});