Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
fix: improved playwright test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Jul 13, 2024
1 parent e4f0d4e commit 41f43c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export default function Page() {
<div className="mx-auto max-w-2xl px-4 lg:max-w-none">
<div className="grid grid-cols-1 items-center gap-x-16 gap-y-10 lg:grid-cols-2">
<div>
<h2 className="text-4xl font-bold tracking-tight">
<h3 className="text-4xl font-bold tracking-tight">
Is your GitHub Repo
<br />
<span className="text-red-700">RED</span>,{" "}
<span className="text-orange-500">AMBER</span> or{" "}
<span className="text-green-600">GREEN</span>?
</h2>
</h3>
<p className="mt-4 text-gray-300">
Whether you are looking for funding or running a community
project, it is important that your GitHub Repo is discoverable
Expand Down Expand Up @@ -71,7 +71,7 @@ export default function Page() {
<incentive.icon className="h-16 w-16" />
</div>
<div className="mt-4 sm:ml-6 sm:mt-0 lg:ml-0 lg:mt-6">
<h3 className="text-sm font-medium">{incentive.name}</h3>
<h4 className="text-sm font-medium">{incentive.name}</h4>
<p className="mt-2 text-sm text-gray-300">
{incentive.description}
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tagline.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Tagline() {

return (
<div className="border-b border-gray-200 py-5">
<h3 className="text-base font-semibold leading-6">{tagline.value}</h3>
<h2 className="text-base font-semibold leading-6">{tagline.value}</h2>
</div>
);
}
23 changes: 15 additions & 8 deletions tests/homepage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@ import { test, expect } from "@playwright/test";

test("has title", async ({ page }) => {
await page.goto("/");

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/HealthCheck/);
});

test("get flagsmith link", async ({ page }) => {
test("has text coming from Flagsmith", async ({ page }) => {
await page.goto("/");
const locator = page.locator("h2");
await expect(locator).toHaveText("How friendly is your Open Source Repo?");
});

test("has text", async ({ page }) => {
await page.goto("/");
const locator = page.locator("h3");
await expect(locator).toHaveText(/RED, AMBER or GREEN/);
});

// Click the get started link.
// await page.getByRole("link", { name: "Visit their website" }).click();
test("click flagsmith link", async ({ page }) => {
await page.goto("/");

const page1Promise = page.waitForEvent("popup");
const page2Promise = page.waitForEvent("popup");
await page.getByRole("link", { name: "Visit their website" }).click();
const page1 = await page1Promise;
await expect(page1).toHaveURL(/flagsmith.com/);
const page2 = await page2Promise;
await expect(page2).toHaveURL(/flagsmith.com/);
});

0 comments on commit 41f43c0

Please sign in to comment.