Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: add ESRP CDN for browser downloads (#33585)
Max Schmitt358fad45cd36
diff --git a/packages/playwright-core/src/server/registry/browserFetcher.ts b/packages/playwright-core/src/server/registry/browserFetcher.tsindex 6f8da6e825..3a6e36b42d 100644--- a/packages/playwright-core/src/server/registry/browserFetcher.ts+++ b/packages/playwright-core/src/server/registry/browserFetcher.ts@@ -36,7 +36,7 @@ export async function downloadBrowserWithProgressBar(title: string, browserDirecconst zipPath = path.join(os.tmpdir(), downloadFileName);try {- const retryCount = 3;+ const retryCount = 5;for (let attempt = 1; attempt <= retryCount; ++attempt) {debugLogger.log('install', `downloading ${title} - attempt #${attempt}`);const url = downloadURLs[(attempt - 1) % downloadURLs.length];diff --git a/packages/playwright-core/src/server/registry/index.ts b/packages/playwright-core/src/server/registry/index.tsindex 709829621c..cd2f2f1d32 100644--- a/packages/playwright-core/src/server/registry/index.ts+++ b/packages/playwright-core/src/server/registry/index.ts@@ -37,16 +37,23 @@ const PACKAGE_PATH = path.join(__dirname, '..', '..', '..');const BIN_PATH = path.join(__dirname, '..', '..', '..', 'bin');const PLAYWRIGHT_CDN_MIRRORS = [+ 'https://playwright.azureedge.net/dbazure/download/playwright', // ESRP CDN+ 'https://playwright.download.prss.microsoft.com/dbazure/download/playwright', // Directly hit ESRP CDN++ // Old endpoints which hit the Storage Bucket directly:'https://playwright.azureedge.net',- 'https://playwright-akamai.azureedge.net',- 'https://playwright-verizon.azureedge.net',+ 'https://playwright-akamai.azureedge.net', // Actually Edgio which will be retired Q4 2025.+ 'https://playwright-verizon.azureedge.net', // Actually Edgio which will be retired Q4 2025.];if (process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {for (let i = 0; i < PLAYWRIGHT_CDN_MIRRORS.length; i++) {const cdn = PLAYWRIGHT_CDN_MIRRORS[i];- if (cdn !== process.env.PW_TEST_CDN_THAT_SHOULD_WORK)- PLAYWRIGHT_CDN_MIRRORS[i] = cdn + '.does-not-resolve.playwright.dev';+ if (cdn !== process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {+ const parsedCDN = new URL(cdn);+ parsedCDN.hostname = parsedCDN.hostname + '.does-not-resolve.playwright.dev';+ PLAYWRIGHT_CDN_MIRRORS[i] = parsedCDN.toString();+ }}}diff --git a/tests/installation/playwright-cdn.spec.ts b/tests/installation/playwright-cdn.spec.tsindex 924dbb4c55..af0339f03b 100644--- a/tests/installation/playwright-cdn.spec.ts+++ b/tests/installation/playwright-cdn.spec.ts@@ -19,6 +19,8 @@ import net from 'net';import type { AddressInfo } from 'net';const CDNS = [+ 'https://playwright.azureedge.net/dbazure/download/playwright', // ESRP+ 'https://playwright.download.prss.microsoft.com/dbazure/download/playwright', // ESRP Fallback'https://playwright.azureedge.net','https://playwright-akamai.azureedge.net','https://playwright-verizon.azureedge.net',@@ -90,8 +92,8 @@ test(`npx playwright install should not hang when CDN closes the connection`, as},expectToExitWithError: true});- expect(retryCount).toBe(3);- expect([...result.matchAll(/Download failed: server closed connection/g)]).toHaveLength(3);+ expect(retryCount).toBe(5);+ expect([...result.matchAll(/Download failed: server closed connection/g)]).toHaveLength(5);} finally {await new Promise(resolve => server.close(resolve));}@@ -120,8 +122,8 @@ test(`npx playwright install should not hang when CDN TCP connection stalls`, as},expectToExitWithError: true});- expect(retryCount).toBe(3);- expect([...result.matchAll(/timed out after/g)]).toHaveLength(3);+ expect(retryCount).toBe(5);+ expect([...result.matchAll(/timed out after/g)]).toHaveLength(5);} finally {for (const socket of socketsToDestroy)socket.destroy();