Skip to content

Commit ea7c70e

Browse files
committed
Merge pull request #1 from endformdev/oliver/e2e-pr
Add PR e2e workflow
1 parent ef2f30c commit ea7c70e

3 files changed

Lines changed: 50 additions & 8 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Run end to end tests with endform
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
id-token: write # required for authentication with Endform
11+
12+
jobs:
13+
e2e:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: lts/*
28+
cache: 'pnpm'
29+
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: Wait for Vercel deployment
34+
uses: endformdev/actions/await-vercel-deployment@main
35+
with:
36+
project-name: endform-playwright-tutorial
37+
set-url-env-var: BASE_URL # Sets the Vercel preview URL as the BASE_URL environment variable
38+
39+
- name: Run end to end tests with endform
40+
run: |
41+
npx endform@latest test

‎playwright.config.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,21 @@ export default defineConfig({
2828
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2929
use: {
3030
/* Base URL to use in actions like `await page.goto('/')`. */
31-
// baseURL: "https://endform-playwright-tutorial.vercel.app",
31+
baseURL:
32+
process.env.BASE_URL || "https://endform-playwright-tutorial.vercel.app",
3233
// You can use this localhost baseURL if you are running the application locally
33-
baseURL: "http://localhost:3000",
34+
// baseURL: "http://localhost:3000",
3435

3536
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3637
trace: "retain-on-failure",
3738
},
3839

3940
/* Run your local dev server before starting the tests */
40-
webServer: {
41-
command: "pnpm dev",
42-
url: "http://localhost:3000",
43-
reuseExistingServer: !process.env.CI,
44-
},
41+
// webServer: {
42+
// command: "pnpm dev",
43+
// url: "http://localhost:3000",
44+
// reuseExistingServer: !process.env.CI,
45+
// },
4546

4647
projects: [
4748
{

middleware.ts renamed to proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { signToken, verifyToken } from "@/lib/auth/session";
44

55
const protectedRoutes = "/dashboard";
66

7-
export async function middleware(request: NextRequest) {
7+
export async function proxy(request: NextRequest) {
88
const { pathname } = request.nextUrl;
99
const sessionCookie = request.cookies.get("session");
1010
const isProtectedRoute = pathname.startsWith(protectedRoutes);

0 commit comments

Comments
 (0)