Search in sources :

Example 41 with TestAction

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

the class StubTestClassforTestDescription method testWithDescription.

@Test(groups = "stub", description = "a test with param ${url}")
public void testWithDescription() throws IOException {
    TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), true);
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    step1.addAction(new TestAction("sendKeys to text field", true, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Example 42 with TestAction

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

the class TestTestStep method testGetFailedWithActionSubStepOk.

/**
 * Checks getFailed correctly compute test step status if sub step is not failed
 */
@Test(groups = { "ut" })
public void testGetFailedWithActionSubStepOk() {
    TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
    TestStep subStep = new TestStep("subStep", null, new ArrayList<>(), true);
    subStep.addAction(new TestAction("action1", false, new ArrayList<>()));
    step.addAction(new TestAction("action2", false, new ArrayList<>()));
    Assert.assertFalse(step.getFailed());
    Assert.assertEquals(step.getStepStatus(), StepStatus.SUCCESS);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 43 with TestAction

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

the class TestTestStep method testEncodeXml.

/**
 * Check Step / sub-step encoding with XML
 */
@Test(groups = { "ut" })
public void testEncodeXml() {
    TestStep step = new TestStep("step1 \"'<>&", null, new ArrayList<>(), true);
    step.addMessage(new TestMessage("everything OK \"'<>&", MessageType.INFO));
    step.addAction(new TestAction("action2 \"'<>&", false, new ArrayList<>()));
    TestStep subStep = new TestStep("subStep", null, new ArrayList<>(), true);
    subStep.addMessage(new TestMessage("everything in subStep almost OK", MessageType.WARNING));
    subStep.addAction(new TestAction("action1 \"'<>&", false, new ArrayList<>()));
    step.addAction(subStep);
    TestStep encodedTestStep = step.encode("xml");
    Assert.assertTrue(encodedTestStep.toString().contains("Step step1 &quot;&apos;&lt;&gt;&amp;"));
    Assert.assertTrue(encodedTestStep.toString().contains("everything OK &quot;&apos;&lt;&gt;&amp;"));
    Assert.assertTrue(encodedTestStep.toString().contains("action2 &quot;&apos;&lt;&gt;&amp;"));
    Assert.assertTrue(encodedTestStep.toString().contains("action1 &quot;&apos;&lt;&gt;&amp;"));
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ArrayList(java.util.ArrayList) TestMessage(com.seleniumtests.reporter.logger.TestMessage) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 44 with TestAction

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

the class TestTestStep method testToString.

@Test(groups = { "ut" })
public void testToString() throws IOException {
    TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
    step.addMessage(new TestMessage("everything OK", MessageType.INFO));
    step.addAction(new TestAction("action2", false, new ArrayList<>()));
    Har har = new Har(new HarLog());
    har.getLog().addPage(new HarPage("title", "a title"));
    step.addNetworkCapture(new HarCapture(har, "main"));
    GenericFile file = new GenericFile(File.createTempFile("video", ".avi"), "video file");
    step.addFile(file);
    TestStep subStep = new TestStep("subStep", null, new ArrayList<>(), true);
    subStep.addMessage(new TestMessage("everything in subStep almost OK", MessageType.WARNING));
    subStep.addAction(new TestAction("action1", false, new ArrayList<>()));
    step.addAction(subStep);
    step.addAction(new TestAction("action3", false, new ArrayList<>()));
    Assert.assertEquals(step.toString(), "Step step1\n" + "  - everything OK\n" + "  - action2\n" + "  - Step subStep\n" + "    - everything in subStep almost OK\n" + "    - action1\n" + "  - action3");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) HarLog(net.lightbody.bmp.core.har.HarLog) ArrayList(java.util.ArrayList) Har(net.lightbody.bmp.core.har.Har) HarCapture(com.seleniumtests.reporter.logger.HarCapture) TestMessage(com.seleniumtests.reporter.logger.TestMessage) HarPage(net.lightbody.bmp.core.har.HarPage) GenericFile(com.seleniumtests.reporter.logger.GenericFile) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 45 with TestAction

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

the class TestTestStep method testDurationWithSubStep.

/**
 * Check duration is correctly handled with sub steps
 */
@Test(groups = { "ut" })
public void testDurationWithSubStep() {
    TestStep step = new TestStep("step1", null, new ArrayList<>(), true);
    step.setDuration(5000L);
    step.setDurationToExclude(500L);
    TestStep subStep = new TestStep("subStep", null, new ArrayList<>(), true);
    TestAction action = new TestAction("action2", false, new ArrayList<>());
    action.setDurationToExclude(600L);
    subStep.addAction(action);
    step.addAction(subStep);
    Assert.assertEquals(step.getDuration(), (Long) 3900L);
}
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