Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Create WebTerminalTest typescript test #22482

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
});
});
Loading