Search in sources :

Example 96 with ShellIsAvailable

use of org.eclipse.reddeer.swt.condition.ShellIsAvailable in project jbosstools-openshift by jbosstools.

the class EnvironmentVariableWizardPage method addEnvironmentVariable.

/**
 * Creates a new environment variable.
 *
 * @param envVar environment variable to create
 * @return true if environment variable was created successfully, false otherwise
 */
public boolean addEnvironmentVariable(EnvVar envVar) {
    DefaultTable table = new DefaultTable();
    new PushButton(OpenShiftLabel.Button.ADD).click();
    new DefaultShell(OpenShiftLabel.Shell.ENVIRONMENT_VARIABLE);
    new LabeledText("Name:").setText(envVar.getName());
    new LabeledText("Value:").setText(envVar.getValue());
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.ENVIRONMENT_VARIABLE));
    return table.containsItem(envVar.getName(), 0) && table.containsItem(envVar.getValue(), 1);
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 97 with ShellIsAvailable

use of org.eclipse.reddeer.swt.condition.ShellIsAvailable in project jbosstools-openshift by jbosstools.

the class EnvironmentVariableWizardPage method editEnvironmentVariable.

/**
 * Changes an existing environment variable to have new values.
 * New and old environment variables passed as arguments should be different
 * at least in one attribute (name or value).
 *
 * @param oldVar old environment variable
 * @param newVar environment variable with new values
 * @return if environment variable was edited successfully, false otherwise
 */
public boolean editEnvironmentVariable(EnvVar oldVar, EnvVar newVar) {
    DefaultTable table = new DefaultTable();
    table.getItem(oldVar.getName()).select();
    new PushButton(OpenShiftLabel.Button.EDIT).click();
    new DefaultShell(OpenShiftLabel.Shell.ENVIRONMENT_VARIABLE);
    LabeledText name = new LabeledText(OpenShiftLabel.TextLabels.NAME);
    if (!name.isReadOnly()) {
        name.setText(newVar.getName());
    }
    new LabeledText(OpenShiftLabel.TextLabels.VALUE).setText(newVar.getValue());
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.ENVIRONMENT_VARIABLE));
    return (table.containsItem(newVar.getName(), 0) && table.containsItem(newVar.getValue(), 1)) && !(table.containsItem(oldVar.getName(), 0) && table.containsItem(oldVar.getValue(), 1));
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 98 with ShellIsAvailable

use of org.eclipse.reddeer.swt.condition.ShellIsAvailable in project jbosstools-openshift by jbosstools.

the class DeleteResourcesWizard method openWizardFromExplorer.

/**
 * Opens a new OpenShift 3 Delete Resources... wizard from OpenShift Explorer view with the given project pre-selected.
 * If the project is null, a generated project is used.
 *
 * @param project project name for deleting resources
 */
public void openWizardFromExplorer(String project) {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.reopen();
    selectExplorerProject(project, explorer);
    new ContextMenuItem(OpenShiftLabel.ContextMenu.DELETE_RESOURCES).select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.DELETE_OS_RESOURCES), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.DELETE_OS_RESOURCES);
    new WaitUntil(new TableHasRows(new DefaultTable()), TimePeriod.LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) TableHasRows(org.eclipse.reddeer.swt.condition.TableHasRows) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)

Example 99 with ShellIsAvailable

use of org.eclipse.reddeer.swt.condition.ShellIsAvailable in project jbosstools-openshift by jbosstools.

the class ResourceLabelsWizardPage method deleteLabel.

/**
 * Removes resource label
 * @param name name of label to remove
 * @return true if label has been removed successfully, false otherwise
 */
public boolean deleteLabel(String name) {
    new DefaultTable().select(name);
    new PushButton(OpenShiftLabel.Button.REMOVE).click();
    new DefaultShell(OpenShiftLabel.Shell.REMOVE_LABEL);
    new YesButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.REMOVE_LABEL));
    return new DefaultTable().containsItem(name);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton)

Example 100 with ShellIsAvailable

use of org.eclipse.reddeer.swt.condition.ShellIsAvailable in project jbosstools-openshift by jbosstools.

the class CDKImageRegistryUrlDiscoveryFailureTest method testRegistryUrlNotFoundDialog.

/**
 * Covers JBIDE-25049
 */
@Test
public void testRegistryUrlNotFoundDialog() {
    String shellTitle = OpenShiftLabel.Shell.REGISTRY_URL_NOT_FOUND;
    wizard.getImageRegistryUrl().setText("");
    wizard.finish();
    stopServerAdapter();
    wizard = connection.editConnection();
    switchOffPasswordSaving();
    try {
        wizard.discover();
        fail("Expected OpenshiftToolsException was not thrown, possibly no dialog is shown.");
    } catch (OpenShiftToolsException osExc) {
        // os exception was thrown with specific message
        assertTrue("Registry URL not found dialog did not appear.", osExc.getMessage().contains(shellTitle));
        // error dialog is still there
        new WaitUntil(new ShellIsAvailable(shellTitle), TimePeriod.SHORT);
        new DefaultShell(shellTitle);
        new OkButton().click();
    }
    wizard.cancel();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) Test(org.junit.Test)

Aggregations

ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)128 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)97 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)84 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)73 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)52 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)47 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)44 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)33 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)32 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)30 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)25 Test (org.junit.Test)21 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)19 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)18 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)18 Shell (org.eclipse.reddeer.swt.api.Shell)17 YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)14 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)13 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)13 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)10