try transfering config to ts(but import is failing)

This commit is contained in:
Annie Huang committed 2024-02-27 00:12:07 +08:00
1 parent 0a730e4eef
commit 004d232a84
2 files changed
+11 -21

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
const { defineConfig } = require('cypress')
const process = require('process')
const dotenv = require('dotenv')
const fs = require('fs')
dotenv.config({ path: '../.env.dev' })
dotenv.config({ path: '../.env' })
const getConfig = (key, defaultValue) => {
return process.env[key] || defaultValue
}
const getOrFail = (key) => {
const value = getConfig(key, null)
if (value === null) {
throw new Error(`Missing required environment variable ${key}`)
}
return value
}
const EnableoAuth = fs.existsSync('../.env')
module.exports = defineConfig({
e2e: {
baseUrl: getConfig('BASE_URL', 'http://localhost:5173'),
viewportWidth: 1920,
viewportHeight: 1080,
pageLoadTimeout: 120000,
redirectionLimit: 20,
defaultCommandTimeout: 10000,
retries: { runMode: 5, openMode: 5 },
},
env: {
defaultAccount: getOrFail('TESTING_USERNAME'),
defaultPassword: getOrFail('TESTING_PASSWORD'),
isCHVersion: true,
EnableoAuth,
},
})