Search in sources :

Example 6 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class TestTestStep method testPasswordMaskingMainStep.

/**
 * Check that if main step contains masking, they are reported in messages /
 * action / step below
 */
@Test(groups = { "ut" })
public void testPasswordMaskingMainStep() {
    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.getName(), "step1 with args: (bar, ******)");
    Assert.assertEquals(action.getName(), "action in step1 with args: (foo, ******)");
    Assert.assertEquals(message.getName(), "everything OK on ******");
    Assert.assertEquals(substep.getName(), "substep with args: (******)");
    Assert.assertEquals(step.toString(), "Step step1 with args: (bar, ******)\n" + "  - action in step1 with args: (foo, ******)\n" + "  - everything OK on ******\n" + "  - Step substep with args: (******)");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) TestMessage(com.seleniumtests.reporter.logger.TestMessage) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 7 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class TestTestStep method testPasswordMaskingHtmlEncodedMainStep.

@Test(groups = { "ut" })
public void testPasswordMaskingHtmlEncodedMainStep() {
    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("html").getName(), "step1 with args: (bar, ******)");
    Assert.assertEquals(action.encode("html").getName(), "action in step1 with args: (foo, ******)");
    Assert.assertEquals(message.encode("html").getName(), "everything OK on ******");
    Assert.assertEquals(substep.encode("html").getName(), "substep with args: (******)");
    Assert.assertEquals(step.encode("html").toString(), "Step step1 with args: (bar, ******)\n" + "  - action in step1 with args: (foo, ******)\n" + "  - everything OK on ******\n" + "  - Step substep with args: (******)");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) TestMessage(com.seleniumtests.reporter.logger.TestMessage) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 8 with TestAction

use of com.seleniumtests.reporter.logger.TestAction 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: (******)");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) TestMessage(com.seleniumtests.reporter.logger.TestMessage) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 9 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class TestTestStep method testTestActionEncodeXmlExceptionKept.

@Test(groups = { "ut" })
public void testTestActionEncodeXmlExceptionKept() {
    TestAction action = new TestAction("action2 \"'<>&", false, new ArrayList<>());
    action.setActionException(new Throwable("foo"));
    TestAction encodedAction = action.encode("xml");
    Assert.assertNotNull(encodedAction.getActionException());
    Assert.assertEquals(encodedAction.getActionExceptionMessage(), "class java.lang.Throwable: foo");
}
Also used : TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 10 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class TestTestStep method testTestSubActionPositionAndParent.

@Test(groups = { "ut" })
public void testTestSubActionPositionAndParent() {
    TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
    TestStep subStep = new TestStep("subStep1", null, new ArrayList<>(), true);
    step.addStep(subStep);
    TestAction action = new TestAction("subStep2", null, new ArrayList<>());
    step.addAction(action);
    Assert.assertEquals(action.getPosition(), 1);
    Assert.assertEquals(action.getParent(), step);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Aggregations

TestAction (com.seleniumtests.reporter.logger.TestAction)56 TestStep (com.seleniumtests.reporter.logger.TestStep)47 Test (org.testng.annotations.Test)44 ArrayList (java.util.ArrayList)38 GenericTest (com.seleniumtests.GenericTest)24 TestMessage (com.seleniumtests.reporter.logger.TestMessage)12 DriverExceptions (com.seleniumtests.customexception.DriverExceptions)8 ScreenShot (com.seleniumtests.driver.screenshots.ScreenShot)5 Snapshot (com.seleniumtests.reporter.logger.Snapshot)5 File (java.io.File)5 HashMap (java.util.HashMap)5 GenericFile (com.seleniumtests.reporter.logger.GenericFile)3 Element (org.jdom2.Element)3 WebDriverException (org.openqa.selenium.WebDriverException)3 HarCapture (com.seleniumtests.reporter.logger.HarCapture)2 PageObject (com.seleniumtests.uipage.PageObject)2 Instant (java.time.Instant)2 Har (net.lightbody.bmp.core.har.Har)2 HarLog (net.lightbody.bmp.core.har.HarLog)2 HarPage (net.lightbody.bmp.core.har.HarPage)2