-
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.
Merge pull request #8 from tiagofilipenunes/multibrowser-improvements
Post-Multibrowser support improvements
- Loading branch information
Showing
18 changed files
with
5,340 additions
and
8,357 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
jobs: | ||
build: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm install -g pnpm && pnpm install | ||
- name: Build for Firefox | ||
run: pnpm build:firefox | ||
- name: Build for Chromium | ||
run: pnpm build:chromium |
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,27 @@ | ||
name: E2E Tests | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
jobs: | ||
e2e: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm install -g pnpm && pnpm install | ||
- name: Install Playwright Browsers | ||
run: pnpm exec playwright install chromium --with-deps | ||
- name: Run Playwright E2E tests | ||
run: pnpm e2e | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
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,24 @@ | ||
import { test, expect } from "./fixtures"; | ||
|
||
test("Goto github PR files changed and check diff", async ({ page }) => { | ||
await page.goto( | ||
"https://github.com/bancorprotocol/carbon-app/pull/1464/files" | ||
); | ||
const firstIframe = page.frameLocator("iframe").first(); | ||
const iframeBody = firstIframe.locator("body"); | ||
|
||
await expect(iframeBody).toContainText("Difference"); | ||
await expect(iframeBody).toContainText("Overlay"); | ||
}); | ||
|
||
test("Check settings page contains right header and labels", async ({ | ||
page, | ||
extensionId, | ||
}) => { | ||
await page.goto(`chrome-extension://${extensionId}/src/popup/index.html`); | ||
await expect(page.locator("h1")).toContainText("Settings"); | ||
expect(page.locator("form > label")).toHaveText([ | ||
"Diff Color", | ||
"Default Algo", | ||
]); | ||
}); |
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,35 @@ | ||
import { test as base, chromium, type BrowserContext } from "@playwright/test"; | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
import { resolve } from "node:path"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const rootPath = resolve(__dirname, ".."); | ||
|
||
export const test = base.extend<{ | ||
context: BrowserContext; | ||
extensionId: string; | ||
}>({ | ||
context: async ({ headless }, use) => { | ||
const pathToExtension = path.join(rootPath, "dist"); | ||
const context = await chromium.launchPersistentContext("", { | ||
headless, | ||
args: [ | ||
...(headless ? ["--headless=new"] : []), | ||
`--disable-extensions-except=${pathToExtension}`, | ||
`--load-extension=${pathToExtension}`, | ||
], | ||
}); | ||
await use(context); | ||
await context.close(); | ||
}, | ||
extensionId: async ({ context }, use) => { | ||
let [background] = context.serviceWorkers(); | ||
if (!background) background = await context.waitForEvent("serviceworker"); | ||
|
||
const extensionId = background.url().split("/")[2]; | ||
await use(extensionId); | ||
}, | ||
}); | ||
export const expect = test.expect; |
Oops, something went wrong.