コード例 #1
0
  @Test
  public void should_list_links() {
    ProjectLinksPage page = openPage();

    page.getLinks().shouldHaveSize(2);

    List<ProjectLinkItem> links = page.getLinksAsItems();
    ProjectLinkItem homepageLink = links.get(0);
    ProjectLinkItem customLink = links.get(1);

    homepageLink.getName().should(hasText("Home"));
    homepageLink.getType().should(hasText("sonar.links.homepage"));
    homepageLink.getUrl().should(hasText("http://example.com"));
    homepageLink.getDeleteButton().shouldNot(Condition.present);

    customLink.getName().should(hasText("Custom"));
    customLink.getType().shouldNot(Condition.present);
    customLink.getUrl().should(hasText("http://example.org/custom"));
    customLink.getDeleteButton().shouldBe(Condition.visible);
  }
コード例 #2
0
  @Test
  public void should_create_link() {
    ProjectLinksPage page = openPage();

    page.getLinks().shouldHaveSize(2);

    $("#create-project-link").click();
    $("#create-link-name").setValue("Test");
    $("#create-link-url").setValue("http://example.com/test");
    $("#create-link-confirm").click();

    page.getLinks().shouldHaveSize(3);

    ProjectLinkItem testLink = page.getLinksAsItems().get(2);

    testLink.getName().should(hasText("Test"));
    testLink.getType().shouldNot(Condition.present);
    testLink.getUrl().should(hasText("http://example.com/test"));
    testLink.getDeleteButton().shouldBe(Condition.visible);
  }