Skip to content

Commit

Permalink
Updating test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ErickRenteria committed Oct 26, 2023
1 parent 044825a commit 39d823f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions accessibility-checker-extension/test/tests/HeaderSection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { setupTest } from '../support/testUtil';
// Describe this Suite of testscases, describe is a test Suite and 'it' is a testcase.
describe("HeaderSection", () => {
test("Is accessible", async () => {
setupTest(<HeaderSection />)
setupTest(<HeaderSection />) //
await (expect(document) as any).toBeAccessible();
});

// Test the help button and check that it opens the quick guide.
describe("First button", () => {
test("Label is 'Help'", async () => {
let button = document.body.querySelector("button");
Expand All @@ -35,12 +35,30 @@ describe("HeaderSection", () => {

button!.click();
});
});


// Test the setting button and check that the option page comes up.
test("Second button is settings", async () => {
let button = document.body.querySelectorAll("button")[1];
let labelId = button?.getAttribute("aria-labelledby") || "";
let label = document.getElementById(labelId);
expect(label?.textContent).toEqual("Settings");
});

test("Click opens options.html", async () => {
let button = document.body.querySelector("button");
// Expect click of the help button to open quickGuideAC.html
window.chrome = { runtime: {
getURL: (url: string) => url
} } as any

(window as any).open = (url: string, target: string) => {
expect(url).toEqual("options.html");
expect(target).toEqual("_blank");
};

button!.click();
});


});
});

0 comments on commit 39d823f

Please sign in to comment.