Skip to content

Commit

Permalink
Add error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tepi committed Sep 18, 2024
1 parent c4107aa commit 73753ab
Showing 1 changed file with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.TimeoutException;

import com.vaadin.flow.component.html.testbench.SpanElement;
import com.vaadin.flow.testutil.ChromeBrowserTest;
Expand All @@ -15,12 +16,24 @@ public class ForwardTargetIT extends ChromeBrowserTest {
public void testUrlIsCorrectAfterForward() {
getDriver().get(getTestURL(getRootURL(), FORWARD_TARGET_VIEW, null));

waitUntil(arg -> driver.getCurrentUrl().endsWith(FORWARD_TARGET_VIEW));
try {
waitUntil(arg -> driver.getCurrentUrl()
.endsWith(FORWARD_TARGET_VIEW));
} catch (TimeoutException e) {
Assert.fail("URL wasn't updated to expected one: "
+ FORWARD_TARGET_VIEW);
}

getDriver().get(getTestURL(getRootURL(),
"/view/com.vaadin.flow.ForwardingView", null));

waitUntil(arg -> driver.getCurrentUrl().endsWith(FORWARD_TARGET_VIEW));
try {
waitUntil(arg -> driver.getCurrentUrl()
.endsWith(FORWARD_TARGET_VIEW));
} catch (TimeoutException e) {
Assert.fail("URL wasn't updated to expected one: "
+ FORWARD_TARGET_VIEW);
}

Assert.assertTrue("URL was not the expected one after forward call",
driver.getCurrentUrl().endsWith(FORWARD_TARGET_VIEW));
Expand All @@ -32,8 +45,13 @@ public void testSetParameterCalledOnlyOnceAfterForward() {
getDriver().get(getTestURL(getRootURL(),
"/view/com.vaadin.flow.ForwardingToParametersView", null));

waitUntil(arg -> driver.getCurrentUrl().endsWith(
"/view/com.vaadin.flow.ForwardTargetWithParametersView"));
try {
waitUntil(arg -> driver.getCurrentUrl().endsWith(
"/view/com.vaadin.flow.ForwardTargetWithParametersView"));
} catch (TimeoutException e) {
Assert.fail("URL wasn't updated to expected one: "
+ "/view/com.vaadin.flow.ForwardTargetWithParametersView");
}

Assert.assertEquals("setParameter was called more than once", 1,
$(SpanElement.class).all().stream()
Expand Down

0 comments on commit 73753ab

Please sign in to comment.