playwright-core
Advanced tools
@@ -30,3 +30,3 @@ { | ||
"name": "webkit", | ||
"revision": "2119", | ||
"revision": "2120", | ||
"installByDefault": true, | ||
@@ -33,0 +33,0 @@ "revisionOverrides": { |
@@ -46,3 +46,3 @@ "use strict"; | ||
this._options = options; | ||
options.launchOptions = filterLaunchOptions(options.launchOptions); | ||
options.launchOptions = filterLaunchOptions(options.launchOptions, options.allowFSPaths); | ||
if (clientType === 'reuse-browser' || clientType === 'pre-launched-browser-or-android') (0, _utils.assert)(preLaunched.playwright); | ||
@@ -252,3 +252,3 @@ if (clientType === 'pre-launched-browser-or-android') (0, _utils.assert)(preLaunched.browser || preLaunched.androidDevice); | ||
} | ||
function filterLaunchOptions(options) { | ||
function filterLaunchOptions(options, allowFSPaths) { | ||
return { | ||
@@ -265,3 +265,4 @@ channel: options.channel, | ||
slowMo: options.slowMo, | ||
executablePath: (0, _utils.isUnderTest)() ? options.executablePath : undefined | ||
executablePath: (0, _utils.isUnderTest)() || allowFSPaths ? options.executablePath : undefined, | ||
downloadsPath: allowFSPaths ? options.downloadsPath : undefined | ||
}; | ||
@@ -268,0 +269,0 @@ } |
@@ -86,3 +86,4 @@ "use strict"; | ||
browserName, | ||
launchOptions | ||
launchOptions, | ||
allowFSPaths: this._options.mode === 'extension' | ||
}, { | ||
@@ -89,0 +90,0 @@ playwright: this._preLaunchedPlaywright, |
@@ -154,3 +154,8 @@ "use strict"; | ||
var context = await browser.NewContextAsync(${formatContextOptions(options.contextOptions, options.deviceName)});`); | ||
if (options.contextOptions.recordHar) formatter.add(` await context.RouteFromHARAsync(${quote(options.contextOptions.recordHar.path)});`); | ||
if (options.contextOptions.recordHar) { | ||
const url = options.contextOptions.recordHar.urlFilter; | ||
formatter.add(` await context.RouteFromHARAsync(${quote(options.contextOptions.recordHar.path)}${url ? `, ${formatObject({ | ||
url | ||
}, ' ', 'BrowserContextRouteFromHAROptions')}` : ''});`); | ||
} | ||
formatter.newLine(); | ||
@@ -180,3 +185,8 @@ return formatter.format(); | ||
{`); | ||
if (options.contextOptions.recordHar) formatter.add(` await context.RouteFromHARAsync(${quote(options.contextOptions.recordHar.path)});`); | ||
if (options.contextOptions.recordHar) { | ||
const url = options.contextOptions.recordHar.urlFilter; | ||
formatter.add(` await Context.RouteFromHARAsync(${quote(options.contextOptions.recordHar.path)}${url ? `, ${formatObject({ | ||
url | ||
}, ' ', 'BrowserContextRouteFromHAROptions')}` : ''});`); | ||
} | ||
return formatter.format(); | ||
@@ -183,0 +193,0 @@ } |
@@ -138,3 +138,3 @@ "use strict"; | ||
import org.junit.jupiter.api.*; | ||
${options.contextOptions.recordHar ? `import java.nio.file.Paths;\n` : ''}import org.junit.jupiter.api.*; | ||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.*; | ||
@@ -146,2 +146,8 @@ | ||
void test(Page page) {`); | ||
if (options.contextOptions.recordHar) { | ||
const url = options.contextOptions.recordHar.urlFilter; | ||
const recordHarOptions = typeof url === 'string' ? `, new Page.RouteFromHAROptions() | ||
.setUrl(${quote(url)})` : ''; | ||
formatter.add(` page.routeFromHAR(Paths.get(${quote(options.contextOptions.recordHar.path)})${recordHarOptions});`); | ||
} | ||
return formatter.format(); | ||
@@ -153,3 +159,3 @@ } | ||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; | ||
import java.util.*; | ||
${options.contextOptions.recordHar ? `import java.nio.file.Paths;\n` : ''}import java.util.*; | ||
@@ -161,3 +167,8 @@ public class Example { | ||
BrowserContext context = browser.newContext(${formatContextOptions(options.contextOptions, options.deviceName)});`); | ||
if (options.contextOptions.recordHar) formatter.add(` context.routeFromHAR(${quote(options.contextOptions.recordHar.path)});`); | ||
if (options.contextOptions.recordHar) { | ||
const url = options.contextOptions.recordHar.urlFilter; | ||
const recordHarOptions = typeof url === 'string' ? `, new BrowserContext.RouteFromHAROptions() | ||
.setUrl(${quote(url)})` : ''; | ||
formatter.add(` context.routeFromHAR(Paths.get(${quote(options.contextOptions.recordHar.path)})${recordHarOptions});`); | ||
} | ||
return formatter.format(); | ||
@@ -164,0 +175,0 @@ } |
@@ -133,3 +133,8 @@ "use strict"; | ||
test('test', async ({ page }) => {`); | ||
if (options.contextOptions.recordHar) formatter.add(` await page.routeFromHAR(${quote(options.contextOptions.recordHar.path)});`); | ||
if (options.contextOptions.recordHar) { | ||
const url = options.contextOptions.recordHar.urlFilter; | ||
formatter.add(` await page.routeFromHAR(${quote(options.contextOptions.recordHar.path)}${url ? `, ${formatOptions({ | ||
url | ||
}, false)}` : ''});`); | ||
} | ||
return formatter.format(); | ||
@@ -136,0 +141,0 @@ } |
@@ -126,2 +126,3 @@ "use strict"; | ||
const formatter = new PythonFormatter(); | ||
const recordHar = options.contextOptions.recordHar; | ||
if (this._isPyTest) { | ||
@@ -136,3 +137,3 @@ const contextOptions = formatContextOptions(options.contextOptions, options.deviceName, true /* asDict */); | ||
` : ''; | ||
formatter.add(`${options.deviceName ? 'import pytest\n' : ''}import re | ||
formatter.add(`${options.deviceName || contextOptions ? 'import pytest\n' : ''}import re | ||
from playwright.sync_api import Page, expect | ||
@@ -142,3 +143,3 @@ ${fixture} | ||
def test_example(page: Page) -> None {`); | ||
if (options.contextOptions.recordHar) formatter.add(` page.route_from_har(${quote(options.contextOptions.recordHar.path)})`); | ||
if (recordHar) formatter.add(` page.route_from_har(${quote(recordHar.path)}${typeof recordHar.urlFilter === 'string' ? `, url=${quote(recordHar.urlFilter)}` : ''})`); | ||
} else if (this._isAsync) { | ||
@@ -154,3 +155,3 @@ formatter.add(` | ||
context = await browser.new_context(${formatContextOptions(options.contextOptions, options.deviceName)})`); | ||
if (options.contextOptions.recordHar) formatter.add(` await page.route_from_har(${quote(options.contextOptions.recordHar.path)})`); | ||
if (recordHar) formatter.add(` await context.route_from_har(${quote(recordHar.path)}${typeof recordHar.urlFilter === 'string' ? `, url=${quote(recordHar.urlFilter)}` : ''})`); | ||
} else { | ||
@@ -165,3 +166,3 @@ formatter.add(` | ||
context = browser.new_context(${formatContextOptions(options.contextOptions, options.deviceName)})`); | ||
if (options.contextOptions.recordHar) formatter.add(` context.route_from_har(${quote(options.contextOptions.recordHar.path)})`); | ||
if (recordHar) formatter.add(` context.route_from_har(${quote(recordHar.path)}${typeof recordHar.urlFilter === 'string' ? `, url=${quote(recordHar.urlFilter)}` : ''})`); | ||
} | ||
@@ -168,0 +169,0 @@ return formatter.format(); |
@@ -54,11 +54,7 @@ "use strict"; | ||
const BIN_PATH = _path.default.join(__dirname, '..', '..', '..', 'bin'); | ||
const PLAYWRIGHT_CDN_MIRRORS = ['https://playwright.azureedge.net/dbazure/download/playwright', | ||
const PLAYWRIGHT_CDN_MIRRORS = ['https://cdn.playwright.dev/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', | ||
// Actually Edgio which will be retired Q4 2025. | ||
'https://playwright-verizon.azureedge.net' // Actually Edgio which will be retired Q4 2025. | ||
'https://cdn.playwright.dev' // Hit the Storage Bucket directly | ||
]; | ||
@@ -65,0 +61,0 @@ if (process.env.PW_TEST_CDN_THAT_SHOULD_WORK) { |
{ | ||
"name": "playwright-core", | ||
"version": "1.50.0-alpha-2024-12-18", | ||
"version": "1.50.0-alpha-2024-12-19", | ||
"description": "A high-level API to automate web browsers", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7990171
0.02%109299
0.02%