Search in sources :

Example 6 with DefaultTree

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

the class NewApplicationWizardHandlingTest method testTemplatesRelatedWidgetAccess.

@Test
public void testTemplatesRelatedWidgetAccess() {
    assertTrue("Server template selection should be chosen by default.", new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).isSelected());
    new DefaultTabItem(OpenShiftLabel.TextLabels.CUSTOM_TEMPLATE).activate();
    try {
        new DefaultTree();
        fail("Tree with server templates should not be visible if local template " + "tab item is selected.");
    } catch (RedDeerException ex) {
    // pass
    }
    assertTrue("Browse button should be visible and enabled while local template " + "tab item is selected.", new PushButton(OpenShiftLabel.Button.BROWSE).isEnabled());
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    assertTrue("Tree with server templates should be visible and enabled if server template " + "tab item is selected.", new DefaultTree().isEnabled());
    try {
        new PushButton(1, new WithTextMatcher(OpenShiftLabel.Button.BROWSE));
        fail("Browse button should not be visible while server template tab item is selected.");
    } catch (RedDeerException ex) {
    // pass
    }
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) DefaultTabItem(org.eclipse.reddeer.swt.impl.tab.DefaultTabItem) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Test(org.junit.Test)

Example 7 with DefaultTree

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

the class OpenShiftExplorerView method getConnectionItem.

private TreeItem getConnectionItem(String server, String username) {
    open();
    if (username == null) {
        username = TreeViewerHandler.getInstance().getNonStyledText(new DefaultTree().getItems().get(0));
    }
    TreeItem connectionItem = treeViewerHandler.getTreeItem(new DefaultTree(), username);
    if (server != null && DatastoreOS3.AUTH_METHOD.equals(AuthenticationMethod.OAUTH)) {
        if (treeViewerHandler.getStyledTexts(connectionItem)[0].equals(server)) {
            return connectionItem;
        } else {
            throw new OpenShiftToolsException("There is no connection with specified server " + server + " and username " + username);
        }
    } else {
        return connectionItem;
    }
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException)

Example 8 with DefaultTree

use of org.eclipse.reddeer.swt.impl.tree.DefaultTree in project linuxtools by eclipse.

the class DockerExplorerView method getDockerConnectionNames.

/**
 * Gets names of all docker connections present in docker explorer.
 *
 * @return list of docker connections names
 */
public List<String> getDockerConnectionNames() {
    activate();
    List<String> connectionsNames = new ArrayList<String>();
    try {
        List<TreeItem> connections = new DefaultTree().getItems();
        for (TreeItem item : connections) {
            connectionsNames.add(getName(item));
        }
    } catch (CoreLayerException ex) {
    // no connections in view
    }
    return connectionsNames;
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) ArrayList(java.util.ArrayList) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 9 with DefaultTree

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

the class HandleCustomTemplateTest method createTemplateFromJson.

private void createTemplateFromJson() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject().select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_RESOURCE).select();
    new DefaultShell(OpenShiftLabel.Shell.NEW_RESOURCE);
    new LabeledText(OpenShiftLabel.TextLabels.RESOURCE_LOCATION).setText(System.getProperty("user.dir") + File.separator + "resources" + File.separator + "hello-world-template.json");
    new FinishButton().click();
    new DefaultShell(OpenShiftLabel.Shell.CREATE_RESOURCE_SUMMARY);
    assertTrue("Template is not listed in created resources summary", new DefaultTree().getAllItems().size() == 1);
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_RESOURCE));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    List<OpenShiftResource> templates = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject().getOpenShiftResources(Resource.TEMPLATE);
    assertTrue("There should be precisely 1 created template for the project.", templates.size() > 0);
    String templateName = templates.get(0).getName();
    assertTrue("Template name '" + templateName + "' does not match required name " + "helloworld-sample.", templateName.equals("helloworld-sample"));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)

Example 10 with DefaultTree

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

the class ImportApplicationTest method testImportOpenShiftApplicationViaShellMenu.

@Test
public void testImportOpenShiftApplicationViaShellMenu() {
    new ShellMenuItem("File", "Import...").select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.IMPORT);
    new DefaultTreeItem("OpenShift", "Existing OpenShift Application").select();
    new NextButton().click();
    new DefaultShell(OpenShiftLabel.Shell.IMPORT_APPLICATION);
    TestUtils.acceptSSLCertificate();
    new NextButton().click();
    TestUtils.acceptSSLCertificate();
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    new WaitUntil(new ButtonWithTextIsAvailable("Refresh"), TimePeriod.VERY_LONG);
    new WaitUntil(new TreeHasChildren(new DefaultTree()), TimePeriod.DEFAULT);
    new DefaultTreeItem(projectReq.getProjectName() + " " + projectReq.getProjectName()).getItems().get(0).select();
    new WaitUntil(new ControlIsEnabled(new NextButton()), TimePeriod.DEFAULT);
    new NextButton().click();
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION), TimePeriod.VERY_LONG);
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
    ProjectExplorer projectExplorer = new ProjectExplorer();
    projectExplorer.open();
    assertTrue("There should be imported " + PROJECT_NAME + "project, but there is not", projectExplorer.containsProject(PROJECT_NAME));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) TreeHasChildren(org.eclipse.reddeer.swt.condition.TreeHasChildren) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) ShellMenuItem(org.eclipse.reddeer.swt.impl.menu.ShellMenuItem) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) ButtonWithTextIsAvailable(org.jboss.tools.openshift.reddeer.condition.ButtonWithTextIsAvailable) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

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