Search in sources :

Example 6 with DefaultStyledText

use of org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText 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 DefaultStyledText

use of org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method setNewVariableValue.

// TODO this should be replaced once
// https://github.com/jboss-reddeer/reddeer/issues/1668 is fixed.
private void setNewVariableValue(String newValue, final String... variablePath) {
    new WaitWhile(new JobIsRunning());
    LaunchView debugView = new LaunchView();
    debugView.open();
    ensureCorrectFrameIsSelected(debugView);
    VariablesView variablesView = new VariablesView();
    variablesView.open();
    new WaitUntil(new AbstractWaitCondition() {

        @Override
        public boolean test() {
            try {
                TreeItem variable = new DefaultTreeItem(variablePath);
                variable.select();
                return variable.isSelected();
            } catch (Exception e) {
                return false;
            }
        }

        @Override
        public String description() {
            return "Variable is not selected";
        }
    }, TimePeriod.LONG);
    try {
        new ContextMenuItem("Change Value...").select();
    } catch (CoreLayerException e) {
        throw e;
    }
    new DefaultShell("Change Object Value");
    new DefaultStyledText().setText(newValue);
    new OkButton().click();
    new WaitWhile(new JobIsRunning());
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException) IOException(java.io.IOException) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) LaunchView(org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractWaitCondition(org.eclipse.reddeer.common.condition.AbstractWaitCondition) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) VariablesView(org.eclipse.reddeer.eclipse.debug.ui.views.variables.VariablesView)

Example 8 with DefaultStyledText

use of org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText in project jbosstools-hibernate by jbosstools.

the class Hibernate3CompoundEditor method getSourceText.

/**
 * Returns editor's source text
 * @return editor source text
 */
public String getSourceText() {
    activateSourceTab();
    DefaultStyledText dst = new DefaultStyledText(this);
    String source = dst.getText();
    return source;
}
Also used : DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText)

Aggregations

DefaultStyledText (org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText)8 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)4 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)3 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)3 Test (org.junit.Test)3 IOException (java.io.IOException)2 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)2 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)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 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)2 File (java.io.File)1 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)1 AbstractWaitCondition (org.eclipse.reddeer.common.condition.AbstractWaitCondition)1 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 LaunchView (org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView)1