Skip to content

Commit

Permalink
DELETE-ME/idk
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustinSorel committed Jul 21, 2024
1 parent 92e8299 commit 7f1f442
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
run: pnpm exec playwright test
env:
BASE_URL: ${{ github.event.deployment_status.environment_url }}
E2E_GITHUB_USER_EMAIL: ${{ secrets.E2E_GITHUB_USER_EMAIL }}
E2E_GITHUB_USER_PASSWORD: ${{ secrets.E2E_GITHUB_USER_PASSWORD }}
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
17 changes: 12 additions & 5 deletions e2e/tests/auth.setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import { env } from "@/env";
import { test as setup } from "@playwright/test";

const authFile = "e2e/.auth/user.json";

const user = {
email: env.E2E_GITHUB_USER_EMAIL,
password: env.E2E_GITHUB_USER_PASSWORD,
email: process.env.E2E_GITHUB_USER_EMAIL,
password: process.env.E2E_GITHUB_USER_PASSWORD,
};

setup("authenticate", async ({ page }) => {
await page.goto("/");
if (!user.email) {
throw new Error("e2e github user email is missing");
}

if (!user.password) {
throw new Error("e2e github user password is missing");
}

await page.goto("https://gym-graphs.vercel.app");

await page
.locator('[href="/dashboard"]', { hasText: "get started" })
Expand All @@ -24,7 +31,7 @@ setup("authenticate", async ({ page }) => {
await page.getByLabel("Password").fill(user.password);
await page.getByRole("button", { name: "Sign in" }).click();

await page.waitForURL("/dashboard");
await page.waitForURL("https://gym-graphs.vercel.app/dashboard");

await page.context().storageState({ path: authFile });
});

0 comments on commit 7f1f442

Please sign in to comment.