Search in sources :

Example 6 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor in project jbosstools-openshift by jbosstools.

the class EditResourcesTest method testIncorrectResourceContent.

@Test
public void testIncorrectResourceContent() {
    TextEditor editor = getBuildConfigTextEditor();
    String text = editor.getText();
    if (buildConfig == null) {
        buildConfig = text;
    }
    editor.setText(text.replace("\"namespace\" : \"" + DatastoreOS3.PROJECT1 + "\"", "\"namespace\" : \"" + DatastoreOS3.PROJECT1 + "\"wtf"));
    try {
        editor.save();
    } catch (CoreLayerException ex) {
    // ok
    }
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT, false);
    assertTrue("Editor should be dirty, it should not be able to save incorrect content", editor.isDirty());
    try {
        new DefaultShell("Problem Occurred");
        new OkButton().click();
    } catch (RedDeerException ex) {
    // sometimes it occures, sometimes not
    }
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 7 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor in project jbosstools-openshift by jbosstools.

the class EditResourcesTest method testCanEditResource.

@Test
public void testCanEditResource() {
    getBuildConfig().select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.EDIT).select();
    try {
        new TextEditor(new WithTextMatcher("*.eap-app.json"));
    // pass
    } catch (RedDeerException ex) {
        fail("Text editor to modify build config resource has not been opened.");
    }
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 8 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor in project jbosstools-openshift by jbosstools.

the class NodeJSAppDebugTest method testVariablesAvailableInView.

@Test
public void testVariablesAvailableInView() throws CoreException, IOException {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    pe.getProject(OpenShiftResources.NODEJS_GIT_NAME).getProjectItem("server.js").open();
    new WaitUntil(new EditorWithTitleIsActive("server.js"));
    TextEditor editor = new TextEditor("server.js");
    setLineBreakpoint(editor, BREAKPOINT_LINE);
    triggerDebugSession();
    // test couple of js variables
    TreeItem var_db = getVariable(VAR_db);
    TreeItem var_initDb = getVariable(VAR_initDb);
    TreeItem var_require = getVariable(VAR_require);
    assertTrue("Variable '" + VAR_db + "' not found in view!", var_db != null);
    assertThat(var_db.getCell(0), is(VAR_db));
    assertThat(var_db.getCell(1), containsString(VAR_VALUE_db));
    assertTrue("Variable '" + VAR_initDb + "' not found in view!", var_initDb != null);
    assertThat(var_initDb.getCell(0), is(VAR_initDb));
    assertThat(var_initDb.getCell(1), containsString(VAR_VALUE_initDb));
    assertTrue("Variable '" + VAR_require + "' not found in view!", var_require != null);
    assertThat(var_require.getCell(0), is(VAR_require));
    assertThat(var_require.getCell(1), containsString(VAR_VALUE_require));
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) EditorWithTitleIsActive(org.eclipse.reddeer.workbench.condition.EditorWithTitleIsActive) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 9 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor in project jbosstools-openshift by jbosstools.

the class NodeJSAppDebugTest method testDebuggerStopsAtBreakpoint.

@Test
public void testDebuggerStopsAtBreakpoint() throws CoreException, IOException {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    pe.getProject(OpenShiftResources.NODEJS_GIT_NAME).getProjectItem("server.js").open();
    new WaitUntil(new EditorWithTitleIsActive("server.js"));
    TextEditor editor = new TextEditor("server.js");
    setLineBreakpoint(editor, BREAKPOINT_LINE);
    triggerDebugSession();
    try {
        new WaitUntil(new EditorWithTitleIsActive("server.js"), TimePeriod.LONG);
        new WaitUntil(new CursorPositionIsOnLine(editor, BREAKPOINT_LINE));
    } catch (WaitTimeoutExpiredException e) {
        Assert.fail("Debugger hasn't stopped on breakpoint");
    }
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) EditorWithTitleIsActive(org.eclipse.reddeer.workbench.condition.EditorWithTitleIsActive) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 10 with TextEditor

use of org.eclipse.reddeer.workbench.impl.editor.TextEditor in project jbosstools-openshift by jbosstools.

the class DebuggingEAPAppTest method setBreakpointToLineWithText.

// Sets breakpoint to first appearance of given text.
private void setBreakpointToLineWithText(ProjectItem file, String text) {
    file.open();
    TextEditor textEditor = new TextEditor("HelloService.java");
    textEditor.setCursorPosition(textEditor.getPositionOfText(text));
    new ShellMenuItem("Run", "Toggle Breakpoint").select();
}
Also used : ShellMenuItem(org.eclipse.reddeer.swt.impl.menu.ShellMenuItem) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor)

Aggregations

TextEditor (org.eclipse.reddeer.workbench.impl.editor.TextEditor)14 Test (org.junit.Test)7 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)5 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)5 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)4 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)4 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)4 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)3 PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)2 EditorWithTitleIsActive (org.eclipse.reddeer.workbench.condition.EditorWithTitleIsActive)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)1 ConsoleHasNoChange (org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange)1 ProjectItem (org.eclipse.reddeer.eclipse.core.resources.ProjectItem)1 ConsoleView (org.eclipse.reddeer.eclipse.ui.console.ConsoleView)1 ProblemsView (org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)1 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)1 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)1