change e2e to use node module

This commit is contained in:
wancat committed 2024-02-08 17:40:01 +08:00
1 parent f797f4d897
commit c06d6d6deb
7 files changed
+27 -11

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
TESTING=true
TESTING_USERNAME=alex
TESTING_PASSWORD=Alex1234
SECRET_KEY=b1d2e917-17b9-4fce-9055-082dee6ec5d6
+2 -2
View File
@@ -6,8 +6,8 @@ services:
dockerfile: tests/Dockerfile
networks:
- internal
volumes:
- ./tests:/e2e/tests
# volumes:
# - ./tests:/e2e/tests
environment:
- BASE_URL=http://app-test
- TESTING_USERNAME=alex
+1 -1
View File
@@ -9,7 +9,7 @@
"setup": "node dist/cli/setup.js",
"clean": "node dist/cli/clean.js",
"build": "tsc",
"watch": "concurrently \"tsc -w\" \"nodemon\"",
"watch": "concurrently \"nodemon\" \"tsc -w\"",
"build:quests": "node dist/cli/build.js"
},
"dependencies": {
+5
View File
@@ -4,6 +4,9 @@ import { get } from './utils/env.js'
// Import dotenv and load ../.env
dotenv.config({ path: '../.env' })
if (process.env.NODE_ENV !== 'production') {
dotenv.config({ path: '../.env.dev' })
}
function getTrustProxies(key) {
if (!process.env[key]) {
@@ -68,4 +71,6 @@ export function getQuestImage(id) {
return `${config.docker.imagePrefix}${id}`
}
console.log(config)
export default config
+5 -2
View File
@@ -1,10 +1,13 @@
FROM cypress/included:13.5.1
FROM cypress/browsers:node-20.11.0-chrome-121.0.6167.85-1-ff-120.0-edge-121.0.2277.83-1
WORKDIR /e2e
RUN yarn set version stable
COPY package.json yarn.lock ./
COPY tests/package.json ./tests/package.json
RUN yarn install --frozen-lockfile
RUN yarn config set -H enableImmutableInstalls false
RUN yarn install
COPY quests ./quests
COPY tests ./tests
WORKDIR /e2e/tests
CMD [ "yarn", "test:e2e" ]
@@ -1,6 +1,9 @@
const { defineConfig } = require('cypress')
const process = require('process')
require('dotenv').config({ path: '../.env' })
import { defineConfig } from 'cypress'
import process from 'process'
import dotenv from 'dotenv'
dotenv.config({ path: '../.env.dev' })
dotenv.config({ path: '../.env' })
const getConfig = (key, defaultValue) => {
return process.env[key] || defaultValue
@@ -14,7 +17,7 @@ const getOrFail = (key) => {
return value
}
module.exports = defineConfig({
export default defineConfig({
e2e: {
baseUrl: getConfig('BASE_URL', 'http://localhost:5173'),
viewportWidth: 1920,
+3 -2
View File
@@ -3,10 +3,11 @@
"version": "1.0.0",
"private": true,
"main": "index.js",
"type": "module",
"license": "MIT",
"scripts": {
"test": "TESTING_USERNAME=alex TESTING_PASSWORD=Alex1234 cypress run",
"test:open": "TESTING_USERNAME=alex TESTING_PASSWORD=Alex1234 cypress open"
"test": "yarn cypress run",
"test:open": "yarn cypress open"
},
"dependencies": {
"@testing-library/cypress": "^10.0.1",