Search in sources :

Example 1 with DriverSubTestPage

use of com.seleniumtests.it.driver.support.pages.DriverSubTestPage in project seleniumRobot by bhecquet.

the class TestBrowserSnapshot method testNoScrollbarCapture.

/**
 * Test when no scrollbar is present in capture
 * @throws Exception
 */
@Test(groups = { "it" })
public void testNoScrollbarCapture() throws Exception {
    new DriverSubTestPage(true);
    // get real capture
    String origFilePath = generateCaptureFilePath();
    captureSnapshot(origFilePath);
    Dimension screenshotDim = getViewPortDimension(new File(origFilePath));
    // get cropped picture
    BufferedImage image = new ScreenshotUtil(driver).capture(SnapshotTarget.PAGE, BufferedImage.class);
    // check all scrollbars where already removed from screenshot
    Assert.assertEquals(image.getWidth(), screenshotDim.width);
    Assert.assertEquals(image.getHeight(), screenshotDim.height);
}
Also used : ScreenshotUtil(com.seleniumtests.driver.screenshots.ScreenshotUtil) DriverSubTestPage(com.seleniumtests.it.driver.support.pages.DriverSubTestPage) Dimension(org.openqa.selenium.Dimension) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) Test(org.testng.annotations.Test) GenericMultiBrowserTest(com.seleniumtests.it.driver.support.GenericMultiBrowserTest)

Example 2 with DriverSubTestPage

use of com.seleniumtests.it.driver.support.pages.DriverSubTestPage in project seleniumRobot by bhecquet.

the class TestPageObject method testCloseLastTab.

/**
 * open 3 pages and check that when we close the last one, we go to the previous, not the first one
 * @throws Exception
 */
@Test(groups = { "it", "pageobject" })
public void testCloseLastTab() throws Exception {
    testPage._goToNewPage();
    testPage.getFocus();
    DriverSubTestPage subPage2 = testPage._goToNewPage();
    subPage2.close();
    // check we are on the seconde page (an instance of the DriverSubTestPage)
    // next line will produce error if we are not on the page
    new DriverSubTestPage();
}
Also used : DriverSubTestPage(com.seleniumtests.it.driver.support.pages.DriverSubTestPage) GenericDriverTest(com.seleniumtests.GenericDriverTest) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Aggregations

DriverSubTestPage (com.seleniumtests.it.driver.support.pages.DriverSubTestPage)2 Test (org.testng.annotations.Test)2 GenericDriverTest (com.seleniumtests.GenericDriverTest)1 GenericTest (com.seleniumtests.GenericTest)1 ScreenshotUtil (com.seleniumtests.driver.screenshots.ScreenshotUtil)1 GenericMultiBrowserTest (com.seleniumtests.it.driver.support.GenericMultiBrowserTest)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 Dimension (org.openqa.selenium.Dimension)1