Skip to content

Commit 1574f9f

Browse files
committed
♻️ Remove unused remote browser code from Ember SDK
Removes browserWSEndpoint, connectOverCDP, and rewriteUrlForDocker. These were for a remote browser approach that we're not using. The Docker workflow runs everything in the container, so we only need VIZZLY_SERVER_URL env var support (already in place).
1 parent b9793ac commit 1574f9f

File tree

3 files changed

+21
-54
lines changed

3 files changed

+21
-54
lines changed

clients/ember/bin/vizzly-testem-launcher.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ let args = process.argv.slice(2);
3333
let browserType = args[0];
3434
let testUrl = args[args.length - 1];
3535

36-
// If using remote browser (Docker), rewrite localhost to host.docker.internal
37-
// so the containerized browser can reach the host's test server
38-
function rewriteUrlForDocker(url) {
39-
return url.replace(/localhost|127\.0\.0\.1/g, 'host.docker.internal');
40-
}
41-
4236
// Validate arguments
4337
if (!browserType || !testUrl || !testUrl.startsWith('http')) {
4438
console.error('Usage: vizzly-testem-launcher <browser> <url>');
@@ -49,14 +43,10 @@ if (!browserType || !testUrl || !testUrl.startsWith('http')) {
4943

5044
// Read Playwright launch options from config file (written by configure())
5145
let playwrightOptions = { headless: true }; // Default to headless
52-
let browserWSEndpoint = null;
5346
let configPath = join(process.cwd(), '.vizzly', 'playwright.json');
5447
if (existsSync(configPath)) {
5548
try {
5649
let config = JSON.parse(readFileSync(configPath, 'utf8'));
57-
// Extract browserWSEndpoint separately (not a Playwright launch option)
58-
browserWSEndpoint = config.browserWSEndpoint;
59-
delete config.browserWSEndpoint;
6050
playwrightOptions = {
6151
headless: true, // Default
6252
...config,
@@ -122,19 +112,10 @@ async function main() {
122112
}
123113
}
124114

125-
// 3. Launch browser with Playwright (or connect to remote browser)
126-
// If remote browser, rewrite URL so container can reach host
127-
let actualTestUrl = browserWSEndpoint ? rewriteUrlForDocker(testUrl) : testUrl;
128-
129-
if (browserWSEndpoint) {
130-
console.log(`[vizzly] Connecting to remote browser: ${browserWSEndpoint}`);
131-
console.log(`[vizzly] Test URL rewritten: ${testUrl} -> ${actualTestUrl}`);
132-
}
133-
134-
browserInstance = await launchBrowser(browserType, actualTestUrl, {
115+
// 3. Launch browser with Playwright
116+
browserInstance = await launchBrowser(browserType, testUrl, {
135117
screenshotUrl,
136118
failOnDiff,
137-
browserWSEndpoint,
138119
playwrightOptions,
139120
onPageCreated: page => {
140121
setPage(page);

clients/ember/src/launcher/browser.js

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ function getDefaultChromiumArgs() {
6161
* @param {Object} options - Launch options
6262
* @param {string} options.screenshotUrl - URL of the screenshot HTTP server
6363
* @param {boolean} [options.failOnDiff] - Whether tests should fail on visual diffs
64-
* @param {string} [options.browserWSEndpoint] - WebSocket endpoint to connect to remote browser
6564
* @param {Object} [options.playwrightOptions] - Playwright launch options (headless, slowMo, timeout, etc.)
6665
* @param {Function} [options.onPageCreated] - Callback when page is created (before navigation)
6766
* @param {Function} [options.onBrowserDisconnected] - Callback when browser disconnects unexpectedly
@@ -71,7 +70,6 @@ export async function launchBrowser(browserType, testUrl, options = {}) {
7170
let {
7271
screenshotUrl,
7372
failOnDiff,
74-
browserWSEndpoint,
7573
playwrightOptions = {},
7674
onPageCreated,
7775
onBrowserDisconnected,
@@ -85,38 +83,27 @@ export async function launchBrowser(browserType, testUrl, options = {}) {
8583
);
8684
}
8785

88-
let browser;
89-
90-
// Connect to remote browser if endpoint provided
91-
if (browserWSEndpoint) {
92-
// Use connectOverCDP for remote browsers (e.g., browserless, Docker)
93-
// This connects via Chrome DevTools Protocol, which is what most
94-
// remote browser services expose (vs Playwright's own server protocol)
95-
let cdpEndpoint = browserWSEndpoint.replace(/^ws:/, 'http:').replace(/^wss:/, 'https:');
96-
browser = await factory.connectOverCDP(cdpEndpoint);
97-
} else {
98-
// Build args: our defaults + user's args (user can override)
99-
let args = [];
100-
if (browserType === 'chromium') {
101-
args = [...getDefaultChromiumArgs()];
102-
}
103-
104-
// Merge user's args if provided
105-
if (playwrightOptions.args) {
106-
args.push(...playwrightOptions.args);
107-
}
108-
109-
// Build Playwright launch options
110-
// User's playwrightOptions take precedence, but we ensure args are merged
111-
let launchOptions = {
112-
headless: true, // Default to headless
113-
...playwrightOptions,
114-
args,
115-
};
116-
117-
browser = await factory.launch(launchOptions);
86+
// Build args: our defaults + user's args (user can override)
87+
let args = [];
88+
if (browserType === 'chromium') {
89+
args = [...getDefaultChromiumArgs()];
11890
}
11991

92+
// Merge user's args if provided
93+
if (playwrightOptions.args) {
94+
args.push(...playwrightOptions.args);
95+
}
96+
97+
// Build Playwright launch options
98+
// User's playwrightOptions take precedence, but we ensure args are merged
99+
let launchOptions = {
100+
headless: true, // Default to headless
101+
...playwrightOptions,
102+
args,
103+
};
104+
105+
let browser = await factory.launch(launchOptions);
106+
120107
// Listen for unexpected browser disconnection (crash, killed, etc.)
121108
if (onBrowserDisconnected) {
122109
browser.on('disconnected', onBrowserDisconnected);

clients/ember/src/testem-config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ function writePlaywrightConfig(options) {
105105
* @param {number} [playwrightOptions.slowMo] - Slow down operations by this many milliseconds
106106
* @param {number} [playwrightOptions.timeout] - Browser launch timeout in milliseconds
107107
* @param {Object} [playwrightOptions.proxy] - Proxy settings
108-
* @param {string} [playwrightOptions.browserWSEndpoint] - WebSocket endpoint to connect to remote browser (e.g., Docker)
109108
* @returns {Object} Modified configuration with Vizzly launchers
110109
*
111110
* @example

0 commit comments

Comments
 (0)