ci: Playwright project organization (#17905)

This commit is contained in:
shortstacked
2025-08-04 19:59:06 +01:00
committed by GitHub
parent e8dad4e030
commit d0443dce11
366 changed files with 251 additions and 234 deletions

View File

@@ -20,6 +20,22 @@ function findProjectRoot(marker: string): string {
return dir;
}
/**
* Finds a folder root by searching upwards for a marker folder named 'packages'.
* @returns The absolute path to the folder root.
*/
export function findPackagesRoot(marker: string): string {
let dir = __dirname;
while (!fs.existsSync(path.join(dir, marker))) {
const parentDir = path.dirname(dir);
if (parentDir === dir) {
throw new TestError('Could not find packages root');
}
dir = parentDir;
}
return dir;
}
const playwrightRoot = findProjectRoot('playwright.config.ts');
/**

View File

@@ -0,0 +1,7 @@
/**
* Extract port from a URL string
*/
export function getPortFromUrl(url: string): string {
const parsedUrl = new URL(url);
return parsedUrl.port || (parsedUrl.protocol === 'https:' ? '443' : '80');
}