Files
coder/site/e2e/tests/deployment/general.spec.ts
T
Bruno Quaresma 8f2394c256 chore: replace MUI tables (#20201)
I tried to break this work into smaller pieces, but since there are a
lot of dependent components, I decided to handle it in one larger chunk
and rely on Storybook to catch any bugs.

That said, let me know if you’d prefer a different approach!
2025-10-09 10:09:37 -03:00

46 lines
1.4 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { API } from "api/api";
import { setupApiCalls } from "../../api";
import { e2eFakeExperiment1, e2eFakeExperiment2 } from "../../constants";
import { login } from "../../helpers";
import { beforeCoderTest } from "../../hooks";
test.beforeEach(async ({ page }) => {
beforeCoderTest(page);
await login(page);
await setupApiCalls(page);
});
test("experiments", async ({ page }) => {
// Load experiments from backend API
const availableExperiments = await API.getAvailableExperiments();
// Verify if the site lists the same experiments
await page.goto("/deployment/overview", { waitUntil: "domcontentloaded" });
const experimentsLocator = page.locator(
"table.options-table tr.option-experiments ul.option-array",
);
await expect(experimentsLocator).toBeVisible();
// Firstly, check if all enabled experiments are listed
expect(
experimentsLocator.locator(
`li.option-array-item-${e2eFakeExperiment1}.option-enabled`,
),
).toBeVisible;
expect(
experimentsLocator.locator(
`li.option-array-item-${e2eFakeExperiment2}.option-enabled`,
),
).toBeVisible;
// Secondly, check if available experiments are listed
for (const experiment of availableExperiments.safe) {
const experimentLocator = experimentsLocator.locator(
`li.option-array-item-${experiment}`,
);
await expect(experimentLocator).toBeVisible();
}
});