Search in sources :

Example 11 with DefaultTree

use of org.eclipse.reddeer.swt.impl.tree.DefaultTree 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 12 with DefaultTree

use of org.eclipse.reddeer.swt.impl.tree.DefaultTree in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method getSuspendedThreadTreeItem.

private TreeItem getSuspendedThreadTreeItem(LaunchView debugView) {
    // get top item
    debugView.activate();
    DefaultTree parent = new DefaultTree();
    TreeItem remoteDebuggerTreeItem = parent.getItems().stream().filter(containsStringPredicate("Remote debugger")).findFirst().get();
    List<TreeItem> items = remoteDebuggerTreeItem.getItems();
    TreeItem openJDKTreeItem = items.get(0);
    // this could (and will) change when run with another JDK - need
    // investigation
    assertTrue(openJDKTreeItem.getText().contains("OpenJDK"));
    // wait until we can see the suspended thread
    SuspendedTreeItemIsReady suspendedTreeItemIsReady = new SuspendedTreeItemIsReady(openJDKTreeItem);
    new WaitUntil(suspendedTreeItemIsReady, TimePeriod.VERY_LONG);
    return suspendedTreeItemIsReady.getSuspendedTreeItem();
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) SuspendedTreeItemIsReady(org.jboss.tools.openshift.ui.bot.test.application.v3.adapter.condition.SuspendedTreeItemIsReady) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 13 with DefaultTree

use of org.eclipse.reddeer.swt.impl.tree.DefaultTree in project jbosstools-openshift by jbosstools.

the class TemplatesCreator method selectServerTemplate.

private void selectServerTemplate(String templateName) {
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    new WaitUntil(new TreeIsAvailable());
    new DefaultTree().selectItems(new DefaultTreeItem(templateName));
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeIsAvailable(org.jboss.tools.openshift.reddeer.condition.TreeIsAvailable) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultTabItem(org.eclipse.reddeer.swt.impl.tab.DefaultTabItem) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 14 with DefaultTree

use of org.eclipse.reddeer.swt.impl.tree.DefaultTree in project jbosstools-openshift by jbosstools.

the class NewApplicationWizardHandlingTest method testAccessibilityOfDefinedResourcesButton.

@Test(expected = OpenshiftTestInFailureException.class)
public void testAccessibilityOfDefinedResourcesButton() {
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    assertDefinedResourcesButtonIsNotPresent();
    new DefaultTabItem(OpenShiftLabel.TextLabels.CUSTOM_TEMPLATE).activate();
    assertDefinedResourcesButtonIsNotPresent();
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    OpenShiftUtils.selectEAPTemplate();
    assertTrue("Defines Resources button should be enabled if a server template is selected.", new PushButton(OpenShiftLabel.Button.DEFINED_RESOURCES).isEnabled());
    new DefaultTabItem(OpenShiftLabel.TextLabels.CUSTOM_TEMPLATE).activate();
    assertDefinedResourcesButtonIsNotPresent();
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    new DefaultTree().unselectAllItems();
    new DefaultTabItem(OpenShiftLabel.TextLabels.CUSTOM_TEMPLATE).activate();
    Display.syncExec(new Runnable() {

        @Override
        public void run() {
            new DefaultText(1).getSWTWidget().setText(DatastoreOS3.TEMPLATE_PATH);
        }
    });
    try {
        assertTrue("Defines Resources button should be enabled if a local template is selected.", new PushButton(OpenShiftLabel.Button.DEFINED_RESOURCES).isEnabled());
    } catch (CoreLayerException ex) {
        throw new OpenshiftTestInFailureException("Defined resources button was not found. Probable cause: JBIDE-24492", ex);
    }
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    assertDefinedResourcesButtonIsNotPresent();
}
Also used : DefaultText(org.eclipse.reddeer.swt.impl.text.DefaultText) OpenshiftTestInFailureException(org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) DefaultTabItem(org.eclipse.reddeer.swt.impl.tab.DefaultTabItem) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) Test(org.junit.Test)

Example 15 with DefaultTree

use of org.eclipse.reddeer.swt.impl.tree.DefaultTree in project jbosstools-openshift by jbosstools.

the class NewApplicationWizardHandlingTest method verifyDefinedResourcesForTemplate.

private void verifyDefinedResourcesForTemplate() {
    try {
        new WaitUntil(new ControlIsEnabled(new PushButton(OpenShiftLabel.Button.DEFINED_RESOURCES)), TimePeriod.DEFAULT);
    } catch (WaitTimeoutExpiredException ex) {
        fail("Defined Resources button is not enabled");
    } catch (CoreLayerException ex) {
        // Defined resources button was not found
        throw new OpenshiftTestInFailureException("Defined resources button was not found. Probable cause: JBIDE-24492", ex);
    }
    new PushButton(OpenShiftLabel.Button.DEFINED_RESOURCES).click();
    new DefaultShell(OpenShiftLabel.Shell.TEMPLATE_DETAILS);
    List<TreeItem> items = new DefaultTree().getItems();
    assertTrue("There should be build config item in tree describing resources", items.get(0).getText().contains("BuildConfig"));
    assertTrue("There should be deployment config item in tree describing resources", items.get(1).getText().contains("DeploymentConfig"));
    assertTrue("There should be image stream item in tree describing resources", items.get(2).getText().contains("ImageStream"));
    assertTrue("There should be route item in tree describing resources", items.get(3).getText().contains("Route"));
    assertTrue("There should be service item in tree describing resources", items.get(4).getText().contains("Service"));
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.TEMPLATE_DETAILS), TimePeriod.DEFAULT);
}
Also used : OpenshiftTestInFailureException(org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Aggregations

DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)22 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)9 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)9 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)8 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)7 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)7 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)7 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)6 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)5 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)5 Test (org.junit.Test)5 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)3 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)3 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)3 TreeHasChildren (org.eclipse.reddeer.swt.condition.TreeHasChildren)3 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)3 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)3 DefaultTabItem (org.eclipse.reddeer.swt.impl.tab.DefaultTabItem)3 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)2 Shell (org.eclipse.reddeer.swt.api.Shell)2