refactor: organize source web and tests by business module
This commit is contained in:
1 parent
9854d2d5c2
commit
2aed328774
113 files changed
+189
-183
No files matched your search
@@ -1,24 +0,0 @@
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
function loadPlaywright() {
|
||||
const candidates = [
|
||||
'playwright-core',
|
||||
process.env.ORDER_PLAYWRIGHT_MODULE,
|
||||
path.join(os.homedir(), '.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright-core')
|
||||
].filter(Boolean);
|
||||
for (const candidate of candidates) {
|
||||
try { return require(candidate); } catch (error) { if (error.code !== 'MODULE_NOT_FOUND') throw error; }
|
||||
}
|
||||
throw new Error('缺少 playwright-core,请先运行 npm install。');
|
||||
}
|
||||
function browserOptions() {
|
||||
const candidates = [process.env.ORDER_CHROME_PATH,
|
||||
process.env.PROGRAMFILES && path.join(process.env.PROGRAMFILES, 'Google/Chrome/Application/chrome.exe'),
|
||||
process.env['PROGRAMFILES(X86)'] && path.join(process.env['PROGRAMFILES(X86)'], 'Google/Chrome/Application/chrome.exe'),
|
||||
process.env.LOCALAPPDATA && path.join(process.env.LOCALAPPDATA, 'Google/Chrome/Application/chrome.exe')].filter(Boolean);
|
||||
const executablePath = candidates.find(candidate => fs.existsSync(candidate));
|
||||
return executablePath ? { executablePath, headless: true } : { channel: 'chrome', headless: true };
|
||||
}
|
||||
module.exports = { loadPlaywright, browserOptions };
|
||||
Reference in new issue
Block a user