Search in sources :

Example 6 with WithTextMatcher

use of org.eclipse.reddeer.core.matcher.WithTextMatcher in project jbosstools-openshift by jbosstools.

the class AuthenticationTokenRetrival method retrieveToken.

/**
 * Represents action of clicking on retrieve new token link, wait for browser to
 * appear, log in and obtain new token.
 *
 * @return token string
 */
public String retrieveToken() {
    EmulatedLinkStyledText linkText = new EmulatedLinkStyledText(OpenShiftLabel.TextLabels.RETRIEVE_TOKEN);
    linkText.click(linkText.getPositionOfText(OpenShiftLabel.TextLabels.LINK_RETRIEVE) + 3);
    new WaitUntil(new ShellIsActive(new WithTextMatcher("Unnamed")), TimePeriod.MEDIUM, false);
    DefaultShell browser = new DefaultShell();
    InternalBrowser internalBrowser = new InternalBrowser(browser);
    login(internalBrowser);
    new WaitUntil(new LoginPageIsLoaded(() -> internalBrowser.getText().contains(PAGETITLE_API_TOKEN)));
    String token = getTokenFromBrowser(internalBrowser);
    // close browser shell
    new PushButton(OpenShiftLabel.Button.CLOSE).click();
    return token;
}
Also used : ShellIsActive(org.eclipse.reddeer.swt.condition.ShellIsActive) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) InternalBrowser(org.eclipse.reddeer.swt.impl.browser.InternalBrowser) LoginPageIsLoaded(org.jboss.tools.openshift.reddeer.condition.LoginPageIsLoaded) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 7 with WithTextMatcher

use of org.eclipse.reddeer.core.matcher.WithTextMatcher in project jbosstools-openshift by jbosstools.

the class NodeJSAppDebugTest method getVariable.

/**
 * getVariable from Variables view.
 *
 * @param variable
 *            name
 * @return TreeItem
 */
protected TreeItem getVariable(String name) {
    WorkbenchView variables = new WorkbenchView("Variables");
    variables.activate();
    DefaultTree variablesTree = new DefaultTree();
    TreeItem var = null;
    try {
        new WaitUntil(new TreeContainsItem(variablesTree, new WithTextMatcher(name), false));
    } catch (WaitTimeoutExpiredException e) {
        // not found
        return null;
    }
    List<TreeItem> vars = variablesTree.getItems();
    for (TreeItem i : vars) {
        if (i.getText().equals(name)) {
            var = i;
        }
    }
    return var;
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) WorkbenchView(org.eclipse.reddeer.workbench.impl.view.WorkbenchView) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 8 with WithTextMatcher

use of org.eclipse.reddeer.core.matcher.WithTextMatcher in project jbosstools-openshift by jbosstools.

the class CDKLaunchConfigurationDialog method apply.

public void apply() {
    logger.info("Pressing apply button...");
    Button apply = new PushButton(this, new WithTextMatcher("Apply"));
    if (apply.isEnabled()) {
        apply.click();
    }
}
Also used : PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Button(org.eclipse.reddeer.swt.api.Button) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 9 with WithTextMatcher

use of org.eclipse.reddeer.core.matcher.WithTextMatcher in project jbosstools-openshift by jbosstools.

the class CDKLaunchConfigurationDialog method revert.

public void revert() {
    logger.info("Pressing revert button...");
    Button revert = new PushButton(this, new WithTextMatcher("Revert"));
    if (revert.isEnabled()) {
        revert.click();
    }
}
Also used : PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Button(org.eclipse.reddeer.swt.api.Button) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 10 with WithTextMatcher

use of org.eclipse.reddeer.core.matcher.WithTextMatcher in project jbosstools-openshift by jbosstools.

the class CreateApplicationFromTemplateTest method importApplicationAndVerify.

public static void importApplicationAndVerify(String projectName) {
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION));
    new DefaultShell(OpenShiftLabel.Shell.IMPORT_APPLICATION);
    try {
        new CheckBox(new WithTextMatcher(new StringStartsWith("Do not clone"))).toggle(true);
    } catch (CoreLayerException ex) {
    // git directory is not in use
    } catch (WaitTimeoutExpiredException ex) {
    // swallow, checkbox is disabled
    }
    new FinishButton().click();
    ProjectExplorer projectExplorer = new ProjectExplorer();
    projectExplorer.open();
    OpenShiftUtils.handleCheatSheetCreateServerAdapter();
    new WaitUntil(new ProjectExists(projectName, new ProjectExplorer()), TimePeriod.LONG, false);
    assertTrue("Project Explorer should contain imported project " + projectName, projectExplorer.containsProject(projectName));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) StringStartsWith(org.hamcrest.core.StringStartsWith) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) ProjectExists(org.eclipse.reddeer.eclipse.condition.ProjectExists) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Aggregations

WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)19 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)15 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)9 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)8 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)7 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)5 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)4 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)4 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 RadioButton (org.eclipse.reddeer.swt.impl.button.RadioButton)3 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)3 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)3 Test (org.junit.Test)3 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)2 RegexMatcher (org.eclipse.reddeer.common.matcher.RegexMatcher)2 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 WidgetIsFound (org.eclipse.reddeer.core.condition.WidgetIsFound)2 Button (org.eclipse.reddeer.swt.api.Button)2 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)2 CheckBox (org.eclipse.reddeer.swt.impl.button.CheckBox)2