Search in sources :

Example 51 with WaitWhile

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

the class OpenShiftUtils method deleteAllProjects.

public static void deleteAllProjects(Connection connection) {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.getOpenShift3Connection(connection).refresh();
    new WaitWhile(new JobIsRunning());
    List<OpenShiftProject> projects = explorer.getOpenShift3Connection(connection).getAllProjects();
    for (OpenShiftProject project : projects) {
        if (project != null) {
            String projectName = project.getName();
            try {
                project.delete();
                new WaitWhile(new OpenShiftProjectExists(projectName, connection), TimePeriod.LONG);
            } catch (CoreLayerException ex) {
                // project does not exist - project has been deleted but view has not been
                // refreshed
                explorer.getOpenShift3Connection(connection).refresh();
            }
        }
    }
}
Also used : OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 52 with WaitWhile

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

the class OpenShiftUtils method updateMavenProject.

public static void updateMavenProject(String projectName) {
    new ProjectExplorer().getProject(projectName);
    new ContextMenuItem("Maven", "Update Project...").select();
    new DefaultShell("Update Maven Project");
    new PushButton("Select All").click();
    new PushButton("OK").click();
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 53 with WaitWhile

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

the class ConnectionWizardHandlingTest method testLinkToRetrieveToken.

@Test
@Ignore("Link has been changed to Styled text. Test need to be corrected")
public void testLinkToRetrieveToken() {
    new LabeledCombo(OpenShiftLabel.TextLabels.SERVER_TYPE).setSelection(OpenShiftLabel.Others.OPENSHIFT3);
    new LabeledCombo(OpenShiftLabel.TextLabels.PROTOCOL).setSelection(AuthenticationMethod.OAUTH.toString());
    try {
        new DefaultStyledText("Enter a token or retrieve a new one.");
    // pass
    } catch (RedDeerException ex) {
        fail("Link to retrieve token for a connection is not available.");
    }
    new LabeledCombo(OpenShiftLabel.TextLabels.SERVER).setText("https://nonexisting.server.com");
    WidgetHandler.getInstance().sendClickNotifications(new DefaultStyledText("Enter a token or retrieve a new one.").getSWTWidget());
    // There can be problem occured dialog, or it is only in log
    try {
        new DefaultShell("Problem Occurred");
        new OkButton().click();
        new WaitWhile(new ShellIsAvailable("Problem Occurred"));
        new DefaultShell("");
    // pass
    } catch (RedDeerException ex) {
    // pass
    }
    try {
        new InternalBrowser();
        fail("Browser with token should not opened for nonexisting server.");
    } catch (RedDeerException ex) {
    // pass
    }
    new LabeledCombo(OpenShiftLabel.TextLabels.SERVER).setText(DatastoreOS3.SERVER);
    WidgetHandler.getInstance().sendClickNotifications(new DefaultStyledText("Enter a token or retrieve a new one.").getSWTWidget());
    try {
        new ShellWithButton("", "Close");
        new PushButton("Close").click();
        AbstractWait.sleep(TimePeriod.SHORT);
    } catch (RedDeerException ex) {
        fail("Browser with token was not opened.");
    }
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) ShellWithButton(org.jboss.tools.openshift.reddeer.widget.ShellWithButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) InternalBrowser(org.eclipse.reddeer.swt.impl.browser.InternalBrowser) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Ignore(org.junit.Ignore) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 54 with WaitWhile

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

the class ConnectionWizardHandlingTest method closeNewConnectionShell.

@After
public void closeNewConnectionShell() {
    new CancelButton().click();
    new WaitWhile(new ShellIsAvailable(""));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) After(org.junit.After)

Example 55 with WaitWhile

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

the class OpenShiftProjectRequirement method cleanUp.

@Override
public void cleanUp() {
    if (projectSpec.cleanup()) {
        Connection connection = ConnectionUtils.getConnectionOrDefault(projectSpec.connectionURL());
        connection.deleteResource(project);
        new WaitWhile(new OpenShiftProjectExists(project.getName(), connection));
    }
}
Also used : OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) Connection(org.jboss.tools.openshift.core.connection.Connection)

Aggregations

WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)209 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)142 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)97 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)84 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)72 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)49 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)45 Test (org.junit.Test)42 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)36 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)36 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)31 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)30 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)24 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)22 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)19 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)19 Shell (org.eclipse.reddeer.swt.api.Shell)17 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)17 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)16 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)16