File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import { promises as fs } from "fs"
2+ import * as path from "path"
3+ import { describe , test , expect } from "./baseFixture"
4+
5+ describe ( "Webviews" , [ "--disable-workspace-trust" ] , { } , ( ) => {
6+ test ( "should preview a Markdown file" , async ( { codeServerPage } ) => {
7+ // Create Markdown file
8+ const heading = "Hello world"
9+ const dir = await codeServerPage . workspaceDir
10+ const file = path . join ( dir , "text.md" )
11+ await fs . writeFile ( file , `# ${ heading } ` )
12+ await codeServerPage . openFile ( file )
13+
14+ // Open Preview
15+ await codeServerPage . executeCommandViaMenus ( "Markdown: Open Preview to the Side" )
16+ // Wait for the iframe to open and load
17+ await codeServerPage . waitForTab ( `Preview ${ file } ` )
18+
19+ // It's an iframe within an iframe
20+ // so we have to do .frameLocator twice
21+ const renderedText = await codeServerPage . page
22+ . frameLocator ( "iframe.webview.ready" )
23+ . frameLocator ( "#active-frame" )
24+ . locator ( "text=Hello world" )
25+
26+ expect ( renderedText ) . toBeVisible
27+ } )
28+ } )
You can’t perform that action at this time.
0 commit comments