예제 #1
0
  @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"));
  }
예제 #2
0
  @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");
  }
예제 #3
0
  @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");
  }
예제 #4
0
  @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/");
  }
예제 #5
0
  @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");
  }