Search in sources :

Example 6 with LabeledCombo

use of org.eclipse.reddeer.swt.impl.combo.LabeledCombo in project jbosstools-openshift by jbosstools.

the class CreateResourcesTest method createResource.

private void createResource(String pathToResource) {
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_RESOURCE).select();
    new DefaultShell(OpenShiftLabel.Shell.NEW_RESOURCE);
    assertTrue("Selected project has not been selected for new resource creation.", new LabeledCombo(OpenShiftLabel.TextLabels.PROJECT).getSelection().equals(testProject));
    new LabeledText(OpenShiftLabel.TextLabels.RESOURCE_LOCATION).setText(pathToResource);
    new FinishButton().click();
    new DefaultShell(OpenShiftLabel.Shell.CREATE_RESOURCE_SUMMARY);
    assertTrue("Resource is not listed in created resources summary", new DefaultTree().getAllItems().size() == 1);
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_RESOURCE));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 7 with LabeledCombo

use of org.eclipse.reddeer.swt.impl.combo.LabeledCombo 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 8 with LabeledCombo

use of org.eclipse.reddeer.swt.impl.combo.LabeledCombo in project jbosstools-openshift by jbosstools.

the class ConnectionWizardHandlingTest method testSwitchingBasicAndOAuthProtocol.

@Test
public void testSwitchingBasicAndOAuthProtocol() {
    new LabeledCombo(OpenShiftLabel.TextLabels.SERVER_TYPE).setSelection(OpenShiftLabel.Others.OPENSHIFT3);
    // Verify that required fields are present after switching protocol type
    switchToOAuth();
    switchToBasic();
    switchToOAuth();
    switchToBasic();
}
Also used : LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 9 with LabeledCombo

use of org.eclipse.reddeer.swt.impl.combo.LabeledCombo in project jbosstools-openshift by jbosstools.

the class OpenNewApplicationWizardWithNoProjectTest method testOpenNewApplicationWizardFromCentralWithNoProjects.

@Test
public void testOpenNewApplicationWizardFromCentralWithNoProjects() {
    new DefaultToolItem(new WorkbenchShell(), OpenShiftLabel.Others.RED_HAT_CENTRAL).click();
    new InternalBrowser().execute(OpenShiftLabel.Others.OPENSHIFT_CENTRAL_SCRIPT);
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_APP_WIZARD), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.NEW_APP_WIZARD);
    for (String comboItem : new DefaultCombo(0).getItems()) {
        if (comboItem.contains(connectionReq.getUsername()) && comboItem.contains(connectionReq.getHost())) {
            new DefaultCombo(0).setSelection(comboItem);
            break;
        }
    }
    new NextButton().click();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.CREATE_OS_PROJECT);
    new LabeledText(OpenShiftLabel.TextLabels.PROJECT_NAME).setText(projectName);
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG);
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    new WaitUntil(new ControlIsEnabled(new BackButton()), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.NEW_APP_WIZARD);
    assertTrue("Created project was not preselected for a new OpenShift application", new LabeledCombo(OpenShiftLabel.TextLabels.PROJECT).getText().equals(projectName));
    closeWizard();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) DefaultToolItem(org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem) BackButton(org.eclipse.reddeer.swt.impl.button.BackButton) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) InternalBrowser(org.eclipse.reddeer.swt.impl.browser.InternalBrowser) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) Test(org.junit.Test)

Example 10 with LabeledCombo

use of org.eclipse.reddeer.swt.impl.combo.LabeledCombo in project jbosstools-openshift by jbosstools.

the class NewApplicationWizardHandlingTest method testSwitchProject.

@Test
public void testSwitchProject() {
    List<String> projects = new ArrayList<String>();
    String project1Text = DatastoreOS3.PROJECT1_DISPLAYED_NAME + " (" + DatastoreOS3.PROJECT1 + ")";
    String project2Text = DatastoreOS3.PROJECT2 + " (" + DatastoreOS3.PROJECT2 + ")";
    projects.add(project1Text);
    projects.add(project2Text);
    LabeledCombo projectCombo = new LabeledCombo(OpenShiftLabel.TextLabels.PROJECT);
    assertTrue("Project combo should contain projects " + Arrays.toString(projects.toArray()) + " but those projects are not there. Combo contains following projects: " + Arrays.toString(projectCombo.getItems().toArray()), projectCombo.getItems().contains(project2Text));
    projectCombo.setSelection(project2Text);
    projectCombo.setSelection(project1Text);
    projectCombo.setSelection(project2Text);
}
Also used : LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

LabeledCombo (org.eclipse.reddeer.swt.impl.combo.LabeledCombo)26 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)11 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)10 Test (org.junit.Test)10 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)8 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)7 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)6 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)6 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)6 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)5 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)5 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)4 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)4 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)3 NextButton (org.eclipse.reddeer.swt.impl.button.NextButton)3 DefaultCombo (org.eclipse.reddeer.swt.impl.combo.DefaultCombo)3 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)3 WorkbenchShell (org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell)3 InternalBrowser (org.eclipse.reddeer.swt.impl.browser.InternalBrowser)2 BackButton (org.eclipse.reddeer.swt.impl.button.BackButton)2