Search in sources :

Example 6 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException 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 7 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException in project jbosstools-openshift by jbosstools.

the class CreateNewConnectionTest method testCreateNewV3OAuthConnection.

@Test
@RunIf(conditionClass = ConnectionCredentialsExists.class)
public void testCreateNewV3OAuthConnection() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    DatastoreOS3.AUTH_METHOD = AuthenticationMethod.OAUTH;
    explorer.openConnectionShell();
    try {
        explorer.connectToOpenShift(DatastoreOS3.SERVER, null, DatastoreOS3.TOKEN, false, false, AuthenticationMethod.OAUTH, true);
    } catch (RedDeerException ex) {
        fail("Creating an OpenShift v3 OAuth connection failed." + ex.getCause());
    }
    assertTrue("Connection does not exist in OpenShift Explorer view", explorer.connectionExists(DatastoreOS3.USERNAME));
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) RunIf(org.eclipse.reddeer.junit.execution.annotation.RunIf) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 8 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException in project jbosstools-openshift by jbosstools.

the class LabelsTest method testCreateDuplicativeLabel.

@Test
public void testCreateDuplicativeLabel() {
    ResourceLabelsWizardPage page = new ResourceLabelsWizardPage();
    String name = "label";
    String value = "value";
    page.createLabel(name, value);
    try {
        page.createLabel(name, value);
        fail("It should not be possible to create duplicitive labels");
    } catch (RedDeerException ex) {
    // pass
    } finally {
        closeResourceLabelShell();
    }
}
Also used : ResourceLabelsWizardPage(org.jboss.tools.openshift.reddeer.wizard.page.ResourceLabelsWizardPage) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) Test(org.junit.Test)

Example 9 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException in project jbosstools-openshift by jbosstools.

the class NewApplicationWizardHandlingTest method testTemplatesRelatedWidgetAccess.

@Test
public void testTemplatesRelatedWidgetAccess() {
    assertTrue("Server template selection should be chosen by default.", new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).isSelected());
    new DefaultTabItem(OpenShiftLabel.TextLabels.CUSTOM_TEMPLATE).activate();
    try {
        new DefaultTree();
        fail("Tree with server templates should not be visible if local template " + "tab item is selected.");
    } catch (RedDeerException ex) {
    // pass
    }
    assertTrue("Browse button should be visible and enabled while local template " + "tab item is selected.", new PushButton(OpenShiftLabel.Button.BROWSE).isEnabled());
    new DefaultTabItem(OpenShiftLabel.TextLabels.SERVER_TEMPLATE).activate();
    assertTrue("Tree with server templates should be visible and enabled if server template " + "tab item is selected.", new DefaultTree().isEnabled());
    try {
        new PushButton(1, new WithTextMatcher(OpenShiftLabel.Button.BROWSE));
        fail("Browse button should not be visible while server template tab item is selected.");
    } catch (RedDeerException ex) {
    // pass
    }
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) DefaultTabItem(org.eclipse.reddeer.swt.impl.tab.DefaultTabItem) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Test(org.junit.Test)

Example 10 with RedDeerException

use of org.eclipse.reddeer.common.exception.RedDeerException in project jbosstools-openshift by jbosstools.

the class CreateNewProjectTest method testCreateNewProjectViaManageShell.

@Test
public void testCreateNewProjectViaManageShell() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.reopen();
    OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
    connection.select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.EDIT_OS_PROJECTS).select();
    new DefaultShell(OpenShiftLabel.Shell.MANAGE_OS_PROJECTS);
    new PushButton(OpenShiftLabel.Button.NEW).click();
    new DefaultShell(OpenShiftLabel.Shell.CREATE_OS_PROJECT);
    new LabeledText(OpenShiftLabel.TextLabels.PROJECT_NAME).setText(DatastoreOS3.PROJECT1);
    new LabeledText(OpenShiftLabel.TextLabels.PROJECT_DISPLAYED_NAME).setText(DatastoreOS3.PROJECT1_DISPLAYED_NAME);
    new WaitUntil(new ControlIsEnabled(new FinishButton()));
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.MANAGE_OS_PROJECTS);
    try {
        new DefaultTable().getItem(DatastoreOS3.PROJECT1);
    } catch (RedDeerException ex) {
        fail("Project " + DatastoreOS3.PROJECT1 + " does not exist in the table. It has not been created.");
    }
    assertTrue("Displayed name for project " + DatastoreOS3.PROJECT1 + " is not shown in the table.", new DefaultTable().getItem(DatastoreOS3.PROJECT1).getText(1).equals(DatastoreOS3.PROJECT1_DISPLAYED_NAME));
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.MANAGE_OS_PROJECTS), TimePeriod.LONG);
    try {
        connection.getProject();
    } catch (RedDeerException ex) {
        fail("OpenShift project created for a connection has not been shown in OpenShift explorer.\n" + ex.getCause());
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Aggregations

RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)34 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)12 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)11 Test (org.junit.Test)11 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)10 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)10 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)7 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)7 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)6 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)6 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)6 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)5 TextEditor (org.eclipse.reddeer.workbench.impl.editor.TextEditor)5 PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)4 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)4 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)4 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)4 File (java.io.File)3 LabeledCombo (org.eclipse.reddeer.swt.impl.combo.LabeledCombo)3 DefaultStyledText (org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText)3