Author: vpakan(a)redhat.com
Date: 2012-10-10 04:33:15 -0400 (Wed, 10 Oct 2012)
New Revision: 44400
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ActiveEditorHasTitleCondition.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java
trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/OpenOnHelper.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
Log:
Fixes for JBT 4.0.0.Alpha2
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java 2012-10-10
08:28:05 UTC (rev 44399)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java 2012-10-10
08:33:15 UTC (rev 44400)
@@ -6,6 +6,7 @@
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.test.WidgetVariables;
public class JSF2AttributeRenameTest extends JSF2AbstractRefactorTest {
@@ -82,6 +83,7 @@
delay();
tree.expandNode(JBT_TEST_PROJECT_NAME).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml").select();
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$
//$NON-NLS-2$
+ bot.shell(IDELabel.Shell.CONFIRM_DELETE).activate();
bot.button("OK").click(); //$NON-NLS-1$
delay();
super.tearDown();
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java 2012-10-10
08:28:05 UTC (rev 44399)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java 2012-10-10
08:33:15 UTC (rev 44400)
@@ -194,14 +194,13 @@
0);
String textToInsert = "<ez:";
compositeComponentContainerEditor.insertText(textToInsert);
- SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ // Check content assist "<ez:"
+ ContentAssistHelper.applyContentAssistAutoProposal(SWTTestExt.bot,
JSF2_TEST_PAGE,
- textToInsert,
- textToInsert.length(),
- 0,
- 0);
- // Check content assist menu content for "<ez:"
- contentAssist.checkContentAssist("ez:input", true);
+ textToInsert,
+ textToInsert.length(),
+ 0,
+ 0);
bot.sleep(Timing.time2S());
compositeComponentContainerEditor.save();
String currentLineText = compositeComponentContainerEditor.getTextOnCurrentLine();
Modified:
trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java 2012-10-10
08:28:05 UTC (rev 44399)
+++
trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java 2012-10-10
08:33:15 UTC (rev 44400)
@@ -37,6 +37,7 @@
private static int sleepTime = 1000;
private Logger log = Logger.getLogger(JBTSWTBotTestCase.class);
private HashSet<String> ignoredExceptionsFromEclipseLog = new
HashSet<String>();
+ private boolean acceptExceptionsFromEclipseLog = false;
/*
* (non-Javadoc) This static block read properties from
* org.jboss.tools.ui.bot.test/resources/SWTBot.properties file and set up
@@ -74,20 +75,22 @@
public void logging(IStatus status, String plugin) {
switch (status.getSeverity()) {
case IStatus.ERROR:
- Throwable throwable = status.getException();
- if (throwable == null){
- if (!ignoredExceptionsFromEclipseLog.contains("null")) {
- throwable = new Throwable(status.getMessage() + " in " //$NON-NLS-1$
- + status.getPlugin());
- }
+ if (acceptExceptionsFromEclipseLog) {
+ Throwable throwable = status.getException();
+ if (throwable == null) {
+ if (!ignoredExceptionsFromEclipseLog.contains("null")) {
+ throwable = new Throwable(status.getMessage() + " in " //$NON-NLS-1$
+ + status.getPlugin());
+ }
+ } else {
+ // Check if exception has to be ignored
+ if (ignoredExceptionsFromEclipseLog.contains(throwable
+ .getClass().getCanonicalName())) {
+ throwable = null;
+ }
+ }
+ setException(throwable);
}
- else {
- // Check if exception has to be ignored
- if
(ignoredExceptionsFromEclipseLog.contains(throwable.getClass().getCanonicalName())){
- throwable = null;
- }
- }
- setException(throwable);
break;
default:
break;
@@ -420,4 +423,23 @@
protected void eraseIgnoredExceptionsFromEclipseLog(){
ignoredExceptionsFromEclipseLog.clear();
}
+ /**
+ * Disables catching exceptions from Eclipse log
+ */
+ protected void ignoreAllExceptionsFromEclipseLog(){
+ acceptExceptionsFromEclipseLog = false;
+ }
+ /**
+ * Reenables catching exceptions from Eclipse log
+ */
+ protected void catchExceptionsFromEclipseLog(){
+ acceptExceptionsFromEclipseLog = true;
+ }
+ /**
+ * Returns true when exceptions from Eclipse log are catched
+ * @return
+ */
+ protected boolean isAcceptExceptionsFromEclipseLog(){
+ return acceptExceptionsFromEclipseLog;
+ }
}
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ActiveEditorHasTitleCondition.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ActiveEditorHasTitleCondition.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ActiveEditorHasTitleCondition.java 2012-10-10
08:33:15 UTC (rev 44400)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/package
org.jboss.tools.ui.bot.ext.condition;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+
+/**
+ * Returns true when active editor has required title.
+ *
+ * @author Vlado Pakan
+ *
+ */
+public class ActiveEditorHasTitleCondition implements ICondition {
+
+ private String editorTitle;
+ private SWTBotExt botExt;
+
+ public ActiveEditorHasTitleCondition(SWTBotExt botExt,String shellTitle) {
+ super();
+ this.editorTitle = shellTitle;
+ this.botExt = botExt;
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ // empty
+ }
+
+ @Override
+ public boolean test() throws Exception {
+ return (botExt.activeEditor() != null &&
editorTitle.equals(botExt.activeEditor().getTitle()));
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Active editor doesn't have title:\n" + editorTitle
+ + "\nbut it has title:\n" + (botExt.activeEditor() == null ?
"<null>" : botExt.activeEditor().getTitle());
+ }
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ActiveEditorHasTitleCondition.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java 2012-10-10
08:28:05 UTC (rev 44399)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java 2012-10-10
08:33:15 UTC (rev 44400)
@@ -168,4 +168,30 @@
return editor;
}
+ /**
+ * Applies Content Assist auto proposal. It's case when there is only one
+ * content assist item and that item is automatically inserted into editor
+ * @param editorTitle
+ * @param textToSelect
+ * @param selectionOffset
+ * @param selectionLength
+ * @param textToSelectIndex
+ */
+ public static SWTBotEditor applyContentAssistAutoProposal(SWTBotExt bot,
+ String editorTitle, String textToSelect, int selectionOffset,
+ int selectionLength, int textToSelectIndex) {
+
+ SWTJBTExt.selectTextInSourcePane(bot,
+ editorTitle, textToSelect, selectionOffset, selectionLength,
+ textToSelectIndex);
+
+ bot.sleep(Timing.time1S());
+
+ SWTBotEditorExt editor = SWTTestExt.bot.swtBotEditorExtByTitle(editorTitle);
+ ContentAssistBot contentAssist = editor.contentAssist();
+ contentAssist.invokeContentAssist();
+
+ return editor;
+
+ }
}
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/OpenOnHelper.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/OpenOnHelper.java 2012-10-10
08:28:05 UTC (rev 44399)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/OpenOnHelper.java 2012-10-10
08:33:15 UTC (rev 44400)
@@ -20,10 +20,12 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.condition.ActiveEditorHasTitleCondition;
/**
* Helper for Open On functionality testing
@@ -52,7 +54,7 @@
editorTitle, textToSelect, selectionOffset, selectionLength,
textToSelectIndex);
- bot.sleep(Timing.time1S());
+ bot.sleep(Timing.time3S());
sourceEditor.setFocus();
// process UI Events
@@ -61,7 +63,7 @@
public void run() {
}
});
- bot.sleep(Timing.time1S());
+ bot.sleep(Timing.time3S());
new SWTUtilExt(bot).waitForNonIgnoredJobs();
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_F3);
@@ -73,6 +75,12 @@
});
bot.sleep(Timing.time3S());
new SWTUtilExt(bot).waitForNonIgnoredJobs();
+
+ try{
+ bot.waitUntil(new ActiveEditorHasTitleCondition(bot,expectedOpenedFileName),
Timing.time10S());
+ } catch (TimeoutException toe){
+ // do nothing next assert below will check if active editor is the correct one
+ }
openedEditor = bot.activeEditor();
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2012-10-10
08:28:05 UTC (rev 44399)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2012-10-10
08:33:15 UTC (rev 44400)
@@ -23,7 +23,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
@@ -346,12 +345,7 @@
while (isUnuseDialogOpened()) {
closeUnuseDialogs();
}
- List<? extends SWTBotEditor> editors = bot.editors();
- if (editors != null) {
- for (int i = 0; i < editors.size(); i++) {
- editors.get(i).close();
- }
- }
+ bot.closeAllEditors();
}
/**