File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ import { describe , it } from "mocha" ;
2+ import { $ , expect , browser } from "@wdio/globals" ;
3+
4+ describe ( "speaker-notes" , ( ) => {
5+ beforeEach ( async ( ) => {
6+ await browser . url ( "https://google.github.io/comprehensive-rust/" ) ;
7+ } ) ;
8+
9+ it ( "contains summary with heading and button" , async ( ) => {
10+ const summary$ = await $ ( "details summary" ) ;
11+ await expect ( summary$ ) . toExist ( ) ;
12+ await expect ( summary$ . $ ( "#speaker-notes" ) ) . toHaveText ( "Speaker Notes" ) ;
13+ await expect ( summary$ . $ ( ".pop-out" ) ) . toExist ( ) ;
14+ } ) ;
15+
16+ it ( "opens a new window on button click and hide details on main page" , async ( ) => {
17+ const details$ = await $ ( "details" ) ;
18+ const button$ = await $ ( "details summary .pop-out" ) ;
19+ await expect ( details$ ) . toBeDisplayed ( ) ;
20+ button$ . scrollIntoView ( ) ;
21+ await button$ . click ( ) ;
22+ await expect ( details$ ) . not . toBeDisplayed ( ) ;
23+
24+ // a new window should have opened, it should be the second one
25+ const handles = await browser . getWindowHandles ( ) ;
26+ await browser . switchToWindow ( handles [ 1 ] ) ;
27+ await expect ( browser ) . toHaveUrl (
28+ expect . stringContaining ( "#speaker-notes-open" )
29+ ) ;
30+ } ) ;
31+ } ) ;
You can’t perform that action at this time.
0 commit comments