Files
gitbook/tests/utils.ts
T
Samy Pessé 720c2ca909 Setup visual testing (#50)
* Add cloudflare job to publish pages

* Try like this

* Fix build path

* Try end to end

* Fix installation

* Use var instead of secret for CLOUDFLARE_PROJECT_NAME

* Use new puppeteer mode

* Add more tests

* Run in parallel

* Go back to no-concurrency

* Test pagespeed

* Print output

* Fix thresholds
2023-12-19 23:51:06 +01:00

26 lines
573 B
TypeScript

/**
* Get the target URL from the command line arguments.
*/
export function getTargetURL() {
const targetUrl = Bun.argv[2];
if (!targetUrl) {
console.error('No target URL provided');
process.exit(1);
}
return targetUrl;
}
/**
* Get the URL to load for a content
*/
export function getContentTestURL(input: string): string {
const url = new URL(getTargetURL());
const contentUrl = new URL(input);
url.pathname = `${contentUrl.host}${contentUrl.pathname}`;
url.search = contentUrl.search;
return url.toString();
}