예제 #1
0
  @Test
  public void should_delete_link() {
    ProjectLinksPage page = openPage();

    page.getLinks().shouldHaveSize(2);

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

    customLink.getDeleteButton().click();
    $("#delete-link-confirm").click();

    page.getLinks().shouldHaveSize(1);
  }
예제 #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);
  }
예제 #3
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);
  }