From 2cf9a35b23283025ce6007cf02c95eb3323cca78 Mon Sep 17 00:00:00 2001 From: michael-kerscher Date: Tue, 4 Feb 2025 10:36:34 +0100 Subject: [PATCH] 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 --- tests/src/basic.test.ts | 9 --------- tests/src/generic_page.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 9 deletions(-) delete mode 100644 tests/src/basic.test.ts create mode 100644 tests/src/generic_page.ts diff --git a/tests/src/basic.test.ts b/tests/src/basic.test.ts deleted file mode 100644 index 7499c73d3d99..000000000000 --- a/tests/src/basic.test.ts +++ /dev/null @@ -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"); - }); -}); diff --git a/tests/src/generic_page.ts b/tests/src/generic_page.ts new file mode 100644 index 000000000000..252c7d4cd82c --- /dev/null +++ b/tests/src/generic_page.ts @@ -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 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(); + }); +});