diff --git a/.github/workflows/endform-tests-on-prs.yml b/.github/workflows/endform-tests-on-prs.yml new file mode 100644 index 0000000..402562d --- /dev/null +++ b/.github/workflows/endform-tests-on-prs.yml @@ -0,0 +1,41 @@ +name: Run end to end tests with endform + +on: + pull_request: + branches: + - main + +permissions: + contents: read + id-token: write # required for authentication with Endform + +jobs: + e2e: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Wait for Vercel deployment + uses: endformdev/actions/await-vercel-deployment@main + with: + project-name: endform-playwright-tutorial + set-url-env-var: BASE_URL # Sets the Vercel preview URL as the BASE_URL environment variable + + - name: Run end to end tests with endform + run: | + npx endform@latest test diff --git a/playwright.config.ts b/playwright.config.ts index 44ca464..61bf1d0 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -28,7 +28,8 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "https://endform-playwright-tutorial.vercel.app", + baseURL: + process.env.BASE_URL || "https://endform-playwright-tutorial.vercel.app", // You can use this localhost baseURL if you are running the application locally // baseURL: "http://localhost:3000",