-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add first tests for speaker notes
- Loading branch information
1 parent
48bd3ac
commit 6346bff
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { describe, it } from "mocha"; | ||
import { $, expect, browser } from "@wdio/globals"; | ||
|
||
describe("speaker-notes", () => { | ||
beforeEach(async () => { | ||
await browser.url("https://google.github.io/comprehensive-rust/"); | ||
}); | ||
|
||
it("contains summary with heading and button", async () => { | ||
const summary$ = await $("details summary"); | ||
await expect(summary$).toExist(); | ||
await expect(summary$.$("#speaker-notes")).toHaveText("Speaker Notes"); | ||
await expect(summary$.$(".pop-out")).toExist(); | ||
}); | ||
|
||
it("opens a new window on button click and hide details on main page", async () => { | ||
const details$ = await $("details"); | ||
const button$ = await $("details summary .pop-out"); | ||
await expect(details$).toBeDisplayed(); | ||
button$.scrollIntoView(); | ||
await button$.click(); | ||
await expect(details$).not.toBeDisplayed(); | ||
|
||
// a new window should have opened, it should be the second one | ||
const handles = await browser.getWindowHandles(); | ||
await browser.switchToWindow(handles[1]); | ||
await expect(browser).toHaveUrl( | ||
expect.stringContaining("#speaker-notes-open") | ||
); | ||
}); | ||
}); |