@@ -194,7 +194,11 @@ export class CodeServer {
194
194
export class CodeServerPage {
195
195
private readonly editorSelector = "div.monaco-workbench"
196
196
197
- constructor ( private readonly codeServer : CodeServer , public readonly page : Page ) {
197
+ constructor (
198
+ private readonly codeServer : CodeServer ,
199
+ public readonly page : Page ,
200
+ private readonly authenticated : boolean ,
201
+ ) {
198
202
this . page . on ( "console" , ( message ) => {
199
203
this . codeServer . logger . debug ( message )
200
204
} )
@@ -215,11 +219,18 @@ export class CodeServerPage {
215
219
}
216
220
217
221
/**
218
- * Navigate to a code-server endpoint. By default go to the root.
222
+ * Navigate to a code-server endpoint (root by default). Then wait for the
223
+ * editor to become available.
219
224
*/
220
225
async navigate ( endpoint = "/" ) {
221
226
const to = new URL ( endpoint , await this . codeServer . address ( ) )
222
227
await this . page . goto ( to . toString ( ) , { waitUntil : "networkidle" } )
228
+
229
+ // If we aren't authenticated we'll see a login page so we can't wait until
230
+ // the editor is ready.
231
+ if ( this . authenticated ) {
232
+ await this . reloadUntilEditorIsReady ( )
233
+ }
223
234
}
224
235
225
236
/**
@@ -456,21 +467,7 @@ export class CodeServerPage {
456
467
}
457
468
458
469
/**
459
- * Navigates to code-server then reloads until the editor is ready.
460
- *
461
- * It is recommended to run setup before using this model in any tests.
462
- */
463
- async setup ( authenticated : boolean , endpoint = "/" ) {
464
- await this . navigate ( endpoint )
465
- // If we aren't authenticated we'll see a login page so we can't wait until
466
- // the editor is ready.
467
- if ( authenticated ) {
468
- await this . reloadUntilEditorIsReady ( )
469
- }
470
- }
471
-
472
- /**
473
- * Execute a command in t root of the instance's workspace directory.
470
+ * Execute a command in the root of the instance's workspace directory.
474
471
*/
475
472
async exec ( command : string ) : Promise < void > {
476
473
await util . promisify ( cp . exec ) ( command , {
0 commit comments