66 ViewControl ,
77 ViewSection ,
88 InputBox ,
9- OutputView ,
10- TreeItem ,
119} from "wdio-vscode-service" ;
1210
1311// eslint-disable-next-line @typescript-eslint/naming-convention
@@ -21,17 +19,6 @@ const ViewSectionTypes = [
2119] as const ;
2220export type ViewSectionType = ( typeof ViewSectionTypes ) [ number ] ;
2321
24- export async function selectOutputChannel (
25- outputView : OutputView ,
26- channelName : string
27- ) {
28- if ( ( await outputView . getCurrentChannel ( ) ) === channelName ) {
29- return ;
30- }
31- outputView . locatorMap . BottomBarViews . outputChannels = `ul[aria-label="Output actions"] select` ;
32- await outputView . selectChannel ( channelName ) ;
33- }
34-
3522export async function findViewSection ( name : ViewSectionType ) {
3623 const workbench = await browser . getWorkbench ( ) ;
3724
@@ -54,14 +41,12 @@ export async function findViewSection(name: ViewSectionType) {
5441 ) ;
5542 const views =
5643 ( await ( await control ?. openView ( ) ) ?. getContent ( ) ?. getSections ( ) ) ?? [ ] ;
57- console . log ( "Views:" , views . length ) ;
5844 for ( const v of views ) {
59- const title = await v . elem . getText ( ) ;
60- console . log ( "View title:" , title ) ;
45+ const title = await v . getTitle ( ) ;
6146 if ( title === null ) {
6247 continue ;
6348 }
64- if ( title . toUpperCase ( ) . includes ( name ) ) {
49+ if ( title . toUpperCase ( ) === name ) {
6550 return v ;
6651 }
6752 }
@@ -350,15 +335,28 @@ export async function waitForNotification(message: string, action?: string) {
350335 ) ;
351336}
352337
353- export async function waitForDeployment ( outputView : OutputView ) {
338+ export async function waitForDeployment ( ) {
354339 console . log ( "Waiting for deployment to finish" ) ;
355- await browser . executeWorkbench ( async ( vscode ) => {
356- await vscode . commands . executeCommand ( "workbench.panel.output.focus" ) ;
357- } ) ;
358- await selectOutputChannel ( outputView , "Databricks Bundle Logs" ) ;
340+ const workbench = await driver . getWorkbench ( ) ;
359341 await browser . waitUntil (
360342 async ( ) => {
361343 try {
344+ await browser . executeWorkbench ( async ( vscode ) => {
345+ await vscode . commands . executeCommand (
346+ "workbench.panel.output.focus"
347+ ) ;
348+ } ) ;
349+ const outputView = await workbench
350+ . getBottomBar ( )
351+ . openOutputView ( ) ;
352+
353+ if (
354+ ( await outputView . getCurrentChannel ( ) ) !==
355+ "Databricks Bundle Logs"
356+ ) {
357+ await outputView . selectChannel ( "Databricks Bundle Logs" ) ;
358+ }
359+
362360 const logs = ( await outputView . getText ( ) ) . join ( "" ) ;
363361 console . log ( "------------ Bundle Output ------------" ) ;
364362 console . log ( logs ) ;
@@ -378,22 +376,3 @@ export async function waitForDeployment(outputView: OutputView) {
378376 }
379377 ) ;
380378}
381-
382- export async function getActionButton ( item : TreeItem , label : string ) {
383- const actions = await item . getActionButtons ( ) ;
384- if ( actions . length > 0 ) {
385- for ( const item of actions ) {
386- console . log ( "Checking action button:" , item . getLabel ( ) ) ;
387- console . log (
388- "Action button element:" ,
389- await ( await item . elem ) . getHTML ( )
390- ) ;
391- const itemLabel =
392- item . getLabel ( ) ?? ( await item . elem . getAttribute ( "aria-label" ) ) ;
393- if ( itemLabel . indexOf ( label ) > - 1 ) {
394- return item ;
395- }
396- }
397- }
398- return undefined ;
399- }
0 commit comments