Search in sources :

Example 21 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell 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 22 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-openshift by jbosstools.

the class ConnectionWizardHandlingTest method openConnectionShell.

@Before
public void openConnectionShell() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.openConnectionShell();
    new DefaultShell(OpenShiftLabel.Shell.NEW_CONNECTION);
}
Also used : DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) Before(org.junit.Before)

Example 23 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-openshift by jbosstools.

the class AuthenticationTokenRetrival method retrieveToken.

/**
 * Represents action of clicking on retrieve new token link, wait for browser to
 * appear, log in and obtain new token.
 *
 * @return token string
 */
public String retrieveToken() {
    EmulatedLinkStyledText linkText = new EmulatedLinkStyledText(OpenShiftLabel.TextLabels.RETRIEVE_TOKEN);
    linkText.click(linkText.getPositionOfText(OpenShiftLabel.TextLabels.LINK_RETRIEVE) + 3);
    new WaitUntil(new ShellIsActive(new WithTextMatcher("Unnamed")), TimePeriod.MEDIUM, false);
    DefaultShell browser = new DefaultShell();
    InternalBrowser internalBrowser = new InternalBrowser(browser);
    login(internalBrowser);
    new WaitUntil(new LoginPageIsLoaded(() -> internalBrowser.getText().contains(PAGETITLE_API_TOKEN)));
    String token = getTokenFromBrowser(internalBrowser);
    // close browser shell
    new PushButton(OpenShiftLabel.Button.CLOSE).click();
    return token;
}
Also used : ShellIsActive(org.eclipse.reddeer.swt.condition.ShellIsActive) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) InternalBrowser(org.eclipse.reddeer.swt.impl.browser.InternalBrowser) LoginPageIsLoaded(org.jboss.tools.openshift.reddeer.condition.LoginPageIsLoaded) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 24 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-openshift by jbosstools.

the class CDKLaunchConfigurationTest method openLaunchConfiguration.

/**
 * Open Launch configuration dialog via server editor and return object of CDKLaunchConfigurationDialog
 * @return
 */
private void openLaunchConfiguration() {
    editor.openLaunchConfigurationFromLink();
    DefaultShell shell = new DefaultShell("Edit Configuration");
    shell.setFocus();
    launchDialog = new CDKLaunchConfigurationDialog(shell);
}
Also used : DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) CDKLaunchConfigurationDialog(org.jboss.tools.cdk.reddeer.server.ui.editor.launch.configuration.CDKLaunchConfigurationDialog)

Example 25 with DefaultShell

use of org.eclipse.reddeer.swt.impl.shell.DefaultShell in project jbosstools-openshift by jbosstools.

the class CDKServerWizardAbstractTest method assertServerType.

protected void assertServerType(final String serverType) {
    NewCDKServerWizard wizard = (NewCDKServerWizard) CDKTestUtils.openNewServerWizardDialog();
    try {
        TreeItem item = new DefaultTreeItem(new String[] { SERVER_TYPE_GROUP }).getItem(serverType);
        item.select();
        assertTrue(item.getText().equalsIgnoreCase(serverType));
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
    } catch (CoreLayerException coreExp) {
        log.error(coreExp.getMessage());
        fail("Server type " + serverType + " was not found in New Server Wizard");
    }
    assertEquals(new LabeledText("Server's host name:").getText(), "localhost");
    assertEquals(new LabeledText("Server name:").getText(), getServerAdapter());
    new WaitUntil(new ControlIsEnabled(new NextButton()), TimePeriod.MEDIUM, false);
    assertTrue("Dialog button Next is not enabled!", wizard.isNextEnabled());
    try {
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
        new CancelButton().click();
    } catch (WaitTimeoutExpiredException exc) {
        exc.printStackTrace();
        log.error("Dialog could not be canceled because there were unfinished jobs running after timeout" + "\n\rTrying to cancel dialog manually");
        new DefaultShell("New Server").close();
    }
}
Also used : NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) SystemJobIsRunning(org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Aggregations

DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)129 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)84 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)83 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)57 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)49 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)46 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)41 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)36 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)30 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)28 Test (org.junit.Test)27 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)25 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)18 Shell (org.eclipse.reddeer.swt.api.Shell)17 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)17 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)17 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)16 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)16 YesButton (org.eclipse.reddeer.swt.impl.button.YesButton)16 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)16