forked from graphql-hive/console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.ts
34 lines (33 loc) · 1.14 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
// eslint-disable-next-line import/no-extraneous-dependencies -- cypress SHOULD be a dev dependency
import { defineConfig } from 'cypress';
// eslint-disable-next-line import/no-extraneous-dependencies
import pg from 'pg';
export default defineConfig({
video: false, // TODO: can it be useful for CI?
screenshotOnRunFailure: false, // TODO: can it be useful for CI?
defaultCommandTimeout: 8000, // sometimes the app takes longer to load, especially in the CI
env: {
POSTGRES_URL: 'postgresql://postgres:postgres@localhost:5432/registry',
},
e2e: {
setupNodeEvents(on, config) {
on('task', {
async connectDB(query: string) {
const dbUrl = new URL(config.env.POSTGRES_URL);
const client = new pg.Client({
user: dbUrl.username,
password: dbUrl.password,
host: dbUrl.hostname,
database: dbUrl.pathname.slice(1),
port: Number(dbUrl.port),
ssl: false,
});
await client.connect();
const res = await client.query(query);
await client.end();
return res.rows;
},
});
},
},
});