I'm making an UI test, where I should check out, if the registration was successful. My code gets executed, and it does make the registration successfully, however when I want to assert that the URL gets redirected to the "http://localhost:8080/sportsbetting-web/home";
My code fails, stating that:
org.junit.ComparisonFailure:
Expected :http://localhost:8080/sportsbetting-web/register
Actual :http://localhost:8080/sportsbetting-web/home
My assertion looks like this:
button.click(); //registration button is clicked
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); //wait so it has time to redirect
String actualUrl = "http://localhost:8080/sportsbetting-web/home";
String expectedUrl = driver.getCurrentUrl();
Assert.assertEquals(actualUrl,expectedUrl);
I tried switching the expectedUrl and actualUrl, but it doesn't work.