Skip to content

Commit 8fd2c45

Browse files
authored
Adding Focus On view test (#2751)
* Adding Focus On view test Signed-off-by: Lukas Grossmann <lgrossma@redhat.com> * Reworking focus on test Signed-off-by: Lukas Grossmann <lgrossma@redhat.com> * removing console logs Signed-off-by: Lukas Grossmann <lgrossma@redhat.com> * using const instead of var Signed-off-by: Lukas Grossmann <lgrossma@redhat.com> * using conditional timeout Signed-off-by: Lukas Grossmann <lgrossma@redhat.com> * fixing missing bracket Signed-off-by: Lukas Grossmann <lgrossma@redhat.com> Signed-off-by: Lukas Grossmann <lgrossma@redhat.com>
1 parent 5cd7d13 commit 8fd2c45

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

test/ui/public-ui-test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
import { checkAboutCommand } from './suite/command-about';
77
import { testDevfileRegistries } from './suite/devfileRegistries';
88
import { checkExtension } from './suite/extension';
9+
import { checkFocusOnCommands } from './suite/focusOn';
910
import { checkOpenshiftView } from './suite/openshift';
1011

1112
describe('Extension public-facing UI tests', () => {
1213
checkExtension();
1314
checkOpenshiftView();
1415
checkAboutCommand();
1516
testDevfileRegistries();
17+
checkFocusOnCommands();
1618
});

test/ui/suite/focusOn.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 { ActivityBar, SideBarView, VSBrowser } from 'vscode-extension-tester'
8+
import { activateCommand } from '../common/command-activator';
9+
import { VIEWS } from '../common/constants';
10+
11+
export function checkFocusOnCommands() {
12+
describe('Focus on Commands', () => {
13+
let view: SideBarView;
14+
const sections = [VIEWS.appExplorer, VIEWS.components, VIEWS.compRegistries, VIEWS.debugSessions];
15+
16+
before('Open OpenShift View', async function(){
17+
this.timeout(10000);
18+
view = await (await new ActivityBar().getViewControl('OpenShift')).openView();
19+
VSBrowser.instance.driver.wait(async () => !(await view.getContent().hasProgress()),
20+
5000,
21+
'Progress bar has not been hidden within the timeout'
22+
);
23+
for(const section of sections){
24+
await (await view.getContent().getSection(section)).collapse();
25+
}
26+
})
27+
28+
sections.forEach(section =>
29+
it(`Focus on ${section} view`, async function() {
30+
this.timeout(30000);
31+
await activateCommand(`>OpenShift: Focus on ${section} view`);
32+
expect(await (await view.getContent().getSection(section)).isExpanded()).to.be.true;
33+
})
34+
)
35+
});
36+
}

0 commit comments

Comments
 (0)