solving the issue with UI tests sporadically failing due to authorization issues; the problem was that a request for Login.html also creates a session asynchronously, causing a race condition

This commit is contained in:
Axel Uhl committed 2014-11-18 16:48:59 +01:00
1 parent c260ca8f73
commit aaf49f9302
1 file changed
+7 -2
@@ -31,7 +31,12 @@ import com.sap.sailing.selenium.core.Managed;
import com.sap.sailing.selenium.core.SeleniumRunner;
import com.sap.sailing.selenium.core.TestEnvironment;
import com.sap.sailing.selenium.core.WindowManager;
<<<<<<< Updated upstream
import com.sap.sailing.selenium.pages.HostPage;
=======
import com.sap.sse.common.Duration;
import com.sap.sse.common.impl.MillisecondsTimePoint;
>>>>>>> Stashed changes
/**
* <p>Abstract base class for unit tests with Selenium. This class is already annotated as required to get executed
@@ -86,10 +91,10 @@ public abstract class AbstractSeleniumTest {
}
@Before
public void setUpAuthenticatedSession() {
public void setUpAuthenticatedSession() throws InterruptedException {
logger.info("Authenticating session...");
Cookie sessionCookie = authenticate(getContextRoot());
getWebDriver().get(getContextRoot() + "security/ui/Login.html?" + HostPage.getGWTCodeServer()); // initialize web driver so setting a cookie for the local domain is possible
getWebDriver().get(getContextRoot() + "index.html"); // initialize web driver so setting a cookie for the local domain is possible
getWebDriver().manage().addCookie(sessionCookie);
logger.info("...obtained session cookie "+sessionCookie);
}