@@ -33,4 +33,33 @@ describe("CodeServer", true, [], () => {
33
33
await fs . writeFile ( file , "bar" )
34
34
await codeServerPage . openFile ( file )
35
35
} )
36
+
37
+ test ( "should not share state with other paths" , async ( { codeServerPage } ) => {
38
+ const dir = await codeServerPage . dir ( )
39
+ const file = path . join ( dir , "foo" )
40
+ await fs . writeFile ( file , "bar" )
41
+
42
+ await codeServerPage . openFile ( file )
43
+
44
+ // If we reload now VS Code will be unable to save the state changes so wait
45
+ // until those have been written to the database. It flushes every five
46
+ // seconds so we need to wait at least that long.
47
+ await codeServerPage . page . waitForTimeout ( 5500 )
48
+
49
+ // The tab should re-open on refresh.
50
+ await codeServerPage . page . reload ( )
51
+ await codeServerPage . waitForTab ( file )
52
+
53
+ // The tab should not re-open on a different path.
54
+ await codeServerPage . setup ( true , "/vscode" )
55
+
56
+ // Do the same thing because there does not seem to be any good way to wait
57
+ // until the state is loaded. This way we can wait for our new file which
58
+ // will tell us the state loaded.
59
+ // const newFile = path.join(dir, "baz")
60
+ // await fs.writeFile(newFile, "qux")
61
+ // await codeServerPage.openFile(file)
62
+
63
+ expect ( await codeServerPage . tabIsVisible ( file ) ) . toBe ( false )
64
+ } )
36
65
} )
0 commit comments