Skip to content

Commit 05dacb5

Browse files
lgrossmaodockal
andauthored
Adding About command test (#2734)
Signed-off-by: Lukas Grossmann <[email protected]> Signed-off-by: Lukas Grossmann <[email protected]> Co-authored-by: Ondrej Dockal <[email protected]>
1 parent 26a0307 commit 05dacb5

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*-----------------------------------------------------------------------------------------------
2+
* Copyright (c) Red Hat, Inc. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE file in the project root for license information.
4+
*-----------------------------------------------------------------------------------------------*/
5+
6+
import { InputBox, Workbench } from 'vscode-extension-tester';
7+
8+
export async function activateCommand(command: string){
9+
const prompt = await new Workbench().openCommandPrompt() as InputBox;
10+
await prompt.setText(command);
11+
await prompt.confirm();
12+
13+
}

test/ui/public-ui-test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
55

6+
import { checkAboutCommand } from './suite/command-about';
67
import { testDevfileRegistries } from './suite/devfileRegistries';
78
import { checkExtension } from './suite/extension';
89
import { checkOpenshiftView } from './suite/openshift';
910

1011
describe('Extension public-facing UI tests', () => {
1112
checkExtension();
1213
checkOpenshiftView();
14+
checkAboutCommand();
1315
testDevfileRegistries();
1416
});

test/ui/smoke-test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as fs from 'fs-extra';
88
import { checkExtension } from './suite/extension';
99
import { checkOpenshiftView } from './suite/openshift';
1010
import { createComponentTest } from './suite/component';
11+
import { checkAboutCommand } from './suite/command-about';
1112

1213
describe('Extension smoke test', () => {
1314
const kubeConfig = path.join(process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'], '.kube', 'config');
@@ -32,4 +33,5 @@ describe('Extension smoke test', () => {
3233
checkExtension();
3334
checkOpenshiftView();
3435
createComponentTest(contextFolder);
36+
checkAboutCommand();
3537
});

test/ui/suite/command-about.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*-----------------------------------------------------------------------------------------------
2+
* Copyright (c) Red Hat, Inc. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE file in the project root for license information.
4+
*-----------------------------------------------------------------------------------------------*/
5+
6+
import { expect } from 'chai';
7+
import { TerminalView } from 'vscode-extension-tester';
8+
import { activateCommand } from '../common/command-activator';
9+
10+
export function checkAboutCommand() {
11+
describe('About Command', () => {
12+
const command = '>OpenShift: About';
13+
const expectedTerminalName = 'OpenShift: Show odo Version';
14+
const odoVersion = 'odo v3';
15+
16+
before(async () => {
17+
await activateCommand(command);
18+
})
19+
20+
it('New terminal opens', async function() {
21+
this.timeout(60000);
22+
await new Promise(res => setTimeout(res, 6000));
23+
const terminalName = await new TerminalView().getCurrentChannel();
24+
expect(terminalName).to.include(expectedTerminalName);
25+
});
26+
27+
it('Terminal shows according information', async function() {
28+
this.timeout(60000);
29+
const terminalText = await new TerminalView().getText();
30+
expect(terminalText).to.include(odoVersion);
31+
});
32+
});
33+
}

0 commit comments

Comments
 (0)