Author: yzhishko
Date: 2010-06-05 11:11:38 -0400 (Sat, 05 Jun 2010)
New Revision: 22585
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponent.html
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2RenameAttrTestPageRefactor.html
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2RenameParticipantTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5943 - SWTBotTests were added.
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponent.html
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponent.html
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponent.html 2010-06-05
15:11:38 UTC (rev 22585)
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:composite="http://java.sun.com/jsf/composite">
+
+<!-- INTERFACE -->
+<composite:interface>
+ <composite:attribute name="echo"></composite:attribute>
+</composite:interface>
+
+<!-- IMPLEMENTATION -->
+<composite:implementation></composite:implementation>
+
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2RenameAttrTestPageRefactor.html
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2RenameAttrTestPageRefactor.html
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2RenameAttrTestPageRefactor.html 2010-06-05
15:11:38 UTC (rev 22585)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:mycomp="http://java.sun.com/jsf/composite/mycomp">
+
+<mycomp:echo echo1="test" />
+
+</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java 2010-06-05
14:42:59 UTC (rev 22584)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java 2010-06-05
15:11:38 UTC (rev 22585)
@@ -9,6 +9,7 @@
import org.jboss.tools.jsf.ui.bot.test.cssdialog.jbide.JBIDE3579Test;
import org.jboss.tools.jsf.ui.bot.test.cssdialog.jbide.JBIDE3920Test;
import org.jboss.tools.jsf.ui.bot.test.cssdialog.jbide.JBIDE4391Test;
+import org.jboss.tools.jsf.ui.bot.test.jsf2.refactor.JSF2AttributeRenameTest;
import org.jboss.tools.jsf.ui.bot.test.jsf2.refactor.JSF2MoveParticipantTest;
import org.jboss.tools.jsf.ui.bot.test.jsf2.refactor.JSF2RenameParticipantTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.AddRemoveJSFCapabilitiesTest;
@@ -36,6 +37,7 @@
suite.addTestSuite(CSSSelectorJBIDE3288.class);
suite.addTestSuite(JSF2MoveParticipantTest.class);
suite.addTestSuite(JSF2RenameParticipantTest.class);
+ suite.addTestSuite(JSF2AttributeRenameTest.class);
return suite;
}
}
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java 2010-06-05
14:42:59 UTC (rev 22584)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java 2010-06-05
15:11:38 UTC (rev 22585)
@@ -91,7 +91,7 @@
StringBuilder builder = new StringBuilder(""); //$NON-NLS-1$
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
- builder.append(scanner.nextLine());
+ builder.append(scanner.nextLine()+"\n"); //$NON-NLS-1$
}
return builder.toString();
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java 2010-06-05
14:42:59 UTC (rev 22584)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java 2010-06-05
15:11:38 UTC (rev 22585)
@@ -63,7 +63,7 @@
bot.textWithLabel("File name:").setText("echo"); //$NON-NLS-1$
//$NON-NLS-2$
bot.button("Finish").click(); //$NON-NLS-1$
bot.sleep(2000);
- bot.editorByTitle("echo.xhtml").close(); //$NON-NLS-1$
+ bot.editorByTitle("echo.xhtml").saveAndClose(); //$NON-NLS-1$
}
}
Added:
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
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java 2010-06-05
15:11:38 UTC (rev 22585)
@@ -0,0 +1,80 @@
+package org.jboss.tools.jsf.ui.bot.test.jsf2.refactor;
+
+import java.io.IOException;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+
+public class JSF2AttributeRenameTest extends JSF2AbstractRefactorTest {
+
+ public void testJSF2AttributeRename() throws Exception {
+ createCompositeComponent();
+ createTestPage();
+ renameCompositeAttribute();
+ checkContent();
+ }
+
+ private void renameCompositeAttribute() {
+ SWTBotEclipseEditor editor = bot
+ .editorByTitle("echo.xhtml").toTextEditor(); //$NON-NLS-1$
+ editor.selectRange(9, 29, 1);
+ bot.menu("Refactor").menu("Rename").click(); //$NON-NLS-1$
//$NON-NLS-2$
+ bot.shell("Rename Composite Attribute").activate(); //$NON-NLS-1$
+ bot.textWithLabel("New name:").setText("echo1"); //$NON-NLS-1$
//$NON-NLS-2$
+ bot.button("OK").click(); //$NON-NLS-1$
+ }
+
+ private void checkContent() throws IOException {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name
+ ".xhtml").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ delay();
+ SWTBotEclipseEditor editor = bot.editorByTitle(
+ JSF2_Test_Page_Name + ".xhtml").toTextEditor(); //$NON-NLS-1$
+ assertEquals(
+ loadFileContent("refactor/jsf2RenameAttrTestPageRefactor.html"),
editor.getText()); //$NON-NLS-1$
+ delay();
+ editor.close();
+ }
+
+ @Override
+ protected void createCompositeComponent() throws Exception {
+ super.createCompositeComponent();
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml").doubleClick();
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ SWTBotEclipseEditor editor = bot
+ .editorByTitle("echo.xhtml").toTextEditor(); //$NON-NLS-1$
+ bot.menu("Edit").menu("Select All").click(); //$NON-NLS-1$
//$NON-NLS-2$
+ bot.menu("Edit").menu("Delete").click();
//$NON-NLS-1$//$NON-NLS-2$
+ bot.sleep(2000);
+ editor.setText(loadFileContent("refactor/compositeComponent.html"));
//$NON-NLS-1$
+ editor.save();
+ bot.sleep(2000);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name
+ ".xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$
//$NON-NLS-2$
+ bot.button("OK").click(); //$NON-NLS-1$
+ delay();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).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.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/jsf2/refactor/JSF2RenameParticipantTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2RenameParticipantTest.java 2010-06-05
14:42:59 UTC (rev 22584)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2RenameParticipantTest.java 2010-06-05
15:11:38 UTC (rev 22585)
@@ -8,8 +8,8 @@
public class JSF2RenameParticipantTest extends JSF2AbstractRefactorTest {
public void testJSF2RenameParticipant() throws Exception {
+ createCompositeComponent();
createTestPage();
- createCompositeComponent();
renameCompositeComponent();
checkContent();
}