Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ public static void WaitForElementToBeVisible(this IWebDriver browser, By by, int
});
}

public static void WaitForUrlToContain(this IWebDriver browser, string expectedUrlSubstring, int timeoutInSeconds = 5)
{
var wait = new DefaultWait<IWebDriver>(browser)
{
Timeout = TimeSpan.FromSeconds(timeoutInSeconds),
PollingInterval = TimeSpan.FromMilliseconds(100)
};
wait.Until(driver => driver.Url.Contains(expectedUrlSubstring, StringComparison.Ordinal));
}

public static long GetElementPositionWithRetry(this IWebDriver browser, string elementId, int retryCount = 3, int delayBetweenRetriesMs = 100)
{
var jsExecutor = (IJavaScriptExecutor)browser;
Expand Down
3 changes: 1 addition & 2 deletions src/Components/test/E2ETest/Tests/EventTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ public void PreventDefault_DoNotApplyByDefault()
appElement.FindElement(By.Id("form-2-button")).Click();

// The URL should change because the submit event is not prevented
var wait = new WebDriverWait(Browser, TimeSpan.FromSeconds(3));
wait.Until(driver => driver.Url.Contains("about:blank"));
Browser.WaitForUrlToContain("about:blank");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so? But you can also search for Browser.Url usages and you might find an existing pattern.

Copy link
Member Author

@oroztocil oroztocil Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, there should be implicit waits for this with 'Browser.Contains' or 'Browser.True'. (I see now what extensions you meant.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the unneeded extension method.

}

[Fact]
Expand Down
Loading