update playwright as seperate service
This commit is contained in:
1 parent
bb31fc7388
commit
824b3ff966
3 files changed
+16
-13
No files matched your search
@@ -564,17 +564,27 @@ function getSnapshotObjectKey(websiteId: string, snapshotId: string, viewportW:
|
||||
return `${websiteId}/${viewportW}x${viewportH}/${snapshotId}.png`;
|
||||
}
|
||||
|
||||
async function createSnapshotBrowser() {
|
||||
const { chromium } = await import('@playwright/test');
|
||||
const endpoint = process.env.PLAYWRIGHT_URL?.trim();
|
||||
|
||||
if (endpoint) {
|
||||
return chromium.connect(endpoint);
|
||||
}
|
||||
|
||||
return chromium.launch({
|
||||
channel: 'chromium',
|
||||
headless: true,
|
||||
});
|
||||
}
|
||||
|
||||
async function captureSnapshot(
|
||||
url: string,
|
||||
viewportW: number,
|
||||
viewportH: number,
|
||||
pageW?: number,
|
||||
): Promise<CaptureResult> {
|
||||
const { chromium } = await import('@playwright/test');
|
||||
const browser = await chromium.launch({
|
||||
channel: 'chromium',
|
||||
headless: true,
|
||||
});
|
||||
const browser = await createSnapshotBrowser();
|
||||
const initialViewportW = viewportW;
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user