Search in sources :

Example 36 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class CreateServerAdapterTest method finishNewServerAdapterWizardAndVerifyExistence.

public void finishNewServerAdapterWizardAndVerifyExistence() {
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.ADAPTER));
    boolean jobExists = false;
    try {
        new WaitUntil(new JobIsRunning(new StringContains(JOB_NAME)), TimePeriod.getCustom(5));
        jobExists = true;
    } catch (WaitTimeoutExpiredException e) {
    // job is not running, do nothing
    }
    if (jobExists) {
        new WaitUntil(new JobIsKilled(JOB_NAME), TimePeriod.VERY_LONG);
    }
    assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, "eap-app", "Service").test());
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsKilled(org.eclipse.reddeer.workbench.core.condition.JobIsKilled) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) StringContains(org.hamcrest.core.StringContains)

Example 37 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class DeploymentTest method testDeploymentOfApplicationCreatedFromTemplate.

@Test
public void testDeploymentOfApplicationCreatedFromTemplate() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.DEFAULT, false);
    try {
        new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.COMPLETE, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(600), true);
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be a successful build of an application, but there is not.");
    }
    try {
        new WaitUntil(new AmountOfResourcesExists(Resource.POD, 2, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(60), true);
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be precisely 2 pods. One of the build and one of an running application.");
    }
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.ROUTE).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.SHOW_IN_WEB_BROWSER).select();
    try {
        new WaitUntil(new BrowserContainsText("Hello World!"), TimePeriod.VERY_LONG);
        new BrowserEditor("helloworld").close();
    } catch (WaitTimeoutExpiredException ex) {
        fail("Application was not deployed successfully because it is not shown in web browser properly.\n" + ex.getMessage());
    }
}
Also used : AmountOfResourcesExists(org.jboss.tools.openshift.reddeer.condition.AmountOfResourcesExists) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) BrowserContainsText(org.jboss.tools.openshift.reddeer.condition.BrowserContainsText) BrowserEditor(org.eclipse.reddeer.eclipse.ui.browser.BrowserEditor) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 38 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method rebuildProject.

private static void rebuildProject() {
    PackageExplorerPart pexplorer = new PackageExplorerPart();
    pexplorer.open();
    pexplorer.getProject(PROJECT_NAME).select();
    new ContextMenuItem("Maven", "Update Project...").select();
    new WaitUntil(new ShellIsAvailable("Update Maven Project"), TimePeriod.LONG);
    new CheckBox("Force Update of Snapshots/Releases").toggle(true);
    new PushButton("OK").click();
    new WaitWhile(new ShellIsAvailable("Update Maven Project"), TimePeriod.DEFAULT);
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 39 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method checkNewVariableValueIsPropagatedToBrowser.

private void checkNewVariableValueIsPropagatedToBrowser() {
    clickResume();
    new WaitUntil(new AbstractWaitCondition() {

        @Override
        public boolean test() {
            return ((requestResponse != null) && requestResponse.contains("NewWorld"));
        }
    }, TimePeriod.LONG);
}
Also used : WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractWaitCondition(org.eclipse.reddeer.common.condition.AbstractWaitCondition)

Example 40 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class NodeJSAppDebugTest method getVariable.

/**
 * getVariable from Variables view.
 *
 * @param variable
 *            name
 * @return TreeItem
 */
protected TreeItem getVariable(String name) {
    WorkbenchView variables = new WorkbenchView("Variables");
    variables.activate();
    DefaultTree variablesTree = new DefaultTree();
    TreeItem var = null;
    try {
        new WaitUntil(new TreeContainsItem(variablesTree, new WithTextMatcher(name), false));
    } catch (WaitTimeoutExpiredException e) {
        // not found
        return null;
    }
    List<TreeItem> vars = variablesTree.getItems();
    for (TreeItem i : vars) {
        if (i.getText().equals(name)) {
            var = i;
        }
    }
    return var;
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) WorkbenchView(org.eclipse.reddeer.workbench.impl.view.WorkbenchView) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Aggregations

WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)178 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)74 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)73 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)63 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)59 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)54 Test (org.junit.Test)44 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)40 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)36 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)36 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)34 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)30 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)25 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)22 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)20 NextButton (org.eclipse.reddeer.swt.impl.button.NextButton)18 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)18 BackButton (org.eclipse.reddeer.swt.impl.button.BackButton)15 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)13 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)12