-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic health check to make sure build works
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
- Loading branch information
1 parent
ac9d3bd
commit ceb953d
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); |