@@ -11,6 +11,8 @@ export function setup(logger: Logger) {
11
11
12
12
describe ( 'Connections Pane' , ( ) => {
13
13
14
+ const tables = [ 'tracks' , 'playlist_track' , 'playlists' , 'media_types' , 'invoice_items' , 'invoices' , 'genres' , 'employees' , 'customers' , 'artists' , 'albums' ] ;
15
+
14
16
// Shared before/after handling
15
17
installAllHandlers ( logger ) ;
16
18
@@ -28,7 +30,7 @@ export function setup(logger: Logger) {
28
30
after ( async function ( ) {
29
31
30
32
const app = this . app as Application ;
31
- app . code . waitAndClick ( 'a[aria-label="Remove connection from history"]' ) ;
33
+ app . workbench . positronConnections . removeConnectionButton . click ( ) ;
32
34
33
35
} ) ;
34
36
@@ -44,27 +46,15 @@ export function setup(logger: Logger) {
44
46
console . log ( 'Opening connections pane' ) ;
45
47
await app . workbench . positronVariables . doubleClickVariableRow ( 'conn' ) ;
46
48
47
- await app . code . waitAndClick ( 'div[aria-label="SQLite Connection"]' ) ;
48
-
49
- await app . code . waitAndClick ( 'div[aria-label="main"]' ) ;
49
+ await app . workbench . positronConnections . openPythonTable ( ) ;
50
50
51
51
// click in reverse order to avoid scrolling issues
52
- await app . code . waitAndClick ( 'div[aria-label="tracks"]' ) ;
53
- await app . code . waitAndClick ( 'div[aria-label="playlist_track"]' ) ;
54
- await app . code . waitAndClick ( 'div[aria-label="playlists"]' ) ;
55
- await app . code . waitAndClick ( 'div[aria-label="media_types"]' ) ;
56
- await app . code . waitAndClick ( 'div[aria-label="invoice_items"]' ) ;
57
- await app . code . waitAndClick ( 'div[aria-label="invoices"]' ) ;
58
- await app . code . waitAndClick ( 'div[aria-label="genres"]' ) ;
59
- await app . code . waitAndClick ( 'div[aria-label="employees"]' ) ;
60
- await app . code . waitAndClick ( 'div[aria-label="customers"]' ) ;
61
- await app . code . waitAndClick ( 'div[aria-label="artists"]' ) ;
62
- await app . code . waitAndClick ( 'div[aria-label="albums"]' ) ;
52
+ await app . workbench . positronConnections . openConnectionsNodes ( tables ) ;
63
53
64
54
// disconnect icon appearance requires hover
65
- await app . code . driver . getLocator ( 'div[aria-label="SQLite Connection"]' ) . hover ( ) ;
66
- await app . code . waitAndClick ( '.codicon-debug-disconnect' ) ;
67
- await app . code . waitForElement ( 'a[aria-label="Execute connection code in the console"]' ) ;
55
+ await app . workbench . positronConnections . pythonConnectionOpenState . hover ( ) ;
56
+ await app . workbench . positronConnections . disonnectButton . click ( ) ;
57
+ await app . workbench . positronConnections . reconnectButton . waitforVisible ( ) ;
68
58
} ) ;
69
59
} ) ;
70
60
@@ -84,7 +74,7 @@ export function setup(logger: Logger) {
84
74
after ( async function ( ) {
85
75
86
76
const app = this . app as Application ;
87
- app . code . waitAndClick ( 'a[aria-label="Remove connection from history"]' ) ;
77
+ app . workbench . positronConnections . removeConnectionButton . click ( ) ;
88
78
89
79
} ) ;
90
80
@@ -98,33 +88,17 @@ export function setup(logger: Logger) {
98
88
await app . workbench . quickaccess . runCommand ( 'r.sourceCurrentFile' ) ;
99
89
100
90
console . log ( 'Opening connections pane' ) ;
101
- await app . code . waitAndClick ( 'a[aria-label="Connections"]' ) ;
102
-
103
- // not working due to timing:
104
- // await app.code.waitAndClick('div[aria-label="SQLiteConnection"]');
105
- // workaround for above:
106
- await app . code . driver . getLocator ( 'a:has-text("SQLiteConnection")' ) . click ( ) ;
91
+ await app . workbench . positronConnections . connectionsTabLink . click ( ) ;
107
92
108
- await app . code . waitAndClick ( 'div[aria-label="SQLiteConnection"]:last-child' ) ;
109
- await app . code . waitAndClick ( 'div[aria-label="Default"]' ) ;
93
+ await app . workbench . positronConnections . openRTable ( ) ;
110
94
111
95
// click in reverse order to avoid scrolling issues
112
- await app . code . waitAndClick ( 'div[aria-label="tracks"]' ) ;
113
- await app . code . waitAndClick ( 'div[aria-label="playlist_track"]' ) ;
114
- await app . code . waitAndClick ( 'div[aria-label="playlists"]' ) ;
115
- await app . code . waitAndClick ( 'div[aria-label="media_types"]' ) ;
116
- await app . code . waitAndClick ( 'div[aria-label="invoice_items"]' ) ;
117
- await app . code . waitAndClick ( 'div[aria-label="invoices"]' ) ;
118
- await app . code . waitAndClick ( 'div[aria-label="genres"]' ) ;
119
- await app . code . waitAndClick ( 'div[aria-label="employees"]' ) ;
120
- await app . code . waitAndClick ( 'div[aria-label="customers"]' ) ;
121
- await app . code . waitAndClick ( 'div[aria-label="artists"]' ) ;
122
- await app . code . waitAndClick ( 'div[aria-label="albums"]' ) ;
96
+ await app . workbench . positronConnections . openConnectionsNodes ( tables ) ;
123
97
124
98
// disconnect icon appearance requires hover
125
- await app . code . driver . getLocator ( 'div[aria-label="SQLiteConnection"]:first-child' ) . hover ( ) ;
126
- await app . code . waitAndClick ( '.codicon-debug-disconnect' ) ;
127
- await app . code . waitForElement ( 'a[aria-label="Execute connection code in the console"]' ) ;
99
+ await app . workbench . positronConnections . rConnectionOpenState . hover ( ) ;
100
+ await app . workbench . positronConnections . disonnectButton . click ( ) ;
101
+ await app . workbench . positronConnections . reconnectButton . waitforVisible ( ) ;
128
102
} ) ;
129
103
} ) ;
130
104
} ) ;
0 commit comments