Search in sources :

Example 96 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-openshift by jbosstools.

the class CDKWrongCredentialsTest method closeAllErrorDialogs.

private void closeAllErrorDialogs() {
    try {
        new DefaultShell("Problem Occurred");
        new OkButton().click();
    } catch (CoreLayerException exc) {
        log.info("Problem Occurred dialog was not present");
    }
    try {
        new DefaultShell("Multiple problems have occurred");
        new OkButton().click();
    } catch (CoreLayerException exc) {
        log.info("Multiple problems have occurred dialog was not present");
    }
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 97 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-openshift by jbosstools.

the class CDKImageRegistryUrlDiscoveryFailureTest method testRegistryUrlNotFoundDialog.

/**
 * Covers JBIDE-25049
 */
@Test
public void testRegistryUrlNotFoundDialog() {
    String shellTitle = OpenShiftLabel.Shell.REGISTRY_URL_NOT_FOUND;
    wizard.getImageRegistryUrl().setText("");
    wizard.finish();
    stopServerAdapter();
    wizard = connection.editConnection();
    switchOffPasswordSaving();
    try {
        wizard.discover();
        fail("Expected OpenshiftToolsException was not thrown, possibly no dialog is shown.");
    } catch (OpenShiftToolsException osExc) {
        // os exception was thrown with specific message
        assertTrue("Registry URL not found dialog did not appear.", osExc.getMessage().contains(shellTitle));
        // error dialog is still there
        new WaitUntil(new ShellIsAvailable(shellTitle), TimePeriod.SHORT);
        new DefaultShell(shellTitle);
        new OkButton().click();
    }
    wizard.cancel();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) Test(org.junit.Test)

Example 98 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-openshift by jbosstools.

the class CDKServerAdapterAbstractTest method testOpenshiftConnection.

/**
 * Tests Openshift 3 connection and try to refresh it
 *
 * @param connection
 */
public void testOpenshiftConnection(String server, String username) {
    OpenShift3Connection connection = null;
    try {
        connection = findOpenShiftConnection(server, username);
    } catch (OpenShiftToolsException toolsExc) {
        fail(toolsExc.getMessage());
    }
    // usually, when server adapter is not started, openshift connection after refresh should cause
    // problem occurred dialog
    connection.refresh();
    try {
        // $NON-NLS-1$
        new WaitUntil(new ShellIsAvailable("Problem occurred"), TimePeriod.getCustom(30));
        CDKUtils.captureScreenshot("CDKServerAdapterAbstractTest#testOpenshiftConnection");
        new DefaultShell("Problem occurred").close();
        // $NON-NLS-1$
        fail("Problem dialog occured when refreshing OpenShift connection");
    } catch (WaitTimeoutExpiredException ex) {
        // no dialog appeared, which is ok
        // $NON-NLS-1$
        log.info("Expected WaitTimeoutExpiredException occured");
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)

Example 99 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell 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 100 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell 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)

Aggregations

DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)129 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)84 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)83 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)57 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)49 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)46 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)41 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)36 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)30 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)28 Test (org.junit.Test)27 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)25 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)18 Shell (org.eclipse.reddeer.swt.api.Shell)17 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)17 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)17 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)16 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)16 YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)16 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)16