mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
feat: cypress accept baseUrl from env
This commit is contained in:
1 parent
94e8940369
commit
a6ffd6b037
4 files changed
+12
-5
No files matched your search
@@ -20,6 +20,7 @@
|
|||||||
"lint": "eslint --ext .js,.vue .",
|
"lint": "eslint --ext .js,.vue .",
|
||||||
"format": "prettier --ignore-path .prettierignore --write app server",
|
"format": "prettier --ignore-path .prettierignore --write app server",
|
||||||
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
|
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
|
||||||
|
"test:e2e": "yarn workspace tests test",
|
||||||
"clean": "yarn workspace server clean"
|
"clean": "yarn workspace server clean"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
const { defineConfig } = require('cypress')
|
const { defineConfig } = require('cypress')
|
||||||
|
const process = require('process')
|
||||||
|
|
||||||
|
const getConfig = (key, defaultValue) => {
|
||||||
|
return process.env[key] || defaultValue
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
setupNodeEvents(on, config) {
|
baseUrl: getConfig('BASE_URL', 'http://localhost:5173'),
|
||||||
// implement node event listeners here
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('example helloworld app', () => {
|
describe('example helloworld app', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.visit('http://localhost:5173')
|
cy.visit('/')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('open login page', () => {
|
it('open login page', () => {
|
||||||
|
|||||||
+4
-1
@@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "e2e",
|
"name": "tests",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"test": "cypress run"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cypress": "^13.2.0"
|
"cypress": "^13.2.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user