-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
169 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -33,3 +33,6 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,20 @@ | ||
import { defineConfig, devices } from "@playwright/test"; | ||
|
||
export default defineConfig({ | ||
testDir: "./tests", | ||
fullyParallel: true, | ||
forbidOnly: !!process.env.CI, | ||
retries: process.env.CI ? 2 : 0, | ||
workers: process.env.CI ? 1 : undefined, | ||
reporter: "html", | ||
use: { | ||
trace: "on-first-retry", | ||
headless: false, | ||
}, | ||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { ...devices["Desktop Chrome"] }, | ||
}, | ||
], | ||
}); |
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,20 @@ | ||
import { expect, test } from "./lib/fixtures"; | ||
|
||
test("has title", async ({ page }) => { | ||
await page.goto("https://playwright.dev/"); | ||
|
||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle(/Playwright/); | ||
}); | ||
|
||
test("get started link", async ({ page }) => { | ||
await page.goto("https://playwright.dev/"); | ||
|
||
// Click the get started link. | ||
await page.getByRole("link", { name: "Get started" }).click(); | ||
|
||
// Expects page to have a heading with the name of Installation. | ||
await expect( | ||
page.getByRole("heading", { name: "Installation" }), | ||
).toBeVisible(); | ||
}); |
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,38 @@ | ||
import { type BrowserContext, chromium, test as base } from "@playwright/test"; | ||
|
||
import { prepareKeplr } from "./keplr"; | ||
|
||
export const test = base.extend<{ context: BrowserContext }>({ | ||
// eslint-disable-next-line no-empty-pattern | ||
context: async ({}, use) => { | ||
// download keplr | ||
await prepareKeplr(); | ||
|
||
// prepare browser args | ||
const browserArgs = [ | ||
// `--disable-extensions-except=${metamaskPath}`, | ||
// `--load-extension=${metamaskPath}`, | ||
"--remote-debugging-port=9222", | ||
]; | ||
|
||
if (process.env.CI) { | ||
browserArgs.push("--disable-gpu"); | ||
} | ||
|
||
if (process.env.HEADLESS_MODE) { | ||
browserArgs.push("--headless=new"); | ||
} | ||
|
||
// launch browser | ||
const context = await chromium.launchPersistentContext("", { | ||
headless: false, | ||
args: browserArgs, | ||
}); | ||
|
||
await use(context); | ||
|
||
await context.close(); | ||
}, | ||
}); | ||
|
||
export const expect = test.expect; |
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,14 @@ | ||
import axios from "axios"; | ||
|
||
export async function prepareKeplr() { | ||
const response = await axios.get( | ||
"https://api.github.com/repos/chainapsis/keplr-wallet/releases", | ||
); | ||
|
||
const filename = response.data[0].assets[0].name; | ||
const downloadUrl = response.data[0].assets[0].browser_download_url; | ||
const tagName = response.data[0].tag_name; | ||
console.log( | ||
`Keplr version found! Filename: ${filename}; Download url: ${downloadUrl}; Tag name: ${tagName}`, | ||
); | ||
} |