Exercise selector validation in a fresh OPNsense VM

This commit is contained in:
ms2k 2026-08-07 04:07:29 +09:00
commit b6a8e185d8

View file

@ -68,7 +68,10 @@ test("renders and preserves NordVPN enrollment controls", async ({ page }) => {
await page.goto("/");
await page.locator("#usernamefld").fill(username);
await page.locator("#passwordfld").fill(password);
await page.getByRole("button", { name: "Login" }).click();
await Promise.all([
page.waitForNavigation({ waitUntil: "domcontentloaded" }),
page.getByRole("button", { name: "Login" }).click(),
]);
await expect(page.locator("#usernamefld")).toBeHidden();
await page.goto("/ui/nordvpn");
await expect(
@ -116,6 +119,9 @@ test("renders and preserves NordVPN enrollment controls", async ({ page }) => {
await expect(source.locator('option[value="UI_TEST_NETWORK"]')).toHaveText(
"UI_TEST_NETWORK",
);
await expect(
destination.locator('option[value="UI_TEST_NETWORK_TWO"]'),
).toHaveText("UI_TEST_NETWORK_TWO");
const destinationPicker = destination.locator("xpath=..");
const destinationToggle = destinationPicker.locator("button.dropdown-toggle");
@ -130,6 +136,18 @@ test("renders and preserves NordVPN enrollment controls", async ({ page }) => {
await destinationToggle.click();
await source.selectOption("UI_TEST_NETWORK");
await destination.selectOption([
"UI_TEST_NETWORK",
"UI_TEST_NETWORK_TWO",
]);
await dialog.locator('[id="enrollment.destination_not"]').check();
await dialog.getByRole("button", { name: "Save", exact: true }).click();
await expect(dialog).toBeVisible();
await expect(dialog).toContainText(
"Inverting destinations is only allowed for single targets to avoid mis-interpretations",
);
await dialog.locator('[id="enrollment.destination_not"]').uncheck();
await destination.selectOption("any");
await dialog.getByRole("button", { name: "Save", exact: true }).click();
await expect(dialog).toBeHidden();