use of com.seleniumtests.it.driver.support.pages.DriverTestPage in project seleniumRobot by bhecquet.
the class TestLogActions method testVideoStartDateSetWhenVideoRecordingDisabled.
@Test(groups = { "it" })
public void testVideoStartDateSetWhenVideoRecordingDisabled() throws Exception {
WebDriver driver = null;
try {
SeleniumTestsContextManager.getThreadContext().setBrowser("htmlunit");
SeleniumTestsContextManager.getThreadContext().setVideoCapture("false");
driver = WebUIDriver.getWebDriver(true);
DriverTestPage testPage = new DriverTestPage(true);
WaitHelper.waitForSeconds(1);
testPage._writeSomething();
TestStepManager stepManager = SeleniumTestsContextManager.getThreadContext().getTestStepManager();
TestStep step = stepManager.getTestSteps().get(2);
Assert.assertEquals(step.getVideoTimeStamp(), 0);
Assert.assertNull(stepManager.getVideoStartDate());
} finally {
if (driver != null) {
WebUIDriver.cleanUp();
}
}
}
use of com.seleniumtests.it.driver.support.pages.DriverTestPage in project seleniumRobot by bhecquet.
the class TestLogActions method testVideoStartDateSetWhenVideoRecordingEnabled.
@Test(groups = { "it" })
public void testVideoStartDateSetWhenVideoRecordingEnabled() throws Exception {
WebDriver driver = null;
try {
SeleniumTestsContextManager.getThreadContext().setBrowser("htmlunit");
SeleniumTestsContextManager.getThreadContext().setVideoCapture("true");
driver = WebUIDriver.getWebDriver(true);
DriverTestPage testPage = new DriverTestPage(true);
WaitHelper.waitForSeconds(1);
testPage._writeSomething();
TestStepManager stepManager = SeleniumTestsContextManager.getThreadContext().getTestStepManager();
TestStep step = stepManager.getTestSteps().get(2);
Assert.assertTrue(step.getVideoTimeStamp() > 0);
Assert.assertNotNull(stepManager.getVideoStartDate());
} finally {
if (driver != null) {
WebUIDriver.cleanUp();
}
}
}
use of com.seleniumtests.it.driver.support.pages.DriverTestPage in project seleniumRobot by bhecquet.
the class GenericMultiBrowserTest method exposeTestPage.
@BeforeClass(groups = { "it", "ut", "upload", "ie" })
public void exposeTestPage(final ITestContext testNGCtx) throws Exception {
// skip following if driver is already defined from an other test
if (driver != null) {
return;
}
if (browserType == null || !installedBrowsers.contains(browserType)) {
return;
}
localAddress = Inet4Address.getLocalHost().getHostAddress();
// localAddress = Inet4Address.getByName("localhost").getHostAddress();
server = new WebServer(localAddress, getPageMapping());
server.expose();
logger.info(String.format("exposing server on http://%s:%d", localAddress, server.getServerHost().getPort()));
initThreadContext(testNGCtx);
initBeforeMethod();
try {
switch(testPageName) {
case "DriverTestPageWithoutFixedPattern":
testPageUrl = String.format("http://%s:%d/testWithoutFixedPattern.html", localAddress, server.getServerHost().getPort());
testPageWithoutPattern = new DriverTestPageWithoutFixedPattern(true, testPageUrl);
break;
case "DriverTestPage":
testPageUrl = String.format("http://%s:%d/test.html", localAddress, server.getServerHost().getPort());
testPage = new DriverTestPage(true, testPageUrl);
break;
case "DriverTestPageNativeActions":
testPageUrl = String.format("http://%s:%d/test.html", localAddress, server.getServerHost().getPort());
testPageNativeActions = new DriverTestPageNativeActions(true, testPageUrl);
break;
case "DriverTestPageObjectFactory":
testPageUrl = String.format("http://%s:%d/test.html", localAddress, server.getServerHost().getPort());
testPageObjectFactory = new DriverTestPageObjectFatory(true, testPageUrl);
break;
case "DriverTestAngularFrame":
testPageUrl = String.format("http://%s:%d/testAngularIFrame.html", localAddress, server.getServerHost().getPort());
angularFramePage = new DriverTestAngularFrame(true, testPageUrl);
break;
case "DriverSubAngularTestPage":
testPageUrl = String.format("http://%s:%d/angularApp/index.html", localAddress, server.getServerHost().getPort());
angularPage = new DriverSubAngularTestPage(true, testPageUrl);
break;
case "DriverScrollingTestPage":
testPageUrl = String.format("http://%s:%d/testScrolling.html", localAddress, server.getServerHost().getPort());
scrollingTestPage = new DriverScrollingTestPage(true, testPageUrl);
break;
case "DriverTestPageSalesforceLightning":
lightningPage = new DriverTestPageSalesforceLightning();
break;
}
} catch (Exception e) {
logger.error("Error opening page");
logger.error(WebUIDriver.getWebDriver(true).getPageSource());
throw e;
}
driver = WebUIDriver.getWebDriver(true);
}
use of com.seleniumtests.it.driver.support.pages.DriverTestPage in project seleniumRobot by bhecquet.
the class TestDriver method testCaptureWhenWindowIsClosed.
/**
* @throws Exception
*/
public void testCaptureWhenWindowIsClosed() throws Exception {
DriverTestPage page = new DriverTestPage();
page._goToNewPage();
// close window
DriverSubTestPage.closeButton.click();
Alert alert = page.waitForAlert(3);
if (alert != null) {
alert.accept();
}
try {
driver.getCurrentUrl();
} catch (NoSuchWindowException e) {
}
Assert.assertNotNull(WebUIDriver.getWebDriver(false));
}
use of com.seleniumtests.it.driver.support.pages.DriverTestPage in project seleniumRobot by bhecquet.
the class TestPageObject method testPageObjectForExternalDriver.
/**
* issue #324: check handles are not null. We cannot directly reproduce problem because we should have a test site which creates a second window when opened
* @throws Exception
*/
@Test(groups = { "it", "pageobject" })
public void testPageObjectForExternalDriver() throws Exception {
try {
SeleniumTestsContextManager.getThreadContext().setTestType(TestType.WEB);
Map<BrowserType, List<BrowserInfo>> browsers = OSUtility.getInstalledBrowsersWithVersion();
String path = browsers.get(BrowserType.CHROME).get(0).getPath();
int port = GenericDriverTest.findFreePort();
// create chrome browser with the right option
OSCommand.executeCommand(new String[] { path, "--remote-debugging-port=" + port, "about:blank" });
DriverTestPage secondPage = new DriverTestPage(BrowserType.CHROME, port);
Assert.assertNotNull(secondPage.getCurrentHandles());
} finally {
// switch back to main driver to avoid annoying other tests
testPage.switchToDriver("main");
}
}
Aggregations