@@ -26,7 +26,6 @@ export function testComponentCommands(path: string) {
2626 describe ( 'Component Commands' , function ( ) {
2727 let view : SideBarView ;
2828 let section : ViewSection ;
29- let commands : TreeItem [ ] ;
3029
3130 const componentName = 'nodejs-starter' ;
3231
@@ -79,7 +78,7 @@ export function testComponentCommands(path: string) {
7978 const commandsItem = await component . findChildItem ( 'Commands' ) ;
8079
8180 //check Commands has children
82- commands = await commandsItem . getChildren ( ) ;
81+ const commands : TreeItem [ ] = await commandsItem . getChildren ( ) ;
8382 const actualCommands = [ ] ;
8483 for ( const command of commands ) {
8584 actualCommands . push ( await command . getLabel ( ) ) ;
@@ -88,11 +87,17 @@ export function testComponentCommands(path: string) {
8887 } ) ;
8988
9089 it ( 'Command can be ran' , async function ( ) {
91- //get first command's label and select it
90+ const components = await section . getVisibleItems ( ) ;
91+ const component = components [ 0 ] as TreeItem ;
92+
93+ await component . expand ( ) ;
94+
95+ const commandsItem = await component . findChildItem ( 'Commands' ) ;
96+ const commands : TreeItem [ ] = await commandsItem . getChildren ( ) ;
97+
9298 const commandName = await commands [ 0 ] . getLabel ( ) ;
9399 await commands [ 0 ] . select ( ) ;
94100
95- //Check for action button and click it
96101 const actionButton = await commands [ 0 ] . getActionButton ( 'Run Command' ) ;
97102 await actionButton . click ( ) ;
98103
0 commit comments