mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add testing setup in backend
This commit is contained in:
1 parent
cb376caff0
commit
1f77328362
15 files changed
+92
-100
No files matched your search
@@ -0,0 +1,9 @@
|
||||
FROM cypress/included:13.5.1
|
||||
|
||||
WORKDIR /e2e
|
||||
COPY package.json yarn.lock ./
|
||||
COPY tests/package.json ./tests/package.json
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
COPY tests ./tests
|
||||
WORKDIR /e2e/tests
|
||||
+11
-4
@@ -1,11 +1,19 @@
|
||||
const { defineConfig } = require('cypress')
|
||||
const process = require('process')
|
||||
require('dotenv').config()
|
||||
require('dotenv').config({ path: '../.env' })
|
||||
|
||||
const getConfig = (key, defaultValue) => {
|
||||
return process.env[key] || defaultValue
|
||||
}
|
||||
|
||||
const getOrFail = (key) => {
|
||||
const value = getConfig(key)
|
||||
if (!value) {
|
||||
throw new Error(`Missing required environment variable ${key}`)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
baseUrl: getConfig('BASE_URL', 'http://localhost:5173'),
|
||||
@@ -14,9 +22,8 @@ module.exports = defineConfig({
|
||||
pageLoadTimeout: 120000,
|
||||
},
|
||||
env: {
|
||||
...process.env,
|
||||
defaultAccount: process.env.default_USERNAME,
|
||||
defaultPassword: process.env.default_PASSWORD,
|
||||
defaultAccount: getOrFail('TESTING_USERNAME'),
|
||||
defaultPassword: getOrFail('TESTING_PASSWORD'),
|
||||
// google_username: process.env.GOOGLE_USERNAME,
|
||||
// google_password: process.env.GOOGLE_PASSWORD,
|
||||
// google_client_id: process.env.GOOGLE_CLIENT_ID,
|
||||
|
||||
+4
-7
@@ -5,15 +5,12 @@
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "cypress run"
|
||||
"test": "cypress run",
|
||||
"test:open": "cypress open"
|
||||
},
|
||||
"dependencies": {
|
||||
"cypress": "^13.2.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"save": "^2.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cypress": "^13.5.0",
|
||||
"@testing-library/cypress": "^10.0.1",
|
||||
"cypress": "^13.5.0"
|
||||
"dotenv": "^16.3.1"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user