Skip to content

Commit

Permalink
Add basic health check to make sure build works
Browse files Browse the repository at this point in the history
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
  • Loading branch information
programmiri committed Jan 12, 2024
1 parent ac9d3bd commit ceb953d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This is a work in progress, so a documentation will follow!

Most importantly, we need to make sure that the tests run on a Klaw instance with a clean and reproducible database which they don't at the moment.

## Current state

- to run tests on a local machine, use `pnpm test-local`
Expand Down
Empty file removed e2e/test-results/test.ts
Empty file.
60 changes: 60 additions & 0 deletions e2e/tests/basic-health-check.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { test, expect } from "@playwright/test";

const superAdminUserName = "superadmin";

// ⚠️ The password is the default password set in application.properties
// because that is the one that will work in GitHub.
// If the tests run e.g. locally, where 'superadmin' has a different password,
// this test will fail, because it would need to use the local password.
// We need to make sure that Klaw runs on clean DBs for E2E tests.
// For this basic health check, this is sufficient.
const superAdminPassword = "welcometoklaw";
test("has title", async ({ page }) => {
await page.goto("/");

await expect(page).toHaveTitle(
"Klaw | Kafka Self-service Topic Management Portal",
);
});

test("user can login with default superadmin user", async ({ page }) => {
await page.goto("/");
const loader = page.locator(".preloader");
await expect(loader).not.toBeVisible();

await page.getByPlaceholder("Username").fill(superAdminUserName);
await page.getByPlaceholder("Password").fill(superAdminPassword);
await page.getByRole("button", { name: "LOG IN" }).click();

const profileForSuperAdmin = await page.getByRole("button", {
name: "superadmin",
exact: true,
});

await expect(profileForSuperAdmin).toBeVisible();
});

test("coral is build", async ({ page }) => {
await page.goto("/");
const loader = page.locator(".preloader");
await expect(loader).not.toBeVisible();

await page.getByPlaceholder("Username").fill(superAdminUserName);
await page.getByPlaceholder("Password").fill(superAdminPassword);
await page.getByRole("button", { name: "LOG IN" }).click();

const profileForSuperAdmin = await page.getByRole("button", {
name: "superadmin",
exact: true,
});

await expect(profileForSuperAdmin).toBeVisible();

await page.goto("/coral/topics");

const coralSuperAdminDialog = await page.getByRole("dialog", {
name: /you're currently logged in as superadmin\./i,
});

await expect(coralSuperAdminDialog).toBeVisible();
});

0 comments on commit ceb953d

Please sign in to comment.