Search in sources :

Example 66 with PushButton

use of org.eclipse.reddeer.swt.impl.button.PushButton in project jbosstools-openshift by jbosstools.

the class EnvironmentVariableWizardPage method resetEnvironmentVariable.

/**
 * Resets environment variable to its default state.
 *
 * @param changedVar
 * @param originalVar
 * @return true if variable was reset successfully, false otherwise
 */
public boolean resetEnvironmentVariable(EnvVar changedVar, EnvVar defaultVar) {
    DefaultTable table = new DefaultTable();
    table.getItem(changedVar.getName()).select();
    new PushButton(OpenShiftLabel.Button.RESET).click();
    new DefaultShell(OpenShiftLabel.Shell.RESET_ENV_VAR);
    new YesButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.RESET_ENV_VAR));
    return table.containsItem(defaultVar.getName(), 0) && table.containsItem(defaultVar.getValue(), 1);
}
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 67 with PushButton

use of org.eclipse.reddeer.swt.impl.button.PushButton in project jbosstools-openshift by jbosstools.

the class EnvironmentVariableWizardPage method resetAllVariables.

/**
 * Resets all edited environment variables and check whether default variables passed as argument are
 * displayed in the table.
 *
 * @param envVars environment variables to verify that were changed to default state
 * @return true if variables were reset successfully, false otherwise
 */
public boolean resetAllVariables(EnvVar... envVars) {
    DefaultTable table = new DefaultTable();
    new PushButton(OpenShiftLabel.Button.RESET_ALL).click();
    new DefaultShell(OpenShiftLabel.Shell.RESET_ENV_VAR);
    new YesButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.RESET_ENV_VAR));
    // If any of environment variables passed as argument were not reset, return false
    if (envVars != null && envVars.length > 0) {
        for (EnvVar envVar : envVars) {
            if (!(table.containsItem(envVar.getName(), 0) && (table.containsItem(envVar.getValue(), 1)))) {
                return false;
            }
        }
    }
    return true;
}
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 68 with PushButton

use of org.eclipse.reddeer.swt.impl.button.PushButton 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 69 with PushButton

use of org.eclipse.reddeer.swt.impl.button.PushButton 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 70 with PushButton

use of org.eclipse.reddeer.swt.impl.button.PushButton in project jbosstools-openshift by jbosstools.

the class DeleteResourcesWizard method deleteResourceByName.

public void deleteResourceByName(String resourceName) {
    getResourceByName(resourceName).get(0).select();
    new WaitUntil(new ControlIsEnabled(new PushButton(OpenShiftLabel.Button.DELETE)));
    delete();
}
Also used : ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Aggregations

PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)94 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)49 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)43 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)41 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)38 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)38 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)34 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)28 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)20 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)17 Test (org.junit.Test)16 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)15 RadioButton (org.eclipse.reddeer.swt.impl.button.RadioButton)9 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)8 YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)7 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)6 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)6 Button (org.eclipse.reddeer.swt.api.Button)6 CheckBox (org.eclipse.reddeer.swt.impl.button.CheckBox)6 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)6