use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestTestStep method testTestStepEncodeXmlWebDriverExceptionKept.
/**
* Check that in case of a webdriver exception, platform information and capabilities are not returned
*/
@Test(groups = { "ut" })
public void testTestStepEncodeXmlWebDriverExceptionKept() {
TestStep step = new TestStep("step1 \"'<>&", null, new ArrayList<>(), true);
step.setActionException(new NoSuchElementException("foo"));
TestStep encodedTestStep = step.encode("xml");
Assert.assertNotNull(encodedTestStep.getActionException());
Assert.assertEquals(encodedTestStep.getActionExceptionMessage(), "class org.openqa.selenium.NoSuchElementException: foo\n");
}
use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestTestStep method testTestStepEncodeXmlStatusFailed.
/**
* check failed status is kept
*/
@Test(groups = { "ut" })
public void testTestStepEncodeXmlStatusFailed() {
TestStep step = new TestStep("step1 \"'<>&", null, new ArrayList<>(), true);
step.setFailed(true);
TestStep encodedTestStep = step.encode("xml");
Assert.assertTrue(encodedTestStep.getFailed());
}
use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestTestStep method testPasswordMaskingXmlEncodedMainStepWithSpecialCharacters.
@Test(groups = { "ut" })
public void testPasswordMaskingXmlEncodedMainStepWithSpecialCharacters() {
TestStep step = new TestStep("step1 with args: (bar, passwd§~$µ)", null, Arrays.asList("passwd§~$µ"), true);
TestAction action = new TestAction("action in step1 with args: (foo, passwd§~$µ)", false, new ArrayList<>());
TestMessage message = new TestMessage("everything OK on passwd§~$µ", MessageType.INFO);
TestStep substep = new TestStep("substep with args: (passwd§~$µ)", null, new ArrayList<>(), true);
step.addAction(action);
step.addMessage(message);
step.addStep(substep);
Assert.assertEquals(step.encode("xml").getName(), "step1 with args: (bar, ******)");
Assert.assertEquals(action.encode("xml").getName(), "action in step1 with args: (foo, ******)");
Assert.assertEquals(message.encode("xml").getName(), "everything OK on ******");
Assert.assertEquals(substep.encode("xml").getName(), "substep with args: (******)");
Assert.assertEquals(step.encode("xml").toString(), "Step step1 with args: (bar, ******)\n" + " - action in step1 with args: (foo, ******)\n" + " - everything OK on ******\n" + " - Step substep with args: (******)");
}
use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestTestStep method testSnapshotRenamingNoRandom.
/**
* Check case where random part of attachment is removed
* @throws IOException
*/
@Test(groups = { "ut" })
public void testSnapshotRenamingNoRandom() throws IOException {
SeleniumTestsContextManager.getThreadContext().setRandomInAttachmentNames(false);
TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
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());
step.addSnapshot(new Snapshot(screenshot, "main", SnapshotCheckType.TRUE), 0, null);
Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getImagePath(), "N-A_0-1_step1-.png");
Assert.assertEquals(step.getSnapshots().get(0).getScreenshot().getHtmlSourcePath(), "N-A_0-1_step1-.html");
tmpImgFile.deleteOnExit();
tmpHtmlFile.deleteOnExit();
}
use of com.seleniumtests.reporter.logger.TestStep in project seleniumRobot by bhecquet.
the class TestTestStep method testTestStepEncodeXmlHarKept.
@Test(groups = { "ut" })
public void testTestStepEncodeXmlHarKept() throws IOException {
Har har = new Har(new HarLog());
har.getLog().addPage(new HarPage("title", "a title"));
HarCapture cap = new HarCapture(har, "main");
TestStep step = new TestStep("step1 \"'<>&", null, new ArrayList<>(), true);
step.setHarCaptures(Arrays.asList(cap));
TestStep encodedTestStep = step.encode("xml");
Assert.assertEquals(encodedTestStep.getHarCaptures().get(0), cap);
}
Aggregations