mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: improve debug logging of saucelabs daemon (#51533)
We should print more specific details about a browser being used for tests. This will help us debug timeout/flakiness easier. PR Close #51533
This commit is contained in:
committed by
Jessica Janiuk
parent
a671020f0b
commit
8a22c60ec0
@@ -29,6 +29,7 @@ interface RemoteBrowser {
|
||||
id: string;
|
||||
state: 'claimed'|'free'|'launching';
|
||||
driver: WebDriver|null;
|
||||
sessionUrl: string|null;
|
||||
}
|
||||
|
||||
interface BrowserTest {
|
||||
@@ -206,7 +207,12 @@ export class SaucelabsDaemon {
|
||||
await Promise.all(
|
||||
this._browsers.map(async (browser, id) => {
|
||||
const browserId = getUniqueId(browser);
|
||||
const launched: RemoteBrowser = {state: 'launching', driver: null, id: browserId};
|
||||
const launched: RemoteBrowser = {
|
||||
state: 'launching',
|
||||
driver: null,
|
||||
sessionUrl: null,
|
||||
id: browserId,
|
||||
};
|
||||
const browserDescription = `${this._buildName} - ${browser.browserName} - #${id + 1}`;
|
||||
|
||||
const capabilities: any = {
|
||||
@@ -243,16 +249,17 @@ export class SaucelabsDaemon {
|
||||
await driver.manage().setTimeouts({pageLoad: 30000});
|
||||
|
||||
const sessionId = (await driver.getSession()).getId();
|
||||
console.info(
|
||||
chalk.yellow(
|
||||
`Started browser ${browser.browserName} on Saucelabs: ` +
|
||||
`https://saucelabs.com/tests/${sessionId}`,
|
||||
),
|
||||
);
|
||||
|
||||
// Mark the browser as available after launch completion.
|
||||
launched.state = 'free';
|
||||
launched.driver = driver;
|
||||
launched.sessionUrl = `https://saucelabs.com/tests/${sessionId}`;
|
||||
|
||||
console.info(
|
||||
chalk.yellow(
|
||||
`Started browser ${browser.browserName} on Saucelabs: ${launched.sessionUrl}`,
|
||||
),
|
||||
);
|
||||
|
||||
// If a test has been scheduled before the browser completed launching, run
|
||||
// it now given that the browser is ready now.
|
||||
@@ -281,6 +288,7 @@ export class SaucelabsDaemon {
|
||||
|
||||
try {
|
||||
console.debug(`Opening test url for #${test.testId}: ${test.pageUrl}`);
|
||||
console.debug(` > Instance URL: ${browser.sessionUrl}`);
|
||||
await browser.driver!.get(test.pageUrl);
|
||||
const pageTitle = await browser.driver!.getTitle();
|
||||
console.debug(`Test page loaded for #${test.testId}: "${pageTitle}".`);
|
||||
|
||||
Reference in New Issue
Block a user