Add WG_IDP_CONFIG_FILE env var to seed OIDC/SAML identity providers from a YAML file at startup, enabling GitOps and IaC workflows. Providers are upserted by id (merge strategy preserves manual additions). Convert all e2e tests from NiceGUI User fixture to Playwright async API with --headed and --slowmo flags for visual debugging. Add full OIDC login flow test against the mock-oidc service.
32 lines
1.4 KiB
Python
32 lines
1.4 KiB
Python
"""End-to-end tests for device management UI."""
|
|
|
|
from playwright.async_api import Page, expect
|
|
|
|
from wiregui.models.user import User as UserModel
|
|
from tests.e2e.conftest import login
|
|
|
|
|
|
async def test_add_device_via_ui(page: Page, test_user: UserModel):
|
|
"""Test the full flow: login → devices → add device → see it in table."""
|
|
await login(page)
|
|
await expect(page.get_by_text("My Devices")).to_be_visible(timeout=10_000)
|
|
|
|
await page.get_by_role("button", name="Add Device").click()
|
|
await expect(page.get_by_text("New Device")).to_be_visible(timeout=5_000)
|
|
|
|
await page.locator("input[aria-label='Device Name']").fill("Test Laptop")
|
|
await page.get_by_role("button", name="Create").click()
|
|
|
|
# Should see config dialog with the device name
|
|
await expect(page.get_by_text("Config for Test Laptop")).to_be_visible(timeout=10_000)
|
|
|
|
|
|
async def test_add_device_requires_name(page: Page, test_user: UserModel):
|
|
"""Test that creating a device without a name shows an error."""
|
|
await login(page)
|
|
await expect(page.get_by_text("My Devices")).to_be_visible(timeout=10_000)
|
|
|
|
await page.get_by_role("button", name="Add Device").click()
|
|
await expect(page.get_by_text("New Device")).to_be_visible(timeout=5_000)
|
|
await page.get_by_role("button", name="Create").click()
|
|
await expect(page.get_by_text("Device name is required")).to_be_visible(timeout=5_000)
|