Skip to content

Instantly share code, notes, and snippets.

@Noxsios
Created March 27, 2025 15:10
Show Gist options
  • Save Noxsios/6bab51012c1713948a30d197cb3587a3 to your computer and use it in GitHub Desktop.
Save Noxsios/6bab51012c1713948a30d197cb3587a3 to your computer and use it in GitHub Desktop.
Playwright + KFC
import { expect } from "@playwright/test"
import { test } from "../../../e2e"
import { K8s as k, kind } from "kubernetes-fluent-client"
test("has title", async ({ page, pkg }) => {
await page.goto("/")
const ns = pkg.components.at(0)?.charts?.at(0)?.namespace || ""
expect(ns).toBeTruthy()
const pods = await k(kind.Pod).InNamespace(ns).Get()
expect(pods.items.length).toBe(2)
const title = await page.title()
// uncomment to cause the test to fail, then run w/ to see some magic
// `npx playwright test --project podinfo-chromium --trace on`
// const title = "podinfo"
expect(pods.items.map((p) => p.metadata?.name).find((n) => n === title)).toBeTruthy()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment