Search in sources :

Example 81 with PushButton

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

the class CreateNewConnectionTest method invalidRegistryURLShouldReportErrorMessage.

@Test
@RunIf(conditionClass = ConnectionCredentialsExists.class)
public void invalidRegistryURLShouldReportErrorMessage() {
    openConnectionWizardAndSetDefaultServer();
    new LabeledCombo(OpenShiftLabel.TextLabels.PROTOCOL).setSelection(AuthenticationMethod.BASIC.toString());
    new LabeledText(OpenShiftLabel.TextLabels.USERNAME).setText(DatastoreOS3.USERNAME);
    new LabeledText(OpenShiftLabel.TextLabels.PASSWORD).setText(DatastoreOS3.PASSWORD);
    new PushButton(OpenShiftLabel.Button.ADVANCED_OPEN).click();
    new LabeledText(OpenShiftLabel.TextLabels.IMAGE_REGISTRY_URL).setText("invalidURL");
    new WaitUntil(new ControlIsEnabled(new CancelButton()), TimePeriod.DEFAULT);
    new WaitUntil(new ControlIsEnabled(new DefaultText(" Please provide a valid image registry (HTTP/S) URL.")), TimePeriod.DEFAULT);
    new CancelButton().click();
}
Also used : DefaultText(org.eclipse.reddeer.swt.impl.text.DefaultText) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) RunIf(org.eclipse.reddeer.junit.execution.annotation.RunIf) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 82 with PushButton

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

the class OpenShift3SSLCertificatePreferencePage method deleteAll.

public void deleteAll() {
    log.info("Deleting all accepted Untrusted SSL Certificates used by Opneshift 3 tooling");
    DefaultTable table = new DefaultTable();
    List<TableItem> tableItems = table.getItems();
    if (tableItems.isEmpty()) {
        return;
    }
    for (TableItem item : tableItems) {
        item.select();
        new PushButton("Delete").click();
    }
}
Also used : TableItem(org.eclipse.reddeer.swt.api.TableItem) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 83 with PushButton

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

the class ShellWithButton method lookForShellWithButton.

private static org.eclipse.swt.widgets.Shell lookForShellWithButton(final String title, final String buttonLabel) {
    Matcher<String> titleMatcher = new WithTextMatcher(title);
    Matcher<String> buttonMatcher = new BaseMatcher<String>() {

        @Override
        public boolean matches(Object obj) {
            if (obj instanceof Control) {
                final Control control = (Control) obj;
                ReferencedComposite ref = new ReferencedComposite() {

                    @Override
                    public Control getControl() {
                        return control;
                    }
                };
                try {
                    new PushButton(ref, buttonLabel);
                    return true;
                } catch (CoreLayerException e) {
                // ok, this control doesn't contain the button
                }
            }
            return false;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("containing button '" + buttonLabel + "'");
        }
    };
    @SuppressWarnings("unchecked") Matcher<String> matcher = new AndMatcher(titleMatcher, buttonMatcher);
    return ShellLookup.getInstance().getShell(matcher);
}
Also used : AndMatcher(org.eclipse.reddeer.common.matcher.AndMatcher) Control(org.eclipse.swt.widgets.Control) Description(org.hamcrest.Description) BaseMatcher(org.hamcrest.BaseMatcher) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) ReferencedComposite(org.eclipse.reddeer.core.reference.ReferencedComposite)

Example 84 with PushButton

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

the class OpenShiftExplorerView method connectToOpenShift.

public void connectToOpenShift(String server, String username, String password, boolean storePassword, boolean useDefaultServer, AuthenticationMethod authMethod, boolean certificateShown) {
    new DefaultShell(OpenShiftLabel.Shell.NEW_CONNECTION);
    if (new CheckBox(0).isChecked() != useDefaultServer) {
        new CheckBox(0).click();
    }
    if (!useDefaultServer) {
        new LabeledCombo(OpenShiftLabel.TextLabels.SERVER).setText(server);
    }
    new LabeledCombo(OpenShiftLabel.TextLabels.PROTOCOL).setSelection(authMethod.toString());
    if (AuthenticationMethod.OAUTH.equals(authMethod)) {
        new LabeledText(OpenShiftLabel.TextLabels.TOKEN).setText(password);
    }
    if (AuthenticationMethod.BASIC.equals(authMethod)) {
        new LabeledText(OpenShiftLabel.TextLabels.USERNAME).setText(username);
        new LabeledText(OpenShiftLabel.TextLabels.PASSWORD).setText(password);
        if (new CheckBox(OpenShiftLabel.TextLabels.STORE_PASSWORD).isChecked() != storePassword) {
            new CheckBox(OpenShiftLabel.TextLabels.STORE_PASSWORD).click();
        }
    }
    new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.DEFAULT);
    new FinishButton().click();
    if (certificateShown) {
        try {
            new DefaultShell(OpenShiftLabel.Shell.UNTRUSTED_SSL_CERTIFICATE);
            new PushButton("Yes").click();
        } catch (RedDeerException ex) {
            fail("Aceptance of SSL certificate failed.");
        }
    }
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_CONNECTION), TimePeriod.LONG);
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 85 with PushButton

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

the class TestUtils method setVisualEditorToUseHTML5.

public static void setVisualEditorToUseHTML5() {
    WorkbenchPreferenceDialog dialog = new WorkbenchPreferenceDialog();
    dialog.open();
    dialog.select("JBoss Tools", "Web", "Editors", "Visual Page Editor");
    RadioButton button = new RadioButton("HTML5 (use WebKit)");
    if (button.isEnabled() && !button.isSelected()) {
        button.click();
    }
    CheckBox checkBox = new CheckBox("Do not show Browser Engine dialog");
    if (checkBox.isEnabled() && !checkBox.isChecked()) {
        checkBox.click();
    }
    new PushButton("Apply").click();
    dialog.ok();
}
Also used : WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) RadioButton(org.eclipse.reddeer.swt.impl.button.RadioButton) 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