1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-27 16:25:43 +02:00

Check if menu bar buttons are display and functionality works (#2621)

Test the main page for existence of
- theme button visible
  - clicking shows the list of themes
- search button visible
  - and tests successful search for "Welcome"
- language button visible
  - clicking shows the list of languages

this is testing functionality missing in dev environments in
https://github.com/google/comprehensive-rust/issues/2588 and is relevant
for https://github.com/google/comprehensive-rust/issues/2620
This commit is contained in:
michael-kerscher 2025-02-04 10:36:34 +01:00 committed by GitHub
parent 466f213927
commit 2cf9a35b23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 9 deletions

View File

@ -1,9 +0,0 @@
import { describe, it } from "mocha";
import { expect, browser } from "@wdio/globals";
describe("Basic test", () => {
it("should have the default_theme light", async () => {
await browser.url("/");
expect(await browser.execute(() => window.default_theme)).toBe("light");
});
});

32
tests/src/generic_page.ts Normal file
View File

@ -0,0 +1,32 @@
import { describe, it } from "mocha";
import { expect, browser, $ } from "@wdio/globals";
describe("Generic page", () => {
beforeEach(async () => {
await browser.url("/");
});
it("should have the default_theme light", async () => {
expect(await browser.execute(() => window.default_theme)).toBe("light");
});
it("should have theme button and show theme list on click", async () => {
await expect($("#theme-toggle")).toBeDisplayed();
await $("#theme-toggle").click();
await expect($("#theme-list")).toBeDisplayed();
});
it("should have search button and successfully provide search results on search", async () => {
await expect($("#search-toggle")).toBeDisplayed();
await $("#search-toggle").click();
await browser.keys(["Welcome"]);
// any of the <a> links in the searchresults is containing "Welcome"
await expect($("#searchresults").$("*=Welcome")).toBeDisplayed();
});
it("should have language button and show language list on click", async () => {
await expect($("#language-toggle")).toBeDisplayed();
await $("#language-toggle").click();
await expect($("#language-list")).toBeDisplayed();
});
});