Skip to content

Commit

Permalink
fix: use fill for network forward tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mason Hu <[email protected]>
  • Loading branch information
MasWho committed Feb 20, 2025
1 parent 004170c commit 32a6f04
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tests/helpers/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const deleteNetwork = async (page: Page, network: string) => {

export const visitNetwork = async (page: Page, network: string) => {
await gotoURL(page, "/ui/");
await page.waitForLoadState("networkidle");
await page.getByTitle("Networks (default)").click();
await page.getByRole("link", { name: network }).first().click();
await page.getByTestId("tab-link-Configuration").click();
Expand Down Expand Up @@ -82,20 +81,16 @@ export const createNetworkForward = async (page: Page, network: string) => {
let addressInput = page.getByLabel("0 target address");
await page.getByRole("button", { name: "Add port" }).click();
await portInput.click();
await expect(portInput).toBeFocused();
await page.keyboard.type("80");
await portInput.fill("80");
await addressInput.click();
await expect(addressInput).toBeFocused();
await page.keyboard.type(targetAddress);
await addressInput.fill(targetAddress);
await page.getByRole("button", { name: "Add port" }).click();
portInput = page.getByLabel("1 listen port");
addressInput = page.getByLabel("1 target address");
await portInput.click();
await expect(portInput).toBeFocused();
await page.keyboard.type("23,443-455");
await portInput.fill("23,443-455");
await addressInput.click();
await expect(addressInput).toBeFocused();
await page.keyboard.type(targetAddress);
await addressInput.fill(targetAddress);
await page.getByRole("button", { name: "Create" }).click();

await page.getByText(`Network forward ${listenAddress} created.`).click();
Expand All @@ -109,8 +104,8 @@ export const createNetworkForward = async (page: Page, network: string) => {

export const getNetworkLink = async (page: Page, network: string) => {
// network actions may result in ERR_NETWORK_CHANGED, we should wait for network to settle before checking visibility
await gotoURL(page, "/ui/");
await page.waitForLoadState("networkidle");
await gotoURL(page, "/ui/");
await page.getByRole("link", { name: "Networks", exact: true }).click();
const networkLink = page.getByRole("link", { name: network });
return networkLink;
Expand Down

0 comments on commit 32a6f04

Please sign in to comment.