Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/playwright-browser-tunnel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@rushstack/terminal": "workspace:*",
"@rushstack/ts-command-line": "workspace:*",
"string-argv": "~0.3.1",
"semver": "~7.5.4",
"ws": "~8.14.1",
"playwright": "1.56.1"
},
Expand Down
10 changes: 3 additions & 7 deletions apps/playwright-browser-tunnel/src/PlaywrightBrowserTunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { once } from 'node:events';

import type { BrowserServer, BrowserType, LaunchOptions } from 'playwright-core';
import { type RawData, WebSocket, type WebSocketServer } from 'ws';
import semver from 'semver';

import { TerminalProviderSeverity, TerminalStreamWritable, type ITerminal } from '@rushstack/terminal';
import { Executable, FileSystem, Async } from '@rushstack/node-core-library';
Expand Down Expand Up @@ -48,7 +47,7 @@ export interface IHandshake {
action: 'handshake';
browserName: BrowserName;
launchOptions: LaunchOptions;
playwrightVersion: semver.SemVer;
playwrightVersion: string;
}

type TunnelMode = 'poll-connection' | 'wait-for-incoming-connection';
Expand Down Expand Up @@ -432,10 +431,7 @@ export class PlaywrightTunnel {
if (action !== 'handshake') {
throw new Error(`Invalid action: ${action}. Expected 'handshake'.`);
}
const playwrightVersionSemver: semver.SemVer | null = semver.coerce(playwrightVersion);
if (!playwrightVersionSemver) {
throw new Error(`Invalid Playwright version: ${playwrightVersion}. Must be a valid semver version.`);
}

if (!isValidBrowserName(browserName)) {
throw new Error(
`Invalid browser name: ${browserName}. Must be one of ${Array.from(validBrowserNames).join(', ')}.`
Expand All @@ -445,7 +441,7 @@ export class PlaywrightTunnel {
return {
action,
launchOptions: launchOptions as LaunchOptions,
playwrightVersion: playwrightVersionSemver,
playwrightVersion,
browserName
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import type {
} from './ITunneledBrowserConnection';
import { DEFAULT_LISTEN_PORT, SUPPORTED_BROWSER_NAMES } from './constants';

const { version: playwrightVersion } = playwrightPackageJson;

/**
* Creates a tunneled WebSocket endpoint that a local Playwright client can connect to.
* @beta
*/
export async function tunneledBrowserConnection(
logger: ITerminal,
port: number = DEFAULT_LISTEN_PORT
port: number = DEFAULT_LISTEN_PORT,
playwrightVersion: string = playwrightPackageJson.version
): Promise<IDisposableTunneledBrowserConnection> {
// Server that remote peer (actual browser host) connects to
const remoteWsServer: WebSocketServer = new WebSocketServer({ port });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/playwright-browser-tunnel",
"comment": "Add playwright-versioning and remove semver",
"type": "patch"
}
],
"packageName": "@rushstack/playwright-browser-tunnel"
}
3 changes: 0 additions & 3 deletions common/config/subspaces/default/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions common/reviews/api/playwright-browser-tunnel.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import type { Browser } from 'playwright-core';
import { ITerminal } from '@rushstack/terminal';
import type { LaunchOptions } from 'playwright-core';
import semver from 'semver';

// @beta
export type BrowserName = 'chromium' | 'firefox' | 'webkit';
Expand Down Expand Up @@ -43,7 +42,7 @@ export interface IHandshake {
// (undocumented)
launchOptions: LaunchOptions;
// (undocumented)
playwrightVersion: semver.SemVer;
playwrightVersion: string;
}

// @beta
Expand Down Expand Up @@ -112,7 +111,7 @@ export class PlaywrightTunnel {
}

// @beta
export function tunneledBrowserConnection(logger: ITerminal, port?: number): Promise<IDisposableTunneledBrowserConnection>;
export function tunneledBrowserConnection(logger: ITerminal, port?: number, playwrightVersion?: string): Promise<IDisposableTunneledBrowserConnection>;

// @beta
export type TunnelStatus = 'waiting-for-connection' | 'browser-server-running' | 'stopped' | 'setting-up-browser-server' | 'error';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playwright-local-browser-server",
"version": "0.1.2",
"version": "0.1.3",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/rushstack.git",
Expand Down