feat: cypress accept baseUrl from env

This commit is contained in:
Lin, Hung-Shin committed 2023-09-28 13:27:46 +08:00
1 parent 94e8940369
commit a6ffd6b037
4 files changed
+12 -5

No files matched your search

+6 -3
View File
@@ -1,9 +1,12 @@
const { defineConfig } = require('cypress')
const process = require('process')
const getConfig = (key, defaultValue) => {
return process.env[key] || defaultValue
}
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: getConfig('BASE_URL', 'http://localhost:5173'),
},
})
+1 -1
View File
@@ -1,7 +1,7 @@
/// <reference types="cypress" />
describe('example helloworld app', () => {
beforeEach(() => {
cy.visit('http://localhost:5173')
cy.visit('/')
})
it('open login page', () => {
+4 -1
View File
@@ -1,9 +1,12 @@
{
"name": "e2e",
"name": "tests",
"version": "1.0.0",
"private": true,
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "cypress run"
},
"dependencies": {
"cypress": "^13.2.0"
}