forked from Stand-With-Crypto/swc-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.ts
57 lines (53 loc) · 1.25 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
54
55
56
57
import { defineConfig } from 'cypress'
import { prismaClient } from '@/utils/server/prismaClient'
export default defineConfig({
projectId: process.env.CYPRESS_PROJECT_ID,
// iPhone 12 Pro resolution
viewportWidth: 390,
viewportHeight: 844,
defaultCommandTimeout: 10000,
retries: {
experimentalStrategy: 'detect-flake-and-pass-on-threshold',
experimentalOptions: {
maxRetries: 7,
passesRequired: 2,
},
openMode: true,
runMode: true,
},
e2e: {
env: {
SWC_INTERNAL_ENDPOINTS_SECRET: process.env.SWC_INTERNAL_ENDPOINTS_SECRET,
USER_COUNTRY_CODE: 'US',
},
baseUrl: 'http://localhost:3000',
setupNodeEvents(on) {
on('task', {
executeDb: query => {
return executeDbWithPrisma(query)
},
queryDb: query => {
return queryDbWithPrisma(query)
},
})
},
},
})
/**
* Use this function for mutations (INSERT, UPDATE, DELETE, etc.).
*
* @param query
* @returns
*/
async function executeDbWithPrisma(query: string) {
return await prismaClient.$executeRawUnsafe(query)
}
/**
* Use this function for SELECT.
*
* @param query
* @returns
*/
async function queryDbWithPrisma(query: string) {
return await prismaClient.$queryRawUnsafe(query)
}