Skip to content

Commit b54806f

Browse files
test: add first tests for speaker notes
1 parent 323dcd8 commit b54806f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/src/speaker-notes.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
});

0 commit comments

Comments
 (0)