Skip to content

Commit

Permalink
Target preview keychain when running playwright on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiSugiura committed Aug 13, 2024
1 parent 7ff25e6 commit bb6011e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ jobs:
- name: Install Playwright Browsers
run: pnpm example:next e2e:deps
- name: Run Playwright tests
env:
BRANCH_NAME: ${{ github.head_ref }}
run: pnpm e2e:ci
- uses: actions/upload-artifact@v4
if: always()
Expand Down
5 changes: 3 additions & 2 deletions examples/starknet-react-next/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig, devices } from "@playwright/test";
import { KEYCHAIN_URL } from "components/providers/StarknetProvider";

const CI_BASE_URL = `https://cartridge-starknet-react-next-git-${process.env.BRANCH_NAME}.preview.cartridge.gg`;

export default defineConfig({
testDir: "./tests",
Expand All @@ -8,7 +9,7 @@ export default defineConfig({
retries: process.env.CI ? 2 : 0,
reporter: process.env.CI ? "dot" : "list",
use: {
baseURL: process.env.CI ? KEYCHAIN_URL : "http://localhost:3002",
baseURL: process.env.CI ? CI_BASE_URL : "http://localhost:3002",
trace: "on-first-retry",
},
projects: [
Expand Down
20 changes: 14 additions & 6 deletions examples/starknet-react-next/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client'
"use client";

import { TransferEth } from "components/TransferEth";
import { ConnectWallet } from "components/ConnectWallet";
Expand All @@ -13,8 +13,8 @@ import { useEffect, useState } from "react";
export default function Home() {
const [debug, setDebug] = useState(false);
useEffect(() => {
setDebug(!!new URLSearchParams(window.location.search).get("debug"))
}, [])
setDebug(!!new URLSearchParams(window.location.search).get("debug"));
}, []);

return (
<div className="flex flex-col p-4 gap-4">
Expand All @@ -28,9 +28,17 @@ export default function Home() {
{debug && (
<div>
<p>Keychain URL: {KEYCHAIN_URL}</p>
<p>NEXT_PUBLIC_VERCEL_ENV: {String(process.env.NEXT_PUBLIC_VERCEL_ENV)}</p>
<p>NEXT_PUBLIC_VERCEL_BRANCH_URL: {String(process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL)}</p>
<p>NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL: {String(process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL)}</p>
<p>
NEXT_PUBLIC_VERCEL_ENV: {String(process.env.NEXT_PUBLIC_VERCEL_ENV)}
</p>
<p>
NEXT_PUBLIC_VERCEL_BRANCH_URL:{" "}
{String(process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL)}
</p>
<p>
NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL:{" "}
{String(process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL)}
</p>
</div>
)}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dev": "turbo dev",
"e2e": "turbo dev e2e",
"e2e:ui": "turbo dev e2e:ui",
"e2e:ci": "turbo e2e",
"e2e:ci": "turbo e2e:ci",
"lint": "turbo lint",
"format": "turbo format",
"format:check": "turbo format:check",
Expand Down
9 changes: 5 additions & 4 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
},
"dev": {
"persistent": true,
"dependsOn": ["^build:deps", "^dev"],
"dependsOn": ["^build:deps"],
"outputs": [".next/**", "!.next/cache/**"]
},
"lint": {},
"format": {},
"format:check": {},
"e2e": {
"persistent": true
},
"e2e": {},
"e2e:ui": {
"persistent": true
},
"e2e:ci": {
"dependsOn": ["^build:deps"]
}
}
}

0 comments on commit bb6011e

Please sign in to comment.