Skip to content

Commit

Permalink
fix WebTerminal e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SkorikSergey committed Nov 28, 2024
1 parent 8f466ad commit 740bf8a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/pageobjects/webterminal/WebTerminalPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class WebTerminalPage {
}

async clickOnTimeUnitDropDown(): Promise<void> {
await this.driverHelper.waitAndClick(WebTerminalPage.TIME_UNIT_DROP_DAWN);
await this.driverHelper.scrollToAndClick(WebTerminalPage.TIME_UNIT_DROP_DAWN);
}
async selectTimeUnit(timeUnits: TimeUnits): Promise<void> {
await this.driverHelper.waitAndClick(By.xpath(`//button[@data-test-id='dropdown-menu' and text()='${timeUnits}']`));
Expand Down
28 changes: 15 additions & 13 deletions tests/e2e/specs/web-terminal/WebTerminalUnderAdmin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,17 @@ suite(`Login to Openshift console and start WebTerminal ${BASE_TEST_CONSTANTS.TE
expect(commandResult).contains('admin');
});
test('Verify help command under admin user', async function (): Promise<void> {
const helpCommandExpectedResult: string =
'oc.*\\d+\\.\\d+\\.\\d+.*OpenShift CLI\n' +
'kubectl.*\\d+\\.\\d+\\.\\d+.*Kubernetes CLI\n' +
'kustomize.*\\d+\\.\\d+\\.\\d+.*Kustomize CLI\n' +
'helm.*\\d+\\.\\d+\\.\\d+.*Helm CLI\n' +
'kn.*\\d+\\.\\d+\\.\\d+.*KNative CLI\n' +
'tkn.*\\d+\\.\\d+\\.\\d+.*Tekton CLI\n' +
'subctl.*\\d+\\.\\d+\\.\\d+.*Submariner CLI\n' +
'odo.*\\d+\\.\\d+\\.\\d+.*Red Hat OpenShift Developer CLI\n' +
'virtctl.*\\d+\\.\\d+\\.\\d+.*KubeVirt CLI\n' +
'rhoas.*\\d+\\.\\d+\\.\\d+.*Red Hat OpenShift Application Services CLI\n' +
'jq.*\\d+\\.\\d+.*jq';
const expectedStrings: string[] = [
'OpenShift CLI',
'Kubernetes CLI',
'Kustomize CLI (built-in to kubectl)',
'Helm CLI',
'KNative CLI',
'Tekton CLI',
'Submariner CLI',
'KubeVirt CLI',
'jq'
];

await webTerminal.typeAndEnterIntoWebTerminal(`help > ${fileForVerificationTerminalCommands}`);

Expand All @@ -87,7 +86,10 @@ suite(`Login to Openshift console and start WebTerminal ${BASE_TEST_CONSTANTS.TE
`cat /home/user/${fileForVerificationTerminalCommands}`,
webTerminalToolContainerName
);
expect(commandResult).to.match(new RegExp(helpCommandExpectedResult));

expectedStrings.forEach((expectedString): void => {
expect(commandResult).to.contain(expectedString);
});
});

test('Verify help command under admin user', async function (): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ suite(`Login to Openshift console and check WebTerminal ${BASE_TEST_CONSTANTS.TE

suiteSetup(function (): void {
kubernetesCommandLineToolsExecutor.loginToOcp();
kubernetesCommandLineToolsExecutor.deleteProject(testProjectName);
});

suiteTeardown(function (): void {
Expand Down

0 comments on commit 740bf8a

Please sign in to comment.