I want to assert the URLof the page after login. This is my method so far:
public bool UrlEqualsBookingPage()
{
string currentURL = Client.GetCurrentUrl();
string expectedURL = "https://url.at";
return String.Equals(currentURL, expectedURL);
}
This is my test method:
[TestMethod]
[TestCategory("Podmanager")]
public void DF_Podmanager_Login_UrlCheck()
{
// ARRANGE - user generated by dataprovider
User user = UserDataProvider.UserPodManager();
// ACT - check url
var result = dfApp.Web().Login(user).UrlEqualsBookingPage();
// ASSERT - url is as expected
result.Should().BeTrue();
}
I'm not sure, how to get the current URL compared to the one in the (). What do I miss?
Test fails with 'false' if I run it.
i was able to make it work, here is the functioning method:
public bool AssertBookingPageURL()
{
Thread.Sleep(5000);
string currentURL = Client.GetCurrentUrl();
string expectedURL = "https://www.url.at";
return currentURL.Equals(expectedURL);
}
Test Method:
[TestMethod]
[TestCategory("Podmanager")]
public void DF_Podmanager_Login_UrlCheck()
{
// ARRANGE - user generated by dataprovider
User user = UserDataProvider.UserPodManager();
// ACT - check url
var result = dfApp.Web().Login(user).AssertBookingPageURL();
// ASSERT - url is as expected
result.Should().BeTrue();
}