@@ -2,35 +2,45 @@ import { test, expect } from "@playwright/test"
22import { CODE_SERVER_ADDRESS , STORAGE } from "../utils/constants"
33
44test . describe ( "Open Help > About" , ( ) => {
5- test . beforeEach ( async ( { page } ) => {
6- // Create a new context with the saved storage state
7- // so we don't have to logged in
8- // TODO@jsjoeio reset context and use storageState
5+ // Create a new context with the saved storage state
6+ // so we don't have to logged in
7+ const options : any = { }
8+ // TODO@jsjoeio
9+ // Fix this once https://github.com/microsoft/playwright-test/issues/240
10+ // is fixed
11+ if ( STORAGE ) {
912 const storageState = JSON . parse ( STORAGE ) || { }
10- await page . goto ( CODE_SERVER_ADDRESS , { waitUntil : "networkidle" } )
11- } )
13+ options . contextOptions = {
14+ storageState,
15+ }
16+ }
1217
13- test ( "should see a 'Help' then 'About' button in the Application Menu that opens a dialog" , async ( { page } ) => {
14- // Make sure the editor actually loaded
15- expect ( await page . isVisible ( "div.monaco-workbench" ) )
18+ test (
19+ "should see a 'Help' then 'About' button in the Application Menu that opens a dialog" ,
20+ options ,
21+ async ( { page } ) => {
22+ await page . goto ( CODE_SERVER_ADDRESS , { waitUntil : "networkidle" } )
23+ // Make sure the editor actually loaded
24+ expect ( await page . isVisible ( "div.monaco-workbench" ) )
1625
17- // Click the Application menu
18- await page . click ( "[aria-label='Application Menu']" )
19- // See the Help button
20- const helpButton = "a.action-menu-item span[aria-label='Help']"
21- expect ( await page . isVisible ( helpButton ) )
26+ // Click the Application menu
27+ await page . click ( "[aria-label='Application Menu']" )
28+ // See the Help button
29+ const helpButton = "a.action-menu-item span[aria-label='Help']"
30+ expect ( await page . isVisible ( helpButton ) )
2231
23- // Hover the helpButton
24- await page . hover ( helpButton )
32+ // Hover the helpButton
33+ await page . hover ( helpButton )
2534
26- // see the About button and click it
27- const aboutButton = "a.action-menu-item span[aria-label='About']"
28- expect ( await page . isVisible ( aboutButton ) )
29- // NOTE: it won't work unless you hover it first
30- await page . hover ( aboutButton )
31- await page . click ( aboutButton )
35+ // see the About button and click it
36+ const aboutButton = "a.action-menu-item span[aria-label='About']"
37+ expect ( await page . isVisible ( aboutButton ) )
38+ // NOTE: it won't work unless you hover it first
39+ await page . hover ( aboutButton )
40+ await page . click ( aboutButton )
3241
33- const codeServerText = "text=code-server"
34- expect ( await page . isVisible ( codeServerText ) )
35- } )
42+ const codeServerText = "text=code-server"
43+ expect ( await page . isVisible ( codeServerText ) )
44+ } ,
45+ )
3646} )
0 commit comments