Skip to content

Commit f483cd7

Browse files
committed
Debug
1 parent b9b46e1 commit f483cd7

File tree

13 files changed

+30
-30
lines changed

13 files changed

+30
-30
lines changed

.github/actions/run-test/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ runs:
5252
echo "::endgroup::"
5353
shell: bash
5454
- name: Allow WSL network access for WSL2
55-
if: inputs.browsers-to-install == 'webkit-wsl'
55+
if: contains(inputs.browsers-to-install, 'webkit-wsl')
5656
shell: powershell
5757
run: |
5858
$wslAdapter = Get-NetAdapter | Where-Object {$_.Name -like "*WSL*"}

.github/workflows/tests_primary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- uses: ./.github/actions/run-test
3535
with:
3636
node-version: 22
37-
browsers-to-install: webkit-wsl
37+
browsers-to-install: webkit-wsl chromium
3838
command: npm run test -- --project=webkit-* --reporter=list
3939
bot-name: "webkit-wsl-headed"
4040
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}

packages/playwright-core/bin/webkit-wsl-pipe-wrapper.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const child = spawn(executable, args, {
3232
stdio: ['inherit', 'inherit', 'inherit', 'pipe', 'pipe']
3333
});
3434

35-
socket.pipe(child.stdio[3]);
36-
child.stdio[4].pipe(socket);
35+
socket.pipe(/** @type {NodeJS.WritableStream} */ (child.stdio[3]));
36+
/** @type {NodeJS.ReadableStream} */ (child.stdio[4]).pipe(socket);
3737

3838
// Handle cleanup
3939
socket.on('end', () => child.kill());

packages/playwright-core/src/server/webkit/webkit.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export class WebKit extends BrowserType {
9999
}
100100

101101
export function translatePathToWSL(path: string): string {
102-
console.log('translatePathToWSL', path);
103102
const result = spawnSync('wsl', ['-d', 'playwright', '--cd', '/home/pwuser', 'wslpath', path.replace(/\\/g, '\\\\')]).stdout.toString().trim();
104103
return result;
105104
}

packages/playwright-core/src/server/webkit/wkPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { WKInterceptableRequest, WKRouteImpl } from './wkInterceptableRequest';
3939
import { WKProvisionalPage } from './wkProvisionalPage';
4040
import { WKWorkers } from './wkWorkers';
4141
import { debugLogger } from '../utils/debugLogger';
42+
import { translatePathToWSL } from './webkit';
4243

4344
import type { Protocol } from './protocol';
4445
import type { WKBrowserContext } from './wkBrowser';
@@ -49,7 +50,6 @@ import type { JSHandle } from '../javascript';
4950
import type { InitScript, PageDelegate } from '../page';
5051
import type { Progress } from '../progress';
5152
import type * as types from '../types';
52-
import { translatePathToWSL } from './webkit';
5353

5454
const UTILITY_WORLD_NAME = '__playwright_utility_world__';
5555

tests/config/browserTest.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,14 @@ type BrowserTestTestFixtures = PageTestFixtures & {
5959

6060
const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>({
6161
loopback: [async ({ channel }, use) => {
62-
if (!channel)
63-
return await use(undefined);
64-
if (execSync('wsl -d playwright --cd /home/pwuser wslinfo --networking-mode').includes('nat'))
62+
if (channel === 'webkit-wsl' && execSync('wsl -d playwright --cd /home/pwuser wslinfo --networking-mode').includes('nat'))
6563
return await use(execSync('wsl -d playwright --cd /home/pwuser ip route show', { encoding: 'utf8' }).trim().split('\n').find(line => line.includes('default'))?.split(' ')[2]);
6664
return await use(undefined);
6765
}, { scope: 'worker', timeout: 10000 }],
6866

69-
loopback2: [async ({ channel }, use) => {
70-
if (!channel)
71-
return await use(undefined);
72-
if (execSync('wsl -d playwright --cd /home/pwuser wslinfo --networking-mode').includes('nat'))
73-
return await use(execSync('wsl -d playwright --cd /home/pwuser ip route show', { encoding: 'utf8' }).trim().split('\n').find(line => line.includes('default'))?.split(' ')[2]);
67+
loopback2: [async ({ channel, loopback }, use) => {
68+
if (channel === 'webkit-wsl' && loopback)
69+
return await use(`${loopback}.nip.io`);
7470
return await use(undefined);
7571
}, { scope: 'worker', timeout: 10000 }],
7672

tests/config/proxy.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class TestProxy {
3030
readonly HOST: string;
3131
readonly PORT: number;
3232
readonly URL: string;
33+
readonly HOSTNAME: string;
3334

3435
connectHosts: string[] = [];
3536
requestUrls: string[] = [];
@@ -39,13 +40,13 @@ export class TestProxy {
3940
private readonly _sockets = new Set<net.Socket>();
4041
private _handlers: { event: string, handler: (...args: any[]) => void }[] = [];
4142

42-
static async create(port: number): Promise<TestProxy> {
43-
const proxy = new TestProxy(port);
43+
static async create(port: number, loopback: string): Promise<TestProxy> {
44+
const proxy = new TestProxy(port, loopback);
4445
await new Promise<void>(f => proxy._server.listen(port, f));
4546
return proxy;
4647
}
4748

48-
private constructor(port: number) {
49+
private constructor(port: number, loopback: string) {
4950
this.PORT = port;
5051
this.URL = `http://localhost:${port}`;
5152
this.HOST = new URL(this.URL).host;

tests/config/serverFixtures.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export type ServerFixtures = {
3838

3939
export const serverFixtures: Fixtures<ServerFixtures, ServerWorkerOptions> = {
4040
loopback: [undefined, { scope: 'worker', option: true }],
41+
loopback2: [undefined, { scope: 'worker', option: true }],
4142
__servers: [async ({ loopback, loopback2 }, run, workerInfo) => {
4243
const assetsPath = path.join(__dirname, '..', 'assets');
4344
const cachedPath = path.join(__dirname, '..', 'assets', 'cached');
@@ -55,7 +56,7 @@ export const serverFixtures: Fixtures<ServerFixtures, ServerWorkerOptions> = {
5556
await socksServer.listen(socksPort);
5657

5758
const proxyPort = port + 3;
58-
const proxyServer = await TestProxy.create(proxyPort);
59+
const proxyServer = await TestProxy.create(proxyPort, loopback);
5960

6061
await run({
6162
asset: (p: string) => path.join(__dirname, '..', 'assets', ...p.split('/')),

tests/library/browsercontext-proxy.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,19 +388,19 @@ it('should exclude patterns', async ({ contextFactory, server, proxyServer }) =>
388388
await context.close();
389389
});
390390

391-
it('should use socks proxy', async ({ contextFactory, socksPort }) => {
391+
it('should use socks proxy', async ({ contextFactory, loopback, socksPort }) => {
392392
const context = await contextFactory({
393-
proxy: { server: `socks5://localhost:${socksPort}` }
393+
proxy: { server: `socks5://${loopback}:${socksPort}` }
394394
});
395395
const page = await context.newPage();
396396
await page.goto('http://non-existent.com');
397397
expect(await page.title()).toBe('Served by the SOCKS proxy');
398398
await context.close();
399399
});
400400

401-
it('should use socks proxy in second page', async ({ contextFactory, socksPort }) => {
401+
it('should use socks proxy in second page', async ({ contextFactory, loopback, socksPort }) => {
402402
const context = await contextFactory({
403-
proxy: { server: `socks5://localhost:${socksPort}` }
403+
proxy: { server: `socks5://${loopback}:${socksPort}` }
404404
});
405405

406406
const page = await context.newPage();

tests/library/firefox/launcher.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ it('should pass firefox user preferences in persistent', async ({ mode, launchPe
4646
expect(error.message).toContain('NS_ERROR_PROXY_CONNECTION_REFUSED');
4747
});
4848

49-
it('should support custom firefox policies', async ({ browserType, mode, asset, loopback }, testInfo) => {
49+
it('should support custom firefox policies', async ({ browserType, mode, asset, loopback, loopback2 }, testInfo) => {
5050
it.skip(mode.startsWith('service'));
5151

5252
const policies = {
@@ -60,7 +60,7 @@ it('should support custom firefox policies', async ({ browserType, mode, asset,
6060
await fs.promises.writeFile(policiesPath, JSON.stringify(policies));
6161

6262
const port = 48112;
63-
const server = new TestServer(asset(''), port, loopback, {
63+
const server = new TestServer(asset(''), port, loopback, loopback2, {
6464
key: await fs.promises.readFile(asset('client-certificates/client/localhost/localhost.key')),
6565
cert: await fs.promises.readFile(asset('client-certificates/client/localhost/localhost.pem')),
6666
});

0 commit comments

Comments
 (0)