Search in sources :

Example 21 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException 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 22 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException 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 23 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException 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)

Example 24 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException in project jbosstools-openshift by jbosstools.

the class StoreConnectionTest method secureStorageDisabledJBIDE19604Test.

@Test
public void secureStorageDisabledJBIDE19604Test() {
    deleteSecureStorage();
    invokeNewAppWizardFromCentral();
    new CheckBox(OpenShiftLabel.TextLabels.STORE_PASSWORD).toggle(true);
    new NextButton().click();
    // Cancel secure storage shell
    try {
        new DefaultShell(OpenShiftLabel.Shell.SECURE_STORAGE_PASSWORD);
    } catch (CoreLayerException ex) {
        new DefaultShell(OpenShiftLabel.Shell.SECURE_STORAGE);
    }
    new CancelButton().click();
    // Cancel warning shell
    new DefaultShell("Warning");
    new OkButton().click();
    new CheckBox(OpenShiftLabel.TextLabels.STORE_PASSWORD).toggle(false);
    // Next button should work
    new NextButton().click();
    AbstractWaitCondition backButtonIsEnabled = new AbstractWaitCondition() {

        @Override
        public boolean test() {
            return new BackButton().isEnabled();
        }
    };
    new WaitUntil(backButtonIsEnabled);
    new CancelButton().click();
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) BackButton(org.eclipse.reddeer.swt.impl.button.BackButton) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) AbstractWaitCondition(org.eclipse.reddeer.common.condition.AbstractWaitCondition) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 25 with CoreLayerException

use of org.eclipse.reddeer.core.exception.CoreLayerException 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)

Aggregations

CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)26 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)16 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)10 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)8 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)7 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)7 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)6 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)5 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)5 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)4 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)4 Test (org.junit.Test)4 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)3 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)3 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)3 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)3 OpenshiftTestInFailureException (org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException)3 AbstractWaitCondition (org.eclipse.reddeer.common.condition.AbstractWaitCondition)2 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)2