Skip to content

Commit 8a22c60

Browse files
devversionthePunderWoman
authored andcommitted
build: improve debug logging of saucelabs daemon (angular#51533)
We should print more specific details about a browser being used for tests. This will help us debug timeout/flakiness easier. PR Close angular#51533
1 parent a671020 commit 8a22c60

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

tools/saucelabs-daemon/background-service/saucelabs-daemon.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface RemoteBrowser {
2929
id: string;
3030
state: 'claimed'|'free'|'launching';
3131
driver: WebDriver|null;
32+
sessionUrl: string|null;
3233
}
3334

3435
interface BrowserTest {
@@ -206,7 +207,12 @@ export class SaucelabsDaemon {
206207
await Promise.all(
207208
this._browsers.map(async (browser, id) => {
208209
const browserId = getUniqueId(browser);
209-
const launched: RemoteBrowser = {state: 'launching', driver: null, id: browserId};
210+
const launched: RemoteBrowser = {
211+
state: 'launching',
212+
driver: null,
213+
sessionUrl: null,
214+
id: browserId,
215+
};
210216
const browserDescription = `${this._buildName} - ${browser.browserName} - #${id + 1}`;
211217

212218
const capabilities: any = {
@@ -243,16 +249,17 @@ export class SaucelabsDaemon {
243249
await driver.manage().setTimeouts({pageLoad: 30000});
244250

245251
const sessionId = (await driver.getSession()).getId();
246-
console.info(
247-
chalk.yellow(
248-
`Started browser ${browser.browserName} on Saucelabs: ` +
249-
`https://saucelabs.com/tests/${sessionId}`,
250-
),
251-
);
252252

253253
// Mark the browser as available after launch completion.
254254
launched.state = 'free';
255255
launched.driver = driver;
256+
launched.sessionUrl = `https://saucelabs.com/tests/${sessionId}`;
257+
258+
console.info(
259+
chalk.yellow(
260+
`Started browser ${browser.browserName} on Saucelabs: ${launched.sessionUrl}`,
261+
),
262+
);
256263

257264
// If a test has been scheduled before the browser completed launching, run
258265
// it now given that the browser is ready now.
@@ -281,6 +288,7 @@ export class SaucelabsDaemon {
281288

282289
try {
283290
console.debug(`Opening test url for #${test.testId}: ${test.pageUrl}`);
291+
console.debug(` > Instance URL: ${browser.sessionUrl}`);
284292
await browser.driver!.get(test.pageUrl);
285293
const pageTitle = await browser.driver!.getTitle();
286294
console.debug(`Test page loaded for #${test.testId}: "${pageTitle}".`);

0 commit comments

Comments
 (0)