1+ import { InputBox } from 'vscode-extension-tester' ;
12import {
2- InputBox ,
3- QuickPickItem ,
4- StatusBar ,
5- VSBrowser ,
6- } from 'vscode-extension-tester' ;
7- import {
3+ getDhStatusBarItem ,
4+ getServerItems ,
85 getSidebarViewItem ,
9- openFileResources ,
106 setup ,
117 SIMPLE_TICKING3_PY ,
128 SIMPLE_TICKING_MD ,
139 step ,
1410 teardown ,
1511 TEST_GROOVY ,
1612 TEST_TXT ,
13+ waitForServerConnection ,
1714} from '../util' ;
1815import { EditorViewExtended } from '../pageObjects' ;
1916import { assert } from 'chai' ;
20- import { SERVER_TITLE , STATUS_BAR_TITLE , VIEW_NAME } from '../util/constants' ;
17+ import { VIEW_NAME } from '../util/constants' ;
2118
2219describe ( 'Status Bar Tests' , ( ) => {
2320 let editorView : EditorViewExtended ;
24- let statusBar : StatusBar ;
2521
2622 before ( async ( ) => {
27- const explorerView = await setup ( ) ;
28-
29- await openFileResources (
23+ await setup (
3024 SIMPLE_TICKING_MD . path ,
3125 SIMPLE_TICKING3_PY . path ,
3226 TEST_GROOVY . path ,
3327 TEST_TXT . path
3428 ) ;
3529
36- await explorerView ?. closeView ( ) ;
37-
3830 editorView = new EditorViewExtended ( ) ;
39- statusBar = new StatusBar ( ) ;
4031 } ) ;
4132
4233 after ( async ( ) => {
@@ -55,14 +46,12 @@ describe('Status Bar Tests', () => {
5546 ] as const ) {
5647 await step ( s , fileName , async stepLabel => {
5748 await editorView . openTextEditor ( fileName ) ;
58- const statusBarItem = await statusBar . getItem (
59- 'plug Deephaven: Disconnected'
60- ) ;
49+ const statusBarItem = await getDhStatusBarItem ( ) ;
6150
6251 if ( isVisible ) {
63- assert . isDefined ( statusBarItem , stepLabel ) ;
52+ assert . isNotNull ( statusBarItem , stepLabel ) ;
6453 } else {
65- assert . isUndefined ( statusBarItem , stepLabel ) ;
54+ assert . isNull ( statusBarItem , stepLabel ) ;
6655 }
6756 } ) ;
6857 }
@@ -71,41 +60,26 @@ describe('Status Bar Tests', () => {
7160 it ( 'should connect to server on click' , async ( ) => {
7261 await editorView . openTextEditor ( SIMPLE_TICKING3_PY . name ) ;
7362
74- await step ( 1 , 'Click Deephaven status bar item' , async ( ) => {
75- const statusBarItem = await statusBar . getItem (
76- STATUS_BAR_TITLE . disconnected
77- ) ;
78- assert . isDefined ( statusBarItem ) ;
63+ await step ( 1 , 'Click Deephaven status bar item' , async stepLabel => {
64+ const statusBarItem = await getDhStatusBarItem ( ) ;
65+ assert . isNotNull ( statusBarItem , stepLabel ) ;
7966 await statusBarItem . click ( ) ;
8067 } ) ;
8168
8269 await step ( 2 , 'Select connection' , async ( ) => {
8370 const input = await InputBox . create ( ) ;
84- const qpItem = new QuickPickItem ( 0 , input ) ;
85- await qpItem . click ( ) ;
71+ await input . selectQuickPick ( 0 ) ;
8672
87- // We could call `ViewControl.openView` to ensure DH view is opened, but we
88- // want to test it opens automatically when a connection is initiated. The
89- // 500ms sleep matches the timeout that `ViewControl.openView` uses but
90- // without attempting to open the view.
91- await VSBrowser . instance . driver . sleep ( 500 ) ;
73+ await waitForServerConnection ( ) ;
9274 } ) ;
9375
94- step ( 3 , 'Verify server node' , async stepLabel => {
95- const localhost1000Item = await getSidebarViewItem (
96- VIEW_NAME . servers ,
97- SERVER_TITLE
98- ) ;
76+ await step ( 3 , 'Verify server node' , async stepLabel => {
77+ const [ serverItem ] = await getServerItems ( ) ;
9978
100- assert . isDefined ( localhost1000Item , stepLabel ) ;
101- assert . equal (
102- await localhost1000Item . getText ( ) ,
103- `${ SERVER_TITLE } (1)` ,
104- stepLabel
105- ) ;
79+ assert . isDefined ( serverItem , stepLabel ) ;
10680 } ) ;
10781
108- step ( 4 , 'Verify connection node' , async stepLabel => {
82+ await step ( 4 , 'Verify connection node' , async stepLabel => {
10983 const simpleTickingEditor = await getSidebarViewItem (
11084 VIEW_NAME . connections ,
11185 SIMPLE_TICKING3_PY . name
0 commit comments