Skip to content

Commit

Permalink
Log start workspace info when failed on waiting workspace readiness
Browse files Browse the repository at this point in the history
Signed-off-by: Dmytro Nochevnov <[email protected]>
  • Loading branch information
dmytro-ndp committed Nov 8, 2024
1 parent 7ff0b63 commit 4da9d10
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
9 changes: 8 additions & 1 deletion tests/e2e/tests-library/ProjectAndFileTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Logger } from '../utils/Logger';
import { TIMEOUT_CONSTANTS } from '../constants/TIMEOUT_CONSTANTS';
import { CheCodeLocatorLoader } from '../pageobjects/ide/CheCodeLocatorLoader';
import { By, SideBarView, ViewContent, ViewItem, ViewSection, Workbench } from 'monaco-page-objects';
import { WorkspaceHandlingTests } from '../tests-library/WorkspaceHandlingTests';

@injectable()
export class ProjectAndFileTests {
Expand All @@ -25,7 +26,9 @@ export class ProjectAndFileTests {
@inject(CLASSES.DriverHelper)
private readonly driverHelper: DriverHelper,
@inject(CLASSES.CheCodeLocatorLoader)
private readonly cheCodeLocatorLoader: CheCodeLocatorLoader
private readonly cheCodeLocatorLoader: CheCodeLocatorLoader,
@inject(CLASSES.WorkspaceHandlingTests)
private readonly workspaceHandlingTests: WorkspaceHandlingTests
) {}

async waitWorkspaceReadinessForCheCodeEditor(): Promise<void> {
Expand All @@ -40,6 +43,10 @@ export class ProjectAndFileTests {
Logger.debug(`editor was opened in ${end - start} seconds.`);
} catch (err) {
Logger.error(`waiting for workspace readiness failed: ${err}`);

// assume that start workspace page is still opened
await this.workspaceHandlingTests.logStartWorkspaceInfo();

throw err;
}
}
Expand Down
32 changes: 16 additions & 16 deletions tests/e2e/tests-library/WorkspaceHandlingTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,37 +134,37 @@ export class WorkspaceHandlingTests {
await this.dashboard.stopAndRemoveWorkspaceByUI(workspaceName);
}

async getWorkspaceAlertDescription(): Promise<string> {
async logStartWorkspaceInfo(): Promise<void> {
const status: string = await this.getWorkspaceStatus();
const alertTitle: string = await this.getWorkspaceAlertTitle();
const alertDescription: string = await this.getWorkspaceAlertDescription();

Logger.info('Start workspace status: ' + status);
Logger.info('Start workspace progress title: ' + alertTitle);
Logger.info('Start workspace progress description: ' + alertDescription);
}

private async getWorkspaceAlertDescription(): Promise<string> {
try {
return await this.driverHelper.getDriver().findElement(WorkspaceHandlingTests.WORKSPACE_ALERT_DESCRIPTION).getText();
} catch (err) {
return '';
return '(unknown)';
}
}

async getWorkspaceStatus(): Promise<string> {
private async getWorkspaceStatus(): Promise<string> {
try {
return await this.driverHelper.getDriver().findElement(WorkspaceHandlingTests.WORKSPACE_STATUS).getText();
} catch (err) {
return '';
return '(unknown)';
}
}

async getWorkspaceAlertTitle(): Promise<string> {
private async getWorkspaceAlertTitle(): Promise<string> {
try {
return await this.driverHelper.getDriver().findElement(WorkspaceHandlingTests.WORKSPACE_ALERT_TITLE).getAttribute('innerHTML');
} catch (err) {
return '';
return '(unknown)';
}
}

async logStartWorkspaceInfo(): Promise<void> {
const status: string = await this.getWorkspaceStatus();
const alertTitle: string = await this.getWorkspaceAlertTitle();
const alertDescription: string = await this.getWorkspaceAlertDescription();

Logger.info('Start workspace status: ' + status);
Logger.info('Start workspace progress title: ' + alertTitle);
Logger.info('Start workspace progress description: ' + alertDescription);
}
}

0 comments on commit 4da9d10

Please sign in to comment.