-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.js
45 lines (35 loc) · 1.25 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
45
const { defineConfig } = require("cypress");
const { Client } = require("pg");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const addCucumberPreprocessorPlugin = require("@badeball/cypress-cucumber-preprocessor").addCucumberPreprocessorPlugin;
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild").createEsbuildPlugin;
module.exports = defineConfig({
e2e: {
async setupNodeEvents(on, config) {
const bundler = createBundler({
plugins: [createEsbuildPlugin(config)],
});
on("file:preprocessor", bundler);
await addCucumberPreprocessorPlugin(on, config);
// Just change this data based on what you need for your project.
on("task", {
async connectDBPostgreSQL(query){
const client = new Client({
user: "postgres",
password: "123",
host: "localhost",
database: "teste",
ssl: false,
port: 5432
})
await client.connect()
const res = await client.query(query)
await client.end()
return res.rows;
}
})
return config;
},
specPattern:"cypress/e2e/features/**/*.feature"
},
});