Search in sources :

Example 71 with DefaultShell

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

Example 72 with DefaultShell

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

the class EditResourceLimitsTest method incrementLimits.

private void incrementLimits(int index, String defaultSuffix) {
    new ContextMenuItem(OpenShiftLabel.ContextMenu.EDIT_RESOURCE_LIMITS).select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.EDIT_RESOURCE_LIMITS));
    new DefaultShell(OpenShiftLabel.Shell.EDIT_RESOURCE_LIMITS).setFocus();
    Text text = new DefaultText(index);
    String value = text.getText();
    long val = 0L;
    try {
        val = Long.parseLong(value);
    } catch (NumberFormatException e) {
    }
    text.setText(Long.toString(++val));
    Combo combo = new DefaultCombo(index);
    value = combo.getSelection();
    if (StringUtils.isEmpty(value)) {
        combo.setSelection(defaultSuffix);
    }
    new WaitUntil(new ControlIsEnabled(new OkButton()));
    new OkButton().click();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) Text(org.eclipse.reddeer.swt.api.Text) DefaultText(org.eclipse.reddeer.swt.impl.text.DefaultText) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) Combo(org.eclipse.reddeer.swt.api.Combo) DefaultText(org.eclipse.reddeer.swt.impl.text.DefaultText) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 73 with DefaultShell

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

the class OSExplorerResourceTest method testDeploymentConfigVisibleAfterServiceDeletion.

/**
 * Test if deployment config is visible in OS Explorer, when there is no service.
 */
@Test(expected = OpenshiftTestInFailureException.class)
public void testDeploymentConfigVisibleAfterServiceDeletion() {
    this.project.expand();
    Service service = this.project.getService(OpenShiftResources.EAP_SERVICE);
    assertTrue("Service does not exist!", service != null);
    service.select();
    new ContextMenuItem("Delete").select();
    new DefaultShell("Delete OpenShift Resource");
    new OkButton().click();
    // assert service is deleted
    List<OpenShiftResource> resources = this.project.getOpenShiftResources(Resource.SERVICE);
    assertTrue("Service not deleted!", resources.isEmpty());
    try {
        this.project.getTreeItem().getItem("eap-app selector: deploymentConfig=eap-app");
    } catch (CoreLayerException e) {
        // TODO: do not throw after JBIDE-24217 is fixed
        throw new OpenshiftTestInFailureException("JBIDE-24217");
    // TODO: uncomment after JBIDE-24217 is fixed
    // fail("Deployment config not visible!");
    }
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) OpenshiftTestInFailureException(org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) RequiredService(org.jboss.tools.openshift.reddeer.requirement.OpenShiftServiceRequirement.RequiredService) Service(org.jboss.tools.openshift.reddeer.view.resources.Service) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 74 with DefaultShell

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

the class EditResourcesTest method testIncorrectResourceContent.

@Test
public void testIncorrectResourceContent() {
    TextEditor editor = getBuildConfigTextEditor();
    String text = editor.getText();
    if (buildConfig == null) {
        buildConfig = text;
    }
    editor.setText(text.replace("\"namespace\" : \"" + DatastoreOS3.PROJECT1 + "\"", "\"namespace\" : \"" + DatastoreOS3.PROJECT1 + "\"wtf"));
    try {
        editor.save();
    } catch (CoreLayerException ex) {
    // ok
    }
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT, false);
    assertTrue("Editor should be dirty, it should not be able to save incorrect content", editor.isDirty());
    try {
        new DefaultShell("Problem Occurred");
        new OkButton().click();
    } catch (RedDeerException ex) {
    // sometimes it occures, sometimes not
    }
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 75 with DefaultShell

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

the class PortForwardingTest method openPortForwardingDialog.

private void openPortForwardingDialog() {
    OpenShift3Connection openShift3Connection = new OpenShiftExplorerView().getOpenShift3Connection(connectionReq.getConnection());
    ApplicationPodIsRunning applicationPodIsRunning = new ApplicationPodIsRunning(openShift3Connection.getProject(projectReq.getProjectName()));
    new WaitUntil(applicationPodIsRunning, TimePeriod.LONG);
    openShift3Connection.getProject(projectReq.getProjectName()).getOpenShiftResource(Resource.POD, applicationPodIsRunning.getApplicationPodName()).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.PORT_FORWARD).select();
    new DefaultShell(OpenShiftLabel.Shell.APPLICATION_PORT_FORWARDING);
}
Also used : ApplicationPodIsRunning(org.jboss.tools.openshift.reddeer.condition.ApplicationPodIsRunning) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)

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