Compare commits

...

3 Commits

Author SHA1 Message Date
zhanjunhao 1a943465ec chore(merge): merge ui-optimization into weiyuan 2026-11-13 16:38:35 +08:00
zhanjunhao 1ca241ee57 chore(merge): merge ui-optimization into weiyuan 2026-11-11 13:02:39 +08:00
qiubaishen b80afd273c feat(org): expose enterprise drawing and task logs 2026-11-06 19:06:09 +08:00
+48 -15
View File
@@ -27,21 +27,45 @@ if (target === 'remote' && !process.env.PW_BASE_URL) {
throw new Error('PW_BASE_URL is required for remote tests'); throw new Error('PW_BASE_URL is required for remote tests');
} }
const baseURL = new URL(process.env.PW_BASE_URL || 'http://127.0.0.1:4175/'); const baseURL = new URL(process.env.PW_BASE_URL || 'http://127.0.0.1:4175/');
if (!['http:', 'https:'].includes(baseURL.protocol) || baseURL.username || baseURL.password || baseURL.search || baseURL.hash) { if (
throw new Error('PW_BASE_URL must be an HTTP(S) URL without credentials, query or hash'); !['http:', 'https:'].includes(baseURL.protocol) ||
baseURL.username ||
baseURL.password ||
baseURL.search ||
baseURL.hash
) {
throw new Error(
'PW_BASE_URL must be an HTTP(S) URL without credentials, query or hash',
);
} }
if (!baseURL.pathname.endsWith('/')) throw new Error('PW_BASE_URL directory path must end with /'); if (!baseURL.pathname.endsWith('/'))
if (target !== 'remote' && (baseURL.hostname !== '127.0.0.1' || baseURL.protocol !== 'http:' || baseURL.pathname !== '/')) { throw new Error('PW_BASE_URL directory path must end with /');
if (
target !== 'remote' &&
(baseURL.hostname !== '127.0.0.1' ||
baseURL.protocol !== 'http:' ||
baseURL.pathname !== '/')
) {
throw new Error('Local targets require http://127.0.0.1:<port>/'); throw new Error('Local targets require http://127.0.0.1:<port>/');
} }
const isCI = Boolean(process.env.CI && process.env.CI !== 'false'); const isCI = Boolean(process.env.CI && process.env.CI !== 'false');
const headless = process.env.PW_HEADLESS === undefined ? isCI : process.env.PW_HEADLESS === '1'; const headless =
process.env.PW_HEADLESS === undefined
? isCI
: process.env.PW_HEADLESS === '1';
const viewports = [ const viewports = [
['desktop', 1920, 1080], ['desktop', 1920, 1080],
['mobile', 360, 800], ['mobile', 360, 800],
]; ];
if (process.env.PW_EXTENDED_LAYOUT === '1') { if (process.env.PW_EXTENDED_LAYOUT === '1') {
viewports.push(['tablet', 768, 1024], ['desktop-boundary', 1024, 768], ['laptop-hd', 1366, 768], ['laptop-wxga', 1440, 900], ['qhd', 2560, 1440], ['uhd', 3840, 2160]); viewports.push(
['tablet', 768, 1024],
['desktop-boundary', 1024, 768],
['laptop-hd', 1366, 768],
['laptop-wxga', 1440, 900],
['qhd', 2560, 1440],
['uhd', 3840, 2160],
);
} }
export default defineConfig({ export default defineConfig({
@@ -60,7 +84,12 @@ export default defineConfig({
['html', { outputFolder: 'playwright-report', open: 'never' }], ['html', { outputFolder: 'playwright-report', open: 'never' }],
...(isCI ? [['junit', { outputFile: 'test-results/junit.xml' }]] : []), ...(isCI ? [['junit', { outputFile: 'test-results/junit.xml' }]] : []),
], ],
metadata: { platform: process.platform, node: process.version, target, baseURL: baseURL.href }, metadata: {
platform: process.platform,
node: process.version,
target,
baseURL: baseURL.href,
},
use: { use: {
baseURL: baseURL.href, baseURL: baseURL.href,
headless, headless,
@@ -90,12 +119,16 @@ export default defineConfig({
viewport: { width, height }, viewport: { width, height },
}, },
})), })),
webServer: target === 'remote' ? undefined : { webServer:
command: target === 'local-dist' target === 'remote'
? `npm run preview -- --host 127.0.0.1 --port ${baseURL.port || 80}` ? undefined
: `npm run dev -- --host 127.0.0.1 --port ${baseURL.port || 80} --strictPort`, : {
url: baseURL.href, command:
reuseExistingServer: false, target === 'local-dist'
timeout: 30000, ? `npm run preview -- --host 127.0.0.1 --port ${baseURL.port || 80}`
}, : `npm run dev -- --host 127.0.0.1 --port ${baseURL.port || 80} --strictPort`,
url: baseURL.href,
reuseExistingServer: false,
timeout: 30000,
},
}); });