Skip to content

Commit

Permalink
Improve subnets page test
Browse files Browse the repository at this point in the history
  • Loading branch information
devon-mar committed Aug 19, 2023
1 parent a32cf7e commit 1474ea6
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,19 +505,21 @@ def test_server_status(page: Page, kea: KeaClient) -> None:
def test_dhcp_subnets(
page: Page, kea: KeaClient, family: str, subnets: Sequence[str]
) -> None:
page.get_by_role("link", name=f"DHCPv{family} Subnets").click()
for i, s in enumerate(subnets):
page.get_by_role("link", name=f"DHCPv{family} Subnets").click()
rows = page.locator("table > tbody > tr")
tds = rows.nth(i).locator("td")

locator = page.locator(".tab-content")
for s in subnets:
expect(locator).to_contain_text(s)
# Check Subnet column data
expect(tds.nth(0)).to_contain_text(s)

with page.expect_response(re.compile(f"/leases{family}/")) as r:
page.get_by_role("link", name=subnets[0]).click()
assert r.value.ok
expect(page.locator("#lease-search #id_q")).to_have_value(subnets[0])
expect(page.locator("div.ss-single-selected > span.placeholder")).to_have_text(
"Subnet"
)
with page.expect_response(re.compile(f"/leases{family}/")) as r:
page.get_by_role("link", name=s).click()
assert r.value.ok
expect(page.locator("#lease-search #id_q")).to_have_value(s)
expect(page.locator("div.ss-single-selected > span.placeholder")).to_have_text(
"Subnet"
)


@pytest.mark.parametrize("family", (4, 6))
Expand All @@ -529,6 +531,11 @@ def test_dhcp_subnets_configure_table(page: Page, kea: KeaClient, family: int) -
["Subnet", ""]
)

configure_table(page, "subnet", "shared_network_name")
expect(page.locator(".object-list > thead > tr > th > a")).to_have_text(
["Subnet", "Shared Network Name", ""]
)


@pytest.mark.parametrize(
("version", "by", "q"),
Expand Down

0 comments on commit 1474ea6

Please sign in to comment.