标签:puppet sel url query ram 变量 puppeteer 时间 global
page.emulate() 指定设备
jest.config.js module.exports = { preset: ‘jest-puppeteer‘, //调用preset // globals: _.assign({}, config.get(‘e2e‘), { //这里可以注入全局变量 // ENV_URL: config.get(‘baseUrl‘) // }), testMatch: [‘**/test/*.test.js?(x)‘] //指定需要进行测试的文件 }
jest-puppeteer.config.js const port = process.env.TEST_SERVER_PORT ? Number(process.env.TEST_SERVER_PORT) : 4444 // console.log(port) process.env.TEST_SERVER_PORT = port module.exports = { launch: { headless: process.env.CI === ‘true‘, }, browserContext: process.env.INCOGNITO ? ‘incognito‘ : ‘default‘, server: { command: `cross-env PORT=${port} node test`, port, launchTimeout: 100000, }, }
命令行 npm run test "test": "cross-env INCOGNITO=true jest -c jest.config.js --notify --detectOpenHandles",
const path = require(‘path‘) const express = require(‘express‘) const app = express() app.use(express.static(path.join(__dirname, ‘static‘))) console.log(process.env.PORT) app.listen(process.env.PORT)
标签:puppet sel url query ram 变量 puppeteer 时间 global
原文地址:https://www.cnblogs.com/yiyi17/p/10705931.html