Search in sources :

Example 1 with WidgetIsFound

use of org.eclipse.reddeer.core.condition.WidgetIsFound in project jbosstools-openshift by jbosstools.

the class DisableSecureStorageRequirement method setSecureStorageMasterPasswords.

private void setSecureStorageMasterPasswords(boolean checked) {
    WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog();
    StoragePreferencePage storagePage = new StoragePreferencePage(preferenceDialog);
    preferenceDialog.open();
    preferenceDialog.select(storagePage);
    try {
        new WaitUntil(new WidgetIsFound(org.eclipse.swt.custom.CLabel.class, new WithMnemonicTextMatcher("Secure Storage")), TimePeriod.DEFAULT);
        log.info("Getting master password providers");
        List<PasswordProvider> items = storagePage.getMasterPasswordProviders();
        for (PasswordProvider item : items) {
            log.info("Uncheking table item: " + item.getDescription());
            item.setEnabled(checked);
        }
        new WaitUntil(new JobIsRunning(), TimePeriod.DEFAULT, false);
        storagePage.apply();
    } catch (WaitTimeoutExpiredException exc) {
        log.error("Secure Storage preferences page has timed out");
        log.error(exc.getMessage());
    } finally {
        preferenceDialog.ok();
    }
}
Also used : WithMnemonicTextMatcher(org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PasswordProvider(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.PasswordProvider) StoragePreferencePage(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage)

Example 2 with WidgetIsFound

use of org.eclipse.reddeer.core.condition.WidgetIsFound in project linuxtools by eclipse.

the class RunDockerImageLaunchConfiguration method deleteRunConfiguration.

public void deleteRunConfiguration(String configuratioName) {
    selectConfiguration(configuratioName);
    new DefaultToolItem(DELETE_LAUNCH_CONFIGURATION_LABEL).click();
    Shell deleteShell = new DefaultShell("Confirm Launch Configuration Deletion");
    WidgetIsFound deleteButton = new WidgetIsFound(org.eclipse.swt.widgets.Button.class, deleteShell.getSWTWidget(), new WithMnemonicTextMatcher("Delete"));
    Button button;
    if (deleteButton.test()) {
        // photon changed button text
        button = new PushButton(deleteShell, "Delete");
    } else {
        button = new YesButton(deleteShell);
    }
    button.click();
    new WaitWhile(new ShellIsAvailable(deleteShell));
    new WaitUntil(new ShellIsAvailable("Run Configurations"));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultToolItem(org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) WithMnemonicTextMatcher(org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton) RadioButton(org.eclipse.reddeer.swt.impl.button.RadioButton) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Button(org.eclipse.reddeer.swt.api.Button) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 3 with WidgetIsFound

use of org.eclipse.reddeer.core.condition.WidgetIsFound in project jbosstools-openshift by jbosstools.

the class CDKTestUtils method removeAccessRedHatCredentials.

// removes access redhat com credentials used for first cdk run
public static void removeAccessRedHatCredentials(String domain, String username) {
    WorkbenchPreferenceDialog dialog = new WorkbenchPreferenceDialog();
    dialog.open();
    // $NON-NLS-1$ //$NON-NLS-2$
    dialog.select("JBoss Tools", "Credentials");
    try {
        new WaitUntil(new WidgetIsFound(org.eclipse.swt.custom.CLabel.class, new WithMnemonicTextMatcher("Credentials")), // $NON-NLS-1$
        TimePeriod.MEDIUM);
        // $NON-NLS-1$
        new DefaultCLabel("Credentials");
        DefaultTree tree = new DefaultTree(1);
        TreeItem item = TreeViewerHandler.getInstance().getTreeItem(tree, new String[] { domain, username });
        item.select();
        // $NON-NLS-1$
        new PushButton(new WithTextMatcher("Remove User")).click();
        new WaitUntil(new JobIsRunning(), TimePeriod.MEDIUM, false);
    } catch (WaitTimeoutExpiredException exc) {
        // $NON-NLS-1$
        log.error("JBoss Tools - Credentials preferences page has timed out");
        exc.printStackTrace();
    } catch (JFaceLayerException exc) {
        // $NON-NLS-1$
        log.error("JBoss Tools - Credentials does not contain required username to be deleted");
        exc.printStackTrace();
    } finally {
        dialog.ok();
    }
}
Also used : DefaultCLabel(org.eclipse.reddeer.swt.impl.clabel.DefaultCLabel) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) JFaceLayerException(org.eclipse.reddeer.jface.exception.JFaceLayerException) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) DefaultCLabel(org.eclipse.reddeer.swt.impl.clabel.DefaultCLabel) WithMnemonicTextMatcher(org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 4 with WidgetIsFound

use of org.eclipse.reddeer.core.condition.WidgetIsFound in project jbosstools-openshift by jbosstools.

the class BuilderImageApplicationWizardHandlingTest method testPorts.

@Test
public void testPorts() {
    String defaultName = "8443-tcp";
    String defaultServicePort = "8443";
    String defaultPodPort = "8443";
    String newName = "1234-tcp";
    String newServicePort = "1234";
    String newPodPort = "4321";
    nextToBuildConfigurationWizardPage();
    next();
    next();
    // Test edit of an existing pod
    new DefaultTable().select(defaultName);
    new PushButton(OpenShiftLabel.Button.EDIT).click();
    new DefaultShell(OpenShiftLabel.Shell.SERVICE_PORTS);
    new LabeledText(OpenShiftLabel.TextLabels.POD_PORT).setText(newPodPort);
    new DefaultSpinner(OpenShiftLabel.TextLabels.SERVICE_PORT).setValue(Integer.valueOf(newServicePort));
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.SERVICE_PORTS));
    assertTrue("There should port mapping with name " + newName + ", but there is not.", new WidgetIsFound(org.eclipse.swt.widgets.TableItem.class, new WithTextMatcher(newName)).test());
    TableItem portMapping = new DefaultTable().getItem(newName);
    assertTrue("Modified pod mapping has incorrect mapped ports.", portMapping.getText(1).equals(newServicePort) && portMapping.getText(2).equals(newPodPort));
    // Test reset of pods
    new PushButton(OpenShiftLabel.Button.RESET).click();
    new DefaultShell(OpenShiftLabel.Shell.RESET_PORTS);
    new YesButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.RESET_PORTS));
    new WaitWhile(new JobIsRunning());
    assertTrue("There should port mapping with name " + defaultName + ", but there is not.", new WidgetIsFound(org.eclipse.swt.widgets.TableItem.class, new WithTextMatcher(defaultName)).test());
    portMapping = new DefaultTable().getItem(defaultName);
    String resetServicePort = portMapping.getText(1);
    String resetPodPort = portMapping.getText(2);
    assertTrue("There should default values for port named " + defaultName + "\n" + "Service port should be " + defaultServicePort + ", but it is " + resetServicePort + " and pod port should be " + defaultPodPort + ", but it is " + resetPodPort, resetServicePort.equals(defaultServicePort) && resetPodPort.equals(defaultPodPort));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) TableItem(org.eclipse.reddeer.swt.api.TableItem) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) DefaultSpinner(org.eclipse.reddeer.swt.impl.spinner.DefaultSpinner) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Test(org.junit.Test)

Example 5 with WidgetIsFound

use of org.eclipse.reddeer.core.condition.WidgetIsFound in project jbosstools-hibernate by jbosstools.

the class ProjectConfigurationFactory method convertProjectToFacetsForm.

/**
 * Convert project to facet form
 * @param prj given project name
 */
public static void convertProjectToFacetsForm(String prj) {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    PropertyDialog pd = pe.getProject(prj).openProperties();
    pd.select("Project Facets");
    // convert to faceted form
    new DefaultTreeItem("Project Facets").select();
    new DefaultLink("Convert to faceted form...").click();
    new WaitWhile(new JobIsRunning());
    new WaitUntil(new WidgetIsFound(Button.class, new WithStyleMatcher(SWT.PUSH), new WithMnemonicTextMatcher("Apply")), TimePeriod.LONG);
    PushButton apply = new PushButton("Apply");
    new WaitUntil(new ControlIsEnabled(apply));
    apply.click();
    pd.ok();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) WithStyleMatcher(org.eclipse.reddeer.core.matcher.WithStyleMatcher) DefaultLink(org.eclipse.reddeer.swt.impl.link.DefaultLink) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertyDialog(org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog) WithMnemonicTextMatcher(org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) Button(org.eclipse.swt.widgets.Button) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Aggregations

WidgetIsFound (org.eclipse.reddeer.core.condition.WidgetIsFound)6 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)5 WithMnemonicTextMatcher (org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher)5 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)5 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)5 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)4 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)3 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)2 Shell (org.eclipse.reddeer.swt.api.Shell)2 YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)2 WorkbenchPreferenceDialog (org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog)2 WithStyleMatcher (org.eclipse.reddeer.core.matcher.WithStyleMatcher)1 PasswordProvider (org.eclipse.reddeer.eclipse.equinox.security.ui.storage.PasswordProvider)1 StoragePreferencePage (org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage)1 PropertyDialog (org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog)1 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)1 JFaceLayerException (org.eclipse.reddeer.jface.exception.JFaceLayerException)1