Skip to content

Commit

Permalink
create WebTerminalTest typescript test
Browse files Browse the repository at this point in the history
  • Loading branch information
SkorikSergey committed Sep 6, 2023
1 parent aace77a commit 989e605
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/e2e/pageobjects/openshift/OcpMainPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export class OcpMainPage {
private static readonly SELECT_PROJECT_DROPDOWN: By = By.xpath('//div[@class="co-namespace-dropdown"]//button');
private static readonly PROJECT_FILTER_INPUT: By = By.xpath('//*[@data-test="dropdown-text-filter"]');
private static readonly SKIP_TOUR_BUTTON: By = By.xpath('//*[text()="Skip tour"]');
private static readonly WEB_TERMINAL_BUTTON: By = By.xpath('//button[@data-quickstart-id="qs-masthead-cloudshell"]');
private static readonly WEB_TERMINAL_PAGE: By = By.xpath('//*[@class="xterm-helper-textarea"]');

constructor(
@inject(CLASSES.DriverHelper)
Expand Down Expand Up @@ -81,6 +83,22 @@ export class OcpMainPage {
await this.driverHelper.enterValue(OcpMainPage.PROJECT_FILTER_INPUT, projectName);
await this.driverHelper.waitAndClick(this.getProjectDropdownItemLocator(projectName));
}

async openWebTerminal(): Promise<void> {
Logger.debug();

await this.waitOpenMainPage();
await this.driverHelper.waitAndClick(OcpMainPage.WEB_TERMINAL_BUTTON);
await this.driverHelper.waitPresence(OcpMainPage.WEB_TERMINAL_PAGE, TIMEOUT_CONSTANTS.TS_IDE_LOAD_TIMEOUT);
}

async typeToWebTerminal(text: string): Promise<void> {
Logger.debug();

await this.driverHelper.waitPresence(OcpMainPage.WEB_TERMINAL_PAGE, TIMEOUT_CONSTANTS.TS_IDE_LOAD_TIMEOUT);
await this.driverHelper.typeToInvisible(OcpMainPage.WEB_TERMINAL_PAGE, text);
}

private getRoleLocator(role: string): By {
return By.xpath(`//a//*[text()="${role}"]`);
}
Expand Down
25 changes: 25 additions & 0 deletions tests/e2e/specs/web-terminal/WebTerminalTest.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/** *******************************************************************
* copyright (c) 2023 Red Hat, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
import { CLASSES } from '../../configs/inversify.types';
import { e2eContainer } from '../../configs/inversify.config';
import { LoginTests } from '../../tests-library/LoginTests';
import { OcpMainPage } from '../../pageobjects/openshift/OcpMainPage';

suite('Login to Openshift console and start WebTerminal', function (): void {
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
const ocpMainPage: OcpMainPage = e2eContainer.get(CLASSES.OcpMainPage);

loginTests.loginIntoOcpConsole();

test('Open Web Terminal', async function (): Promise<void> {
await ocpMainPage.waitOpenMainPage();
await ocpMainPage.openWebTerminal();
});
});

0 comments on commit 989e605

Please sign in to comment.