Search in sources :

Example 1 with OpenshiftTestInFailureException

use of org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException in project jbosstools-openshift by jbosstools.

the class ImportApplicationWizardGitTest method testNotExistingBranch.

@Test(expected = OpenshiftTestInFailureException.class)
public void testNotExistingBranch() {
    Git repo = createRepo();
    setRemote(repo, getOriginURL());
    performCommit(repo);
    renameMaster(repo);
    service.select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION));
    ImportApplicationWizard importWizard = new ImportApplicationWizard();
    assertProjectExistsErrorInWizard(importWizard);
    GitCloningWizardPage gitCloningWizardPage = new GitCloningWizardPage();
    gitCloningWizardPage.useExistingRepository(true);
    try {
        assertGitRemoteErrorInWizzard(importWizard);
    } catch (AssertionError err) {
        importWizard.cancel();
        throw new OpenshiftTestInFailureException("https://issues.jboss.org/browse/JBIDE-24646", err);
    }
    importWizard.cancel();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) OpenshiftTestInFailureException(org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException) Git(org.eclipse.jgit.api.Git) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) GitCloningWizardPage(org.jboss.tools.openshift.reddeer.wizard.importapp.GitCloningWizardPage) ImportApplicationWizard(org.jboss.tools.openshift.reddeer.wizard.importapp.ImportApplicationWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) Test(org.junit.Test)

Example 2 with OpenshiftTestInFailureException

use of org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException 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 3 with OpenshiftTestInFailureException

use of org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException in project jbosstools-openshift by jbosstools.

the class CreateApplicationOnBuilderImageTest method validateJBIDE22704.

private void validateJBIDE22704() {
    BuilderImageApplicationWizardHandlingTest.nextToBuildConfigurationWizardPage();
    applicationName = new LabeledText("Name: ").getText();
    assertNotNull(applicationName);
    assertTrue(applicationName.length() > 0);
    String gitUrl = new LabeledText("Git Repository URL:").getText();
    assertNotNull(gitUrl);
    if (gitUrl.length() < 1) {
        new CancelButton().click();
        new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_APP_WIZARD));
        throw new OpenshiftTestInFailureException("JBIDE-23704 should be fixed now.");
    }
    new WaitUntil(new ControlIsEnabled(new NextButton()));
    /*
		 * switch to the Deployment page
		 */
    new NextButton().click();
    new WaitUntil(new ControlIsEnabled(new BackButton()));
    int numberofEnvironmentVariables = new DefaultTable().rowCount();
    assertTrue(numberofEnvironmentVariables > 0);
    /*
		 * switch to the Routing page
		 */
    new NextButton().click();
    new WaitUntil(new ControlIsEnabled(new BackButton()));
    int numberOfServicePorts = new DefaultTable().rowCount();
    assertTrue(numberOfServicePorts > 0);
    new CancelButton().click();
    new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(120));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) OpenshiftTestInFailureException(org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) BackButton(org.eclipse.reddeer.swt.impl.button.BackButton) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 4 with OpenshiftTestInFailureException

use of org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException in project jbosstools-openshift by jbosstools.

the class NewApplicationWizardHandlingTest method testAccessibilityOfDefinedResourcesButton.

@Test(expected = OpenshiftTestInFailureException.class)
public void testAccessibilityOfDefinedResourcesButton() {
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    assertDefinedResourcesButtonIsNotPresent();
    new DefaultTabItem(OpenShiftLabel.TextLabels.CUSTOM_TEMPLATE).activate();
    assertDefinedResourcesButtonIsNotPresent();
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    OpenShiftUtils.selectEAPTemplate();
    assertTrue("Defines Resources button should be enabled if a server template is selected.", new PushButton(OpenShiftLabel.Button.DEFINED_RESOURCES).isEnabled());
    new DefaultTabItem(OpenShiftLabel.TextLabels.CUSTOM_TEMPLATE).activate();
    assertDefinedResourcesButtonIsNotPresent();
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    new DefaultTree().unselectAllItems();
    new DefaultTabItem(OpenShiftLabel.TextLabels.CUSTOM_TEMPLATE).activate();
    Display.syncExec(new Runnable() {

        @Override
        public void run() {
            new DefaultText(1).getSWTWidget().setText(DatastoreOS3.TEMPLATE_PATH);
        }
    });
    try {
        assertTrue("Defines Resources button should be enabled if a local template is selected.", new PushButton(OpenShiftLabel.Button.DEFINED_RESOURCES).isEnabled());
    } catch (CoreLayerException ex) {
        throw new OpenshiftTestInFailureException("Defined resources button was not found. Probable cause: JBIDE-24492", ex);
    }
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    assertDefinedResourcesButtonIsNotPresent();
}
Also used : DefaultText(org.eclipse.reddeer.swt.impl.text.DefaultText) OpenshiftTestInFailureException(org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) DefaultTabItem(org.eclipse.reddeer.swt.impl.tab.DefaultTabItem) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) Test(org.junit.Test)

Example 5 with OpenshiftTestInFailureException

use of org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException 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)

Aggregations

OpenshiftTestInFailureException (org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException)6 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)4 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)3 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 Test (org.junit.Test)3 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)2 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)2 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)2 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)2 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)2 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)2 Git (org.eclipse.jgit.api.Git)1 ServerHasState (org.eclipse.reddeer.eclipse.condition.ServerHasState)1 Server (org.eclipse.reddeer.eclipse.wst.server.ui.cnf.Server)1 ServersView2 (org.eclipse.reddeer.eclipse.wst.server.ui.cnf.ServersView2)1 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)1 BackButton (org.eclipse.reddeer.swt.impl.button.BackButton)1 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)1