Search in sources :

Example 1 with DefaultApplicationActionFactory

use of com.hribol.automation.core.execution.application.DefaultApplicationActionFactory in project selenium_java by sergueik.

the class DefaultApplicationActionFactoryTest method canCreatePageLoadingAndOtherActions.

@Test
public void canCreatePageLoadingAndOtherActions() {
    String url = "http://tenniskafe.com";
    String actionName = "actionName";
    ApplicationActionConfiguration applicationActionConfiguration = mock(ApplicationActionConfiguration.class);
    when(applicationActionConfiguration.getName()).thenReturn(actionName);
    List<ApplicationActionConfiguration> applicationActionConfigurationList = new ArrayList<>();
    applicationActionConfigurationList.add(applicationActionConfiguration);
    ApplicationConfiguration applicationConfiguration = mock(ApplicationConfiguration.class);
    when(applicationConfiguration.getApplicationActionConfigurationList()).thenReturn(applicationActionConfigurationList);
    TestCaseToApplicationActionConverter testCaseToApplicationActionConverter = mock(TestCaseToApplicationActionConverter.class);
    ApplicationAction applicationAction = mock(ApplicationAction.class);
    Map<String, String> testCaseStep = new HashMap<>();
    testCaseStep.put("event", actionName);
    when(testCaseToApplicationActionConverter.convert(applicationActionConfiguration, testCaseStep)).thenReturn(applicationAction);
    ApplicationActionFactory applicationActionFactory = new DefaultApplicationActionFactory(url, applicationConfiguration, testCaseToApplicationActionConverter);
    ApplicationAction initialPageLoading = applicationActionFactory.getInitialPageLoading();
    assertFalse(initialPageLoading.getPrecondition().isPresent());
    assertEquals(applicationAction, applicationActionFactory.create(testCaseStep));
}
Also used : ApplicationAction(com.hribol.automation.core.execution.application.ApplicationAction) TestCaseToApplicationActionConverter(com.hribol.automation.core.execution.application.TestCaseToApplicationActionConverter) ApplicationActionConfiguration(com.hribol.automation.core.config.ApplicationActionConfiguration) HashMap(java.util.HashMap) DefaultApplicationActionFactory(com.hribol.automation.core.execution.application.DefaultApplicationActionFactory) ApplicationActionFactory(com.hribol.automation.core.execution.application.ApplicationActionFactory) ArrayList(java.util.ArrayList) DefaultApplicationActionFactory(com.hribol.automation.core.execution.application.DefaultApplicationActionFactory) ApplicationConfiguration(com.hribol.automation.core.config.ApplicationConfiguration) Test(org.junit.Test)

Example 2 with DefaultApplicationActionFactory

use of com.hribol.automation.core.execution.application.DefaultApplicationActionFactory in project selenium_java by sergueik.

the class DefaultApplicationActionFactoryTest method canCreatePageLoading.

@Test
public void canCreatePageLoading() {
    String url = "http://tenniskafe.com";
    String applicationName = "tenniskafe";
    ApplicationConfiguration applicationConfiguration = mock(ApplicationConfiguration.class);
    when(applicationConfiguration.getApplicationName()).thenReturn(applicationName);
    WebDriverActionFactory webDriverActionFactory = mock(WebDriverActionFactory.class);
    ApplicationActionFactory applicationActionFactory = new DefaultApplicationActionFactory(url, applicationConfiguration, webDriverActionFactory);
    assertFalse(applicationActionFactory.getInitialPageLoading().getPrecondition().isPresent());
    assertFalse(applicationActionFactory.getInitialPageLoading().getPostcondition().isPresent());
}
Also used : WebDriverActionFactory(com.hribol.automation.core.execution.factory.WebDriverActionFactory) DefaultApplicationActionFactory(com.hribol.automation.core.execution.application.DefaultApplicationActionFactory) ApplicationActionFactory(com.hribol.automation.core.execution.application.ApplicationActionFactory) DefaultApplicationActionFactory(com.hribol.automation.core.execution.application.DefaultApplicationActionFactory) ApplicationConfiguration(com.hribol.automation.core.config.ApplicationConfiguration) Test(org.junit.Test)

Aggregations

ApplicationConfiguration (com.hribol.automation.core.config.ApplicationConfiguration)2 ApplicationActionFactory (com.hribol.automation.core.execution.application.ApplicationActionFactory)2 DefaultApplicationActionFactory (com.hribol.automation.core.execution.application.DefaultApplicationActionFactory)2 Test (org.junit.Test)2 ApplicationActionConfiguration (com.hribol.automation.core.config.ApplicationActionConfiguration)1 ApplicationAction (com.hribol.automation.core.execution.application.ApplicationAction)1 TestCaseToApplicationActionConverter (com.hribol.automation.core.execution.application.TestCaseToApplicationActionConverter)1 WebDriverActionFactory (com.hribol.automation.core.execution.factory.WebDriverActionFactory)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1