feat(test): 添加dotenv支持并重构测试配置
在.gitignore中添加.env文件 添加dotenv依赖管理环境变量 重构测试用例使用环境变量代替硬编码URL 在playwright配置中加载dotenv并设置baseURL
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// playwright.config.js
|
||||
require('dotenv').config();
|
||||
const { defineConfig } = require('@playwright/test');
|
||||
|
||||
module.exports = defineConfig({
|
||||
@@ -7,6 +8,7 @@ module.exports = defineConfig({
|
||||
name: 'chromium',
|
||||
use: {
|
||||
browserName: 'chromium',
|
||||
baseURL: process.env.BASE_URL || 'http://localhost:3000'
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user