Search in sources :

Example 21 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem 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 22 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method setNewVariableValue.

// TODO this should be replaced once
// https://github.com/jboss-reddeer/reddeer/issues/1668 is fixed.
private void setNewVariableValue(String newValue, final String... variablePath) {
    new WaitWhile(new JobIsRunning());
    LaunchView debugView = new LaunchView();
    debugView.open();
    ensureCorrectFrameIsSelected(debugView);
    VariablesView variablesView = new VariablesView();
    variablesView.open();
    new WaitUntil(new AbstractWaitCondition() {

        @Override
        public boolean test() {
            try {
                TreeItem variable = new DefaultTreeItem(variablePath);
                variable.select();
                return variable.isSelected();
            } catch (Exception e) {
                return false;
            }
        }

        @Override
        public String description() {
            return "Variable is not selected";
        }
    }, TimePeriod.LONG);
    try {
        new ContextMenuItem("Change Value...").select();
    } catch (CoreLayerException e) {
        throw e;
    }
    new DefaultShell("Change Object Value");
    new DefaultStyledText().setText(newValue);
    new OkButton().click();
    new WaitWhile(new JobIsRunning());
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException) IOException(java.io.IOException) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) LaunchView(org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractWaitCondition(org.eclipse.reddeer.common.condition.AbstractWaitCondition) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) VariablesView(org.eclipse.reddeer.eclipse.debug.ui.views.variables.VariablesView)

Example 23 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.

the class NodeJSAppDebugTest method testVariablesAvailableInView.

@Test
public void testVariablesAvailableInView() throws CoreException, IOException {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    pe.getProject(OpenShiftResources.NODEJS_GIT_NAME).getProjectItem("server.js").open();
    new WaitUntil(new EditorWithTitleIsActive("server.js"));
    TextEditor editor = new TextEditor("server.js");
    setLineBreakpoint(editor, BREAKPOINT_LINE);
    triggerDebugSession();
    // test couple of js variables
    TreeItem var_db = getVariable(VAR_db);
    TreeItem var_initDb = getVariable(VAR_initDb);
    TreeItem var_require = getVariable(VAR_require);
    assertTrue("Variable '" + VAR_db + "' not found in view!", var_db != null);
    assertThat(var_db.getCell(0), is(VAR_db));
    assertThat(var_db.getCell(1), containsString(VAR_VALUE_db));
    assertTrue("Variable '" + VAR_initDb + "' not found in view!", var_initDb != null);
    assertThat(var_initDb.getCell(0), is(VAR_initDb));
    assertThat(var_initDb.getCell(1), containsString(VAR_VALUE_initDb));
    assertTrue("Variable '" + VAR_require + "' not found in view!", var_require != null);
    assertThat(var_require.getCell(0), is(VAR_require));
    assertThat(var_require.getCell(1), containsString(VAR_VALUE_require));
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) EditorWithTitleIsActive(org.eclipse.reddeer.workbench.condition.EditorWithTitleIsActive) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 24 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem 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)

Example 25 with TreeItem

use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.

the class ProjectPropertiesTest method getCurrentAnnotationProperties.

private List<TreeItem> getCurrentAnnotationProperties() {
    try {
        PropertySheetProperty annotationPropertiesRoot = propertiesView.getProperty("Annotations");
        List<TreeItem> annotationProperties = annotationPropertiesRoot.getTreeItem().getItems();
        assertTrue("There should be some annotation properties in the tab", annotationProperties != null && annotationProperties.size() > 0);
        return annotationProperties;
    } catch (CoreLayerException e) {
        fail(e.getMessage());
        return null;
    }
}
Also used : TreeItem(org.eclipse.reddeer.swt.api.TreeItem) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) PropertySheetProperty(org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheetProperty)

Aggregations

TreeItem (org.eclipse.reddeer.swt.api.TreeItem)27 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)10 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)9 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)9 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)8 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)7 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)7 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)6 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)6 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)6 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)5 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)5 ArrayList (java.util.ArrayList)4 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)4 Shell (org.eclipse.reddeer.swt.api.Shell)4 Test (org.junit.Test)4 LaunchView (org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView)3 CaptureScreenshotException (org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)3 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)3 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)3