import { expect, test } from "@playwright/test"; import { captureScreenshot, completeOnboarding, openUserSettings, signup } from "./helpers"; test("GitHub connects from a token alone and disconnects again", async ({ page }, testInfo) => { const stamp = Date.now(); await signup(page, `github-connect-${stamp}@rakazo.test`, "password12", "GitHub Connect"); await completeOnboarding(page); await openUserSettings(page, "integrations"); const github = page.getByTestId("github-connect"); await expect(github).toBeVisible(); await github.getByRole("button", { name: "Connect", exact: true }).click(); await expect(github.getByRole("link", { name: "Create token on GitHub" })).toHaveAttribute( "href", /^https:\/\/github\.com\/settings\/tokens\/new\?description=evOo&scopes=repo/, ); const token = github.getByLabel("GitHub token"); await token.fill("fake-github-token-value"); await captureScreenshot(page, testInfo, "github-connect"); await token.press("Enter"); await expect(github.getByText("Connected", { exact: true })).toBeVisible({ timeout: 30_000 }); await expect(token).toBeHidden(); await captureScreenshot(page, testInfo, "github-connected"); await page.reload({ waitUntil: "domcontentloaded" }); await openUserSettings(page, "integrations"); await expect(github.getByText("Connected", { exact: true })).toBeVisible({ timeout: 30_000 }); await github.getByRole("button", { name: "Disconnect" }).click(); await expect(github.getByRole("button", { name: "Connect", exact: true })).toBeVisible(); });