Skip to content

Commit 77799bf

Browse files
authored
check dialog buttons in WorkspaceIdleTimeout test (#22885)
1 parent c9a069f commit 77799bf

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

tests/e2e/specs/miscellaneous/WorkspaceIdleTimeout.spec.ts

+10-11
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
1818
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
1919
import { DriverHelper } from '../../utils/DriverHelper';
2020
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
21-
import { Locators, ModalDialog } from 'monaco-page-objects';
21+
import { By, Locators, ModalDialog } from 'monaco-page-objects';
2222
import { expect } from 'chai';
2323
import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
2424
import { ShellExecutor } from '../../utils/ShellExecutor';
2525
import { ITestWorkspaceUtil } from '../../utils/workspace/ITestWorkspaceUtil';
26-
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
2726

2827
suite('"Check workspace idle timeout" test', function (): void {
2928
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
@@ -39,12 +38,15 @@ suite('"Check workspace idle timeout" test', function (): void {
3938
);
4039
const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
4140
const testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
42-
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
4341

4442
const stackName: string = 'Empty Workspace';
4543
const cheClusterName: string = 'devspaces';
4644
let stopWorkspaceTimeout: number = 0;
4745

46+
async function checkDialogButton(buttonName: string): Promise<void> {
47+
await driverHelper.waitVisibility(By.xpath(`//div[@class='dialog-buttons']//a[text()='${buttonName}']`));
48+
}
49+
4850
suiteSetup(function (): void {
4951
kubernetesCommandLineToolsExecutor.loginToOcp();
5052
shellExecutor.executeCommand('oc project openshift-devspaces');
@@ -84,21 +86,18 @@ suite('"Check workspace idle timeout" test', function (): void {
8486
await projectAndFileTests.performTrustAuthorDialog();
8587
});
8688

87-
test('Wait idle timeout dialog and click on "Return to Dashboard" button', async function (): Promise<void> {
89+
test('Wait idle timeout dialog and check Dialog buttons', async function (): Promise<void> {
8890
await driverHelper.waitVisibility(webCheCodeLocators.Dialog.details, TIMEOUT_CONSTANTS.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
8991
const dialog: ModalDialog = new ModalDialog();
9092
expect(await dialog.getDetails()).includes('Your workspace has stopped due to inactivity.');
91-
await dialog.pushButton('Return to dashboard');
93+
await checkDialogButton('Cancel');
94+
await checkDialogButton('Return to dashboard');
95+
await checkDialogButton('Restart your workspace');
9296
});
9397

9498
test('Check that the workspace has Stopped state', async function (): Promise<void> {
95-
await dashboard.waitPage();
96-
await workspaces.waitWorkspaceWithStoppedStatus(WorkspaceHandlingTests.getWorkspaceName());
97-
});
98-
99-
suiteTeardown('Open dashboard and close all other tabs', async function (): Promise<void> {
10099
await dashboard.openDashboard();
101-
await browserTabsUtil.closeAllTabsExceptCurrent();
100+
await workspaces.waitWorkspaceWithStoppedStatus(WorkspaceHandlingTests.getWorkspaceName());
102101
});
103102

104103
suiteTeardown('Stop and delete the workspace by API', async function (): Promise<void> {

0 commit comments

Comments
 (0)