Skip to content

Commit

Permalink
Not only the first button click can be problematic, fix later ones. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ilonatommy committed Apr 2, 2024
1 parent 10e87bc commit 991a054
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,16 @@ public async Task SignalRPassMessages(string config, string transport)
}
if (msg.Text.Contains("Finished GetQueryParameters"))
{
// first click after render - make sure buttons are available
await page.WaitForSelectorAsync("button#connectButton");
await page.ClickAsync("button#connectButton");
}
await SaveClickButtonAsync(page, "button#connectButton");
if (msg.Text.Contains("SignalR connected"))
await page.ClickAsync("button#subscribeButton");
await SaveClickButtonAsync(page, "button#subscribeButton");
if (msg.Text.Contains("Subscribed to ReceiveMessage"))
await page.ClickAsync("button#sendMessageButton");
await SaveClickButtonAsync(page, "button#sendMessageButton");
if (msg.Text.Contains("ReceiveMessage from server"))
await page.ClickAsync("button#exitProgramButton");
await SaveClickButtonAsync(page, "button#exitProgramButton");
}
));

Expand All @@ -95,4 +91,10 @@ private string GetThreadOfAction(string testOutput, string pattern, string actio
Assert.True(match.Success, $"Expected to find a log that {actionDescription}. TestOutput: {testOutput}.");
return match.Groups[1].Value ?? "";
}

private async Task SaveClickButtonAsync(IPage page, string selector)
{
await page.WaitForSelectorAsync(selector);
await page.ClickAsync(selector);
}
}

0 comments on commit 991a054

Please sign in to comment.