File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Page } from "playwright"
2
+ import { CODE_SERVER_ADDRESS } from "../../utils/constants"
3
+ // This is a Page Object Model
4
+ // We use these to simplify e2e test authoring
5
+ // See Playwright docs: https://playwright.dev/docs/pom/
6
+ export class CodeServer {
7
+ page : Page
8
+
9
+ constructor ( page : Page ) {
10
+ this . page = page
11
+ }
12
+ async navigate ( ) {
13
+ await this . page . goto ( CODE_SERVER_ADDRESS , { waitUntil : "networkidle" } )
14
+ // Make sure the editor actually loaded
15
+ await this . page . isVisible ( "div.monaco-workbench" )
16
+ }
17
+ /**
18
+ * Opens the default folder /User if no arg passed
19
+ * @param absolutePath Example: /Users/jp/.local/share/code-server/User/
20
+ *
21
+ */
22
+ async openFolder ( absolutePath ?: string ) {
23
+ // Check if no folder is opened
24
+ const folderIsNotOpen = await this . page . isVisible ( "text=You have not yet opened" )
25
+
26
+ if ( folderIsNotOpen ) {
27
+ // Open the default folder
28
+ await this . page . keyboard . press ( "Meta+O" )
29
+ await this . page . keyboard . press ( "Enter" )
30
+ await this . page . waitForLoadState ( "networkidle" )
31
+ }
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments