use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestHtmlElement method testIsDisplayedExceptionSetStepFailed.
/**
* check correction of issue #10': step should be failed for all other actions
* but waitForPresent
*
* @throws Exception
*/
@Test(groups = { "ut" })
public void testIsDisplayedExceptionSetStepFailed() throws Exception {
TestStep step = new TestStep("step 1", null, new ArrayList<>(), true);
TestStepManager.setParentTestStep(step);
SeleniumTestsContextManager.getThreadContext().setReplayTimeout(1);
when(element.isDisplayed()).thenThrow(new WebDriverException("error"));
Assert.assertFalse(el.isDisplayed());
Assert.assertEquals(step.getStepStatus(), StepStatus.WARNING);
}
use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestHtmlElement method testIsPresentExceptionDoNotSetStepFailed.
/**
* Check that when using isElementPresent, step is not marked as failed. So
* report will show step as green check correction of issue #104
*
* @throws Exception
*/
@Test(groups = { "ut" })
public void testIsPresentExceptionDoNotSetStepFailed() throws Exception {
TestStep step = new TestStep("step 1", null, new ArrayList<>(), true);
TestStepManager.setParentTestStep(step);
SeleniumTestsContextManager.getThreadContext().setReplayTimeout(1);
when(driver.findElement(By.id("el"))).thenThrow(new NoSuchElementException(""));
Assert.assertEquals(el.isElementPresent(1), false);
Assert.assertEquals(step.getStepStatus(), StepStatus.SUCCESS);
}
use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestTestStep method testTestSubFilePositionAndParent.
@Test(groups = { "ut" })
public void testTestSubFilePositionAndParent() throws IOException {
TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
TestStep subStep = new TestStep("subStep1", null, new ArrayList<>(), true);
step.addStep(subStep);
GenericFile file = new GenericFile(File.createTempFile("video", ".avi"), "video file");
step.addFile(file);
Assert.assertEquals(file.getPosition(), 1);
Assert.assertEquals(file.getParent(), step);
}
use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestTestStep method testTestSubSnapshotPositionAndParent.
@Test(groups = { "ut" })
public void testTestSubSnapshotPositionAndParent() throws IOException {
TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
TestStep subStep = new TestStep("subStep1", null, new ArrayList<>(), true);
step.addStep(subStep);
ScreenShot screenshot = new ScreenShot();
File tmpImgFile = File.createTempFile("img", ".png");
File tmpHtmlFile = File.createTempFile("html", ".html");
screenshot.setOutputDirectory(tmpImgFile.getParent());
screenshot.setLocation("http://mysite.com");
screenshot.setTitle("mysite");
screenshot.setImagePath(tmpImgFile.getName());
screenshot.setHtmlSourcePath(tmpHtmlFile.getName());
Snapshot snapshot = new Snapshot(screenshot, "main", SnapshotCheckType.TRUE);
step.addSnapshot(snapshot, 0, null);
Assert.assertEquals(snapshot.getPosition(), 0);
Assert.assertEquals(snapshot.getParent(), step);
}
use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestTestStep method testTestStepEncodeUnexpected.
@Test(groups = { "ut" }, expectedExceptions = CustomSeleniumTestsException.class)
public void testTestStepEncodeUnexpected() {
TestStep step = new TestStep("step1 \"'<>&", null, new ArrayList<>(), true);
step.encode("wrongFormat");
}
Aggregations