forked from ekcom/TkAst
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Playwright tests for options page (#40)
- Change GH action to only run no-auth playwright tests - Write tests for popup page
- Loading branch information
Showing
6 changed files
with
44 additions
and
8 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
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
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,9 @@ | ||
import { test } from "../../fixtures"; | ||
import { BASE_URL } from "../../../src/config"; | ||
|
||
test("Can access TDX", async ({ page }) => { | ||
//await page.goto(`https://help.uillinois.edu/SBTDNext`); | ||
await page.goto(BASE_URL); | ||
// todo follow sign-in etc | ||
// and test that actually logged in ok | ||
}); |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
// todo |
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,28 @@ | ||
import { test, expect } from "./fixtures"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
// get popup page URL | ||
// something like "pages/index.html" | ||
const manifest = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "src", "static", "manifest.json"), "utf8")); | ||
const defaultPopupRelativePath = manifest.action.default_popup; | ||
test("Popup page has options button and it opens the options page", async ({ page, extensionId, context }) => { | ||
await page.goto(`chrome-extension://${extensionId}/${defaultPopupRelativePath}`); | ||
await expect(page.locator("button:has-text('Options'), a:has-text('Options')")).toBeVisible(); | ||
|
||
const prevUrl = page.url(); | ||
await page.locator("button:has-text('Options'), a:has-text('Options')").click(); | ||
const newTab = await context.waitForEvent("page"); | ||
await newTab.waitForLoadState(); | ||
expect(newTab.url(), "Should have opened a new tab with a different URL").not.toEqual(prevUrl); | ||
}); | ||
test("Popup page has help button and it opens the help page", async ({ page, extensionId, context }) => { | ||
await page.goto(`chrome-extension://${extensionId}/${defaultPopupRelativePath}`); | ||
await expect(page.locator("button:has-text('Help'), a:has-text('Help')")).toBeVisible(); | ||
|
||
const prevUrl = page.url(); | ||
await page.locator("button:has-text('Options'), a:has-text('Options')").click(); | ||
const newTab = await context.waitForEvent("page"); | ||
await newTab.waitForLoadState(); | ||
expect(newTab.url(), "Should have opened a new tab with a different URL").not.toEqual(prevUrl); | ||
}); |