Example usage for org.openqa.selenium By linkText

List of usage examples for org.openqa.selenium By linkText

Introduction

In this page you can find the example usage for org.openqa.selenium By linkText.

Prototype

public static By linkText(String linkText) 

Source Link

Usage

From source file:com.zutubi.pulse.acceptance.ConfigUIAcceptanceTest.java

License:Apache License

public void testClearItemPicker() throws Exception {
    rpcClient.RemoteApi.ensureProject(random);

    getBrowser().loginAsAdmin();//  w  ww.  j a v  a  2s . c o m
    ProjectConfigPage configPage = getBrowser().openAndWaitFor(ProjectConfigPage.class, random, false);
    ListPage listPage = configPage.clickCollection("permissions", "permissions");
    listPage.waitFor();
    assertEquals("[view]", listPage.getCellContent(0, 1));

    By viewLink = By.linkText("view");
    getBrowser().click(viewLink);
    ProjectAclForm form = getBrowser().createForm(ProjectAclForm.class);
    form.waitFor();
    assertTrue(form.checkFormValues("all users", "view"));
    form.saveFormElements(null, "");
    listPage.waitFor();

    assertEquals("[]", listPage.getCellContent(0, 1));
    getBrowser().click(viewLink);
    form = getBrowser().createForm(ProjectAclForm.class);
    form.waitFor();
    assertTrue(form.checkFormValues("all users", ""));
}

From source file:com.zutubi.pulse.acceptance.DeleteAcceptanceTest.java

License:Apache License

public void testDeleteProject() throws Exception {
    // Set up the project to build on the master agent, using a custom
    // persistent work directory.
    String projectPath = rpcClient.RemoteApi.insertSimpleProject(random, false);
    File buildDirectory = runBuildInPersistentWorkDirectory();
    assertTrue(buildDirectory.isDirectory());

    Repository repository = new Repository();
    File repositoryDirectory = new File(repository.getBase(), random);
    assertTrue(repositoryDirectory.isDirectory());

    getBrowser().loginAsAdmin();/*from   w w w  .j  a  v  a 2  s  .co m*/
    ProjectHierarchyPage hierarchyPage = getBrowser().openAndWaitFor(ProjectHierarchyPage.class, random, false);
    DeleteConfirmPage confirmPage = hierarchyPage.clickDelete();
    confirmPage.waitFor();
    assertTasks(confirmPage, projectPath, ACTION_DELETE_RECORD, projectPath, ACTION_DELETE_BUILDS);
    confirmPage.clickDelete();
    ProjectHierarchyPage global = getBrowser().createPage(ProjectHierarchyPage.class,
            ProjectManager.GLOBAL_PROJECT_NAME, true);
    global.waitFor();
    assertFalse(getBrowser().isElementPresent(By.linkText(random)));

    BrowsePage browsePage = getBrowser().openAndWaitFor(BrowsePage.class);
    assertFalse(browsePage.isProjectPresent(null, random));

    waitForDirectoryToBeCleaned(buildDirectory);
    waitForDirectoryToBeCleaned(repositoryDirectory);
}

From source file:com.zutubi.pulse.acceptance.pages.admin.HierarchyPage.java

License:Apache License

public void waitFor() {
    // Wait for the default right panel to load.
    waitForActionToComplete();//from  w ww. j a  va 2 s  . co  m

    // Choose our panel and wait for it.
    By panelLink = By.linkText(baseName);
    browser.waitForElement(panelLink);
    browser.click(panelLink);
    super.waitFor();
}

From source file:com.zutubi.pulse.acceptance.pages.admin.HierarchyPage.java

License:Apache License

public boolean isTreeItemPresent(String baseName) {
    return browser.isElementPresent(By.linkText(baseName));
}

From source file:com.zutubi.pulse.acceptance.pages.admin.HierarchyPage.java

License:Apache License

public boolean isTreeItemVisible(String baseName) {
    return browser.isVisible(By.linkText(baseName));
}

From source file:com.zutubi.pulse.acceptance.pages.admin.HierarchyPage.java

License:Apache License

public void expandTreeItem(String baseName) {
    browser.doubleClick(By.linkText(baseName));
}

From source file:com.zutubi.pulse.acceptance.pages.admin.HierarchyPage.java

License:Apache License

public void selectTreeItem(String baseName) {
    browser.waitAndClick(By.linkText(baseName));
}

From source file:com.zutubi.pulse.acceptance.PersonalBuildAcceptanceTest.java

License:Apache License

private void verifyPersonalBuildTabs(String projectName, long buildNumber, String buildFilePath) {
    // Verify each tab in turn
    getBrowser().openAndWaitFor(PersonalBuildSummaryPage.class, buildNumber);
    getBrowser().waitForTextPresent("nosuchcommand");

    getBrowser().click(IDs.buildLogsTab());
    BuildLogsPage logsPage = getBrowser().createPage(BuildLogsPage.class, projectName, buildNumber, "default");
    logsPage.waitFor();// w  w w.java2 s  . c  om
    getBrowser().waitForTextPresent("Recipe '[default]' completed with status failure");

    getBrowser().click(IDs.buildDetailsTab());
    PersonalBuildDetailsPage detailsPage = getBrowser().createPage(PersonalBuildDetailsPage.class, buildNumber);
    detailsPage.waitFor();
    detailsPage.clickCommandAndWait("default", "build");
    getBrowser().waitForTextPresent("nosuchcommand");

    getBrowser().click(IDs.buildChangesTab());
    PersonalBuildChangesPage changesPage = getBrowser().createPage(PersonalBuildChangesPage.class, buildNumber);
    changesPage.waitFor();
    // Just parse to make sure it's a number: asserting the revision has
    // proven too fragile.
    Long.parseLong(changesPage.getCheckedOutRevision());
    assertEquals(buildFilePath, changesPage.getChangedFile(0));

    getBrowser().click(IDs.buildTestsTab());
    PersonalBuildTestsPage testsPage = getBrowser().createPage(PersonalBuildTestsPage.class, buildNumber);
    testsPage.waitFor();
    assertEquals(0, testsPage.getTestSummary().getTotal());

    getBrowser().click(IDs.buildFileTab());
    PersonalBuildFilePage filePage = getBrowser().createPage(PersonalBuildFilePage.class, buildNumber);
    filePage.waitFor();
    assertTrue(filePage.isHighlightedFilePresent());
    getBrowser().waitForTextPresent("<ant");

    PersonalBuildArtifactsPage artifactsPage = getBrowser().openAndWaitFor(PersonalBuildArtifactsPage.class,
            buildNumber);
    artifactsPage.setFilterAndWait("");
    getBrowser().waitForElement(By.linkText(artifactsPage.getCommandLinkText("build")));
}

From source file:com.zutubi.pulse.acceptance.SeleniumBrowser.java

License:Apache License

/**
 * Check if a link with the specified id is present in the current page.
 * //from w w w. j a v  a 2  s  . c o  m
 * @param id the link id
 * @return true if the requested link is found, false otherwise
 */
public boolean isLinkPresent(String id) {
    return isElementPresent(By.linkText(WebUtils.toValidHtmlName(id)));
}

From source file:com.zutubi.pulse.acceptance.windows.PulseFileSystemBrowserWindow.java

License:Apache License

public void selectNode(String path) {
    browser.click(By.linkText(path));
}