-
Notifications
You must be signed in to change notification settings - Fork 26
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
1 parent
27751cc
commit 653223d
Showing
6 changed files
with
155 additions
and
5 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,27 @@ | ||
# name: End-to-End tests | ||
# on: | ||
# push: | ||
# branches: [main] | ||
# pull_request: | ||
# branches: [main] | ||
# jobs: | ||
# test: | ||
# 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 --with-deps | ||
# - name: Run Playwright tests | ||
# run: pnpm exec playwright test | ||
# - uses: actions/upload-artifact@v4 | ||
# if: always() | ||
# 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
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,33 @@ | ||
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: { | ||
baseURL: "http://localhost:3002", | ||
trace: "on-first-retry", | ||
}, | ||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { ...devices["Desktop Chrome"] }, | ||
}, | ||
// { | ||
// name: "firefox", | ||
// use: { ...devices["Desktop Firefox"] }, | ||
// }, | ||
// { | ||
// name: "webkit", | ||
// use: { ...devices["Desktop Safari"] }, | ||
// }, | ||
], | ||
webServer: { | ||
command: "cd ../../ && pnpm dev", | ||
url: "http://localhost:3002", | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
}); |
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,44 @@ | ||
import { test, expect, CDPSession } from "@playwright/test"; | ||
|
||
let client: CDPSession; | ||
let authenticatorId: string; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
client = await page.context().newCDPSession(page); | ||
await client.send("WebAuthn.enable"); | ||
const result = await client.send("WebAuthn.addVirtualAuthenticator", { | ||
options: { | ||
protocol: "ctap2", | ||
transport: "internal", | ||
hasResidentKey: true, | ||
hasUserVerification: true, | ||
isUserVerified: true, | ||
automaticPresenceSimulation: true, | ||
}, | ||
}); | ||
authenticatorId = result.authenticatorId; | ||
|
||
await page.goto("/"); | ||
}); | ||
|
||
test("has title", async ({ page }) => { | ||
await expect(page).toHaveTitle(/StarkNet ❤️ React/); | ||
}); | ||
|
||
test.describe("Connect", () => { | ||
test.describe("Log in", () => { | ||
test("should allow me to login and connect to Controller", async ({ | ||
page, | ||
}) => { | ||
await page.getByRole("button", { name: "Connect" }).click(); | ||
const modal = page.frameLocator("#cartridge-modal"); | ||
await expect( | ||
modal.getByText("Play with Cartridge Controller"), | ||
).toBeVisible(); | ||
await modal.getByPlaceholder("Username").fill("test-0"); | ||
await modal.getByRole("button", { name: "LOG IN" }).click(); | ||
|
||
await expect(page.getByText("Address: ")).toBeVisible(); | ||
}); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.