Example #1
0
 private static void initStepListener() {
   Configuration configuration = Injectors.getInjector().getInstance(Configuration.class);
   File outputDirectory = configuration.getOutputDirectory();
   StepListener listener = new BaseStepListener(outputDirectory, getPages());
   stepListenerThreadLocal.set(listener);
   StepEventBus.getEventBus().registerListener(getStepListener());
 }
 public double getAverageTestSize() {
   if (totalImplementedTests() > 0) {
     return ((double) getStepCount()) / totalImplementedTests();
   } else {
     return configuration.getEstimatedAverageStepCount();
   }
 }
 public AnnotationBasedTagProvider(EnvironmentVariables vars) {
   super(vars);
   configuration = new SystemPropertiesConfiguration(environmentVariables);
   rootPackage = THUCYDIDES_TEST_ROOT.from(environmentVariables, rootDirectory);
   persister = new RequirementPersister(configuration.getOutputDirectory(), rootPackage);
   leafRequirements = Lists.newArrayList();
 }
  @Test(expected = IllegalArgumentException.class)
  public void the_url_annotation_should_throw_an_exception_if_no_named_url_is_found() {
    PageObject page = new PageObjectWithMultipleNamedUrlDefinitions(webdriver);
    PageUrls pageUrls = new PageUrls(page, configuration);
    page.setPageUrls(pageUrls);

    configuration.setDefaultBaseUrl("http://myapp.mycompany.com");

    page.open("no.such.template", withParameters("ISSUE-1"));
  }
  @Test
  public void the_base_url_should_be_used_if_no_url_annotation_is_present() {
    PageObject page = new PageObjectWithNoUrlDefinition(webdriver);
    configuration.setDefaultBaseUrl("http://www.google.com");
    PageUrls pageUrls = new PageUrls(page, configuration);
    page.setPageUrls(pageUrls);

    page.open();

    verify(webdriver).get("http://www.google.com");
  }
  @Test
  public void the_url_annotation_should_let_you_define_several_named_parameterized_urls() {
    PageObject page = new PageObjectWithMultipleNamedUrlDefinitions(webdriver);
    PageUrls pageUrls = new PageUrls(page, configuration);
    page.setPageUrls(pageUrls);

    configuration.setDefaultBaseUrl("http://myapp.mycompany.com");

    page.open("close.issue", withParameters("ISSUE-1"));

    verify(webdriver).get("http://myapp.mycompany.com/issues/close/ISSUE-1");
  }
  @Test
  public void the_url_annotation_can_be_relative_to_the_base_url_with_a_trailing_slash() {
    PageObject page = new PageObjectWithRelativeUrlDefinitionAndATrailingSlash(webdriver);
    PageUrls pageUrls = new PageUrls(page, configuration);
    page.setPageUrls(pageUrls);

    configuration.setDefaultBaseUrl("http://myapp.mycompany.com");

    page.open();

    verify(webdriver).get("http://myapp.mycompany.com/clients/");
  }
  @Test
  public void
      the_url_annotation_should_let_you_define_a_named_parameterized_url_relative_to_the_default_url() {
    PageObject page =
        new PageObjectWithDefaultUrlAndNamedParameterizedRelativeUrlDefinition(webdriver);
    PageUrls pageUrls = new PageUrls(page, configuration);
    page.setPageUrls(pageUrls);

    configuration.setDefaultBaseUrl(null);
    page.open("open.issue", withParameters("ISSUE-1"));

    verify(webdriver).get("http://jira.mycompany.org/issues/ISSUE-1");
  }
Example #9
0
 public String getSystemBaseUrl() {
   return configuration.getBaseUrl();
 }