ci: re-handle url

This commit is contained in:
taian.lta 2024-07-30 08:15:14 +08:00 committed by vagusX
parent fc428073b5
commit ebc5328b95

View File

@ -23,12 +23,10 @@ const themes = ['default', 'dark', 'compact'];
async function retrieveDemoUrl(mdPath: string) { async function retrieveDemoUrl(mdPath: string) {
// ~demos/button-demo-basic // ~demos/button-demo-basic
// breadcrumb-withIcon -> ~demos/breadcrumb-demo-withicon
return mdPath return mdPath
.replace(/^components\//, '') .replace(/^components\//, '')
.replace('.md', '') .replace('.md', '')
.replace(/\//g, '-') .replace(/\//g, '-');
.toLowerCase();
} }
async function retrieveConfig(mdPath: string): Promise<VisualDiffConfig> { async function retrieveConfig(mdPath: string): Promise<VisualDiffConfig> {
@ -128,7 +126,8 @@ class BrowserAuto {
query.set('enable-css-var', '1'); query.set('enable-css-var', '1');
} }
const pageUrl = `http://localhost:${port}/~demos/${demoUrl}?${query.toString()}`; // breadcrumb-withIcon -> ~demos/breadcrumb-demo-withicon
const pageUrl = `http://localhost:${port}/~demos/${demoUrl.toLowerCase()}?${query.toString()}`;
await page.goto(pageUrl); await page.goto(pageUrl);
// TODO: 需要禁用掉页面中的各种采集和埋点请求,避免干扰 // TODO: 需要禁用掉页面中的各种采集和埋点请求,避免干扰