Search in sources :

Example 1 with BrowserContainsText

use of org.jboss.tools.openshift.reddeer.condition.BrowserContainsText in project jbosstools-openshift by jbosstools.

the class PublishChangesTest method verifyChangesTookEffect.

private void verifyChangesTookEffect() {
    new ServerAdapter(Version.OPENSHIFT3, "eap-app", "Service").select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.SHOW_IN_WEB_BROWSER).select();
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    try {
        new WaitUntil(new BrowserContainsText("Hello"), TimePeriod.VERY_LONG);
    } catch (WaitTimeoutExpiredException ex) {
        fail("Application was not deployed successfully because it is not shown in web browser properly.");
    }
}
Also used : ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) BrowserContainsText(org.jboss.tools.openshift.reddeer.condition.BrowserContainsText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 2 with BrowserContainsText

use of org.jboss.tools.openshift.reddeer.condition.BrowserContainsText 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 3 with BrowserContainsText

use of org.jboss.tools.openshift.reddeer.condition.BrowserContainsText in project jbosstools-openshift by jbosstools.

the class DeployDockerImageTest method verifyDeployedHelloWorldDockerImage.

/**
 * Verifies whether an application pod has been created and application is running successfully.
 */
private void verifyDeployedHelloWorldDockerImage(String projectName) {
    new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).refresh();
    try {
        new WaitUntil(new OpenShiftResourceExists(Resource.POD, new StringContains("hello-openshift"), ResourceState.RUNNING, projectName, openshiftConnectionRequirement.getConnection()), TimePeriod.VERY_LONG);
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be a running application pod for a deployed docker image, " + "but it does not exist.");
    }
    new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).refresh();
    new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).getProject(projectName).getOpenShiftResources(Resource.ROUTE).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.SHOW_IN_BROWSER).select();
    try {
        // getRouteURL("hello-openshift", projectName),
        new WaitUntil(new BrowserContainsText("Hello OpenShift!"), TimePeriod.VERY_LONG);
    } catch (WaitTimeoutExpiredException ex) {
        fail("Browser does not contain hello world content.");
    }
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) BrowserContainsText(org.jboss.tools.openshift.reddeer.condition.BrowserContainsText) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) StringContains(org.hamcrest.core.StringContains)

Example 4 with BrowserContainsText

use of org.jboss.tools.openshift.reddeer.condition.BrowserContainsText in project jbosstools-openshift by jbosstools.

the class GetOpenShiftIOTokenTest method testGetToken.

@Test
public void testGetToken() {
    new DefaultToolItem(new WorkbenchShell(), "Connect to OpenShift.io").click();
    DefaultShell browser = new DefaultShell();
    InternalBrowser internalBrowser = new InternalBrowser(browser);
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    new WaitUntil(new BrowserContainsText("OpenShift.io Developer Preview"), TimePeriod.LONG);
    internalBrowser.execute(String.format("document.getElementById(\"username\").value=\"%s\"", DatastoreOS3.OPENSHIFT_IO_USERNAME));
    internalBrowser.execute(String.format("document.getElementById(\"password\").value=\"%s\"", DatastoreOS3.OPENSHIFT_IO_PASSWORD));
    internalBrowser.execute("document.getElementById(\"password\").parentElement.parentElement.parentElement.submit()");
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    try {
        new DefaultShell("OpenShift.io");
    } catch (CoreLayerException ex) {
        // Secure storage has been triggered
        SecureStorage.handleSecureStoragePasswordAndHint(SystemProperties.SECURE_STORAGE_PASSWORD);
        new DefaultShell("OpenShift.io");
    }
    new OkButton().click();
    checkAccountInProperties();
    checkPluginInSecureStorage();
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) InternalBrowser(org.eclipse.reddeer.swt.impl.browser.InternalBrowser) DefaultToolItem(org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem) BrowserContainsText(org.jboss.tools.openshift.reddeer.condition.BrowserContainsText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Aggregations

WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)4 BrowserContainsText (org.jboss.tools.openshift.reddeer.condition.BrowserContainsText)4 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)3 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)3 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)2 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)2 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)2 Test (org.junit.Test)2 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 BrowserEditor (org.eclipse.reddeer.eclipse.ui.browser.BrowserEditor)1 InternalBrowser (org.eclipse.reddeer.swt.impl.browser.InternalBrowser)1 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)1 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)1 DefaultToolItem (org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem)1 WorkbenchShell (org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell)1 StringContains (org.hamcrest.core.StringContains)1 AmountOfResourcesExists (org.jboss.tools.openshift.reddeer.condition.AmountOfResourcesExists)1 ServerAdapter (org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter)1