Author: vpakan(a)redhat.com
Date: 2009-11-23 05:04:06 -0500 (Mon, 23 Nov 2009)
New Revision: 18775
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckFileChangesSaving.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckRenaming.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/EditorSynchronizationTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/JSPPageCreationTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameFacesConfigFileTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameJSPFileTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameXHTMLFileTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/XHTMLPageCreationTest.java
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/WidgetVariables.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/META-INF/MANIFEST.MF
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java
Log:
Added Smoke Test of VPE Editor.
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 2009-11-23
09:55:44 UTC (rev 18774)
+++
trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -263,6 +263,38 @@
bot.button("OK").click();
}
}
+ /**
+ * Open and activate Properties View if it hadn't been opened before
+ */
+
+ protected void openPropertiesView() {
+ try {
+ bot.viewByTitle(WidgetVariables.PROPERTIES).setFocus();
+ } catch (WidgetNotFoundException e) {
+ bot.menu("Window").menu("Show
View").menu("Other...").click();
+ SWTBotTree viewTree = bot.tree();
+ delay();
+ viewTree.expandNode("General").expandNode(
+ WidgetVariables.PROPERTIES).select();
+ bot.button("OK").click();
+ }
+ }
+ /**
+ * Open and activate Outline View if it hadn't been opened before
+ */
+
+ protected void openOutlineView() {
+ try {
+ bot.viewByTitle(WidgetVariables.OUTLINE).setFocus();
+ } catch (WidgetNotFoundException e) {
+ bot.menu("Window").menu("Show
View").menu("Other...").click();
+ SWTBotTree viewTree = bot.tree();
+ delay();
+ viewTree.expandNode("General").expandNode(
+ WidgetVariables.OUTLINE).select();
+ bot.button("OK").click();
+ }
+ }
// protected void openProgressStatus() {
// try {
// bot.viewByTitle(WidgetVariables.PROGRESS_STATUS);
Modified:
trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/WidgetVariables.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/WidgetVariables.java 2009-11-23
09:55:44 UTC (rev 18774)
+++
trunk/jst/tests/org.jboss.tools.jst.ui.bot.test/src/org/jboss/tools/ui/bot/test/WidgetVariables.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -15,6 +15,8 @@
public static final String PALETTE = "JBoss Tools Palette";
public static final String WEB_PROJECTS = "Web Projects";
public static final String SERVERS = "Servers";
+ public static final String PROPERTIES = "Properties";
+ public static final String OUTLINE = "Outline";
public static final String OK_BUTTON = "OK";
public static final String NEXT_BUTTON = "Next >";
public static final String BACK_BUTTON = "< Back";
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,20 @@
+package org.jboss.tools.ui.bot.ext.helper;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+
+public class KeyboardHelper {
+ public static void pressKeyCode (Display display , int keyCode){
+
+ Event keyPressed = new Event();
+ keyPressed.keyCode = keyCode;
+ keyPressed.type = SWT.KeyDown;
+ display.post(keyPressed);
+ Event keyReleased = new Event();
+ keyReleased.keyCode = keyCode;
+ keyReleased.type = SWT.KeyUp;
+ display.post(keyReleased);
+
+ }
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/META-INF/MANIFEST.MF 2009-11-23
09:55:44 UTC (rev 18774)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/META-INF/MANIFEST.MF 2009-11-23
10:04:06 UTC (rev 18775)
@@ -23,7 +23,8 @@
org.jboss.tools.vpe.xulrunner;bundle-version="2.1.0",
org.eclipse.jface.text;bundle-version="3.5.0",
org.jboss.tools.jst.jsp;bundle-version="2.0.0",
- org.junit4
+ org.junit4,
+ org.jboss.tools.ui.bot.ext;bundle-version="1.0.0"
Eclipse-RegisterBuddy: org.apache.log4j
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2009-11-23
09:55:44 UTC (rev 18774)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -17,10 +17,17 @@
import org.jboss.tools.vpe.ui.bot.test.jbide.JBIDE4556Test;
import org.jboss.tools.vpe.ui.bot.test.palette.CancelTagLibDefenitionTest;
import org.jboss.tools.vpe.ui.bot.test.palette.ImportTagsFromTLDFileTest;
+import org.jboss.tools.vpe.ui.bot.test.smoke.EditorSynchronizationTest;
+import org.jboss.tools.vpe.ui.bot.test.smoke.JSPPageCreationTest;
+import org.jboss.tools.vpe.ui.bot.test.smoke.RenameFacesConfigFileTest;
+import org.jboss.tools.vpe.ui.bot.test.smoke.RenameJSPFileTest;
+import org.jboss.tools.vpe.ui.bot.test.smoke.RenameXHTMLFileTest;
+import org.jboss.tools.vpe.ui.bot.test.smoke.XHTMLPageCreationTest;
public class VPEAllBotTests extends SWTBotTestCase{
public static Test suite(){
TestSuite suite = new TestSuite("VPE All Tests");
+
suite.addTestSuite(CancelTagLibDefenitionTest.class);
suite.addTestSuite(ImportTagsFromTLDFileTest.class);
suite.addTestSuite(ToggleCommentTest.class);
@@ -34,6 +41,12 @@
suite.addTestSuite(AlwaysHideSelectionBarWithoutPromptTest.class);
suite.addTestSuite(ShowNonVisualTagsTest.class);
suite.addTestSuite(AddSubstitutedELExpressionFolderScopeTest.class);
+ suite.addTestSuite(EditorSynchronizationTest.class);
+ suite.addTestSuite(JSPPageCreationTest.class);
+ suite.addTestSuite(XHTMLPageCreationTest.class);
+ suite.addTestSuite(RenameFacesConfigFileTest.class);
+ suite.addTestSuite(RenameJSPFileTest.class);
+ suite.addTestSuite(RenameXHTMLFileTest.class);
return new TestSetup(suite);
}
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2009-11-23
09:55:44 UTC (rev 18774)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -52,7 +52,7 @@
return filePath;
}
- void openPage(){
+ protected void openPage(){
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
tree.expandNode(JBT_TEST_PROJECT_NAME)
@@ -68,12 +68,13 @@
protected void tearDown() throws Exception {
//Restore page state before tests
-
- editor.setFocus();
- bot.menu("Edit").menu("Select All").click();
- bot.menu("Edit").menu("Delete").click();
- editor.setText(editorText);
- editor.save();
+ if (editor != null){
+ editor.setFocus();
+ bot.menu("Edit").menu("Select All").click();
+ bot.menu("Edit").menu("Delete").click();
+ editor.setText(editorText);
+ editor.save();
+ }
super.tearDown();
}
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckFileChangesSaving.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckFileChangesSaving.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckFileChangesSaving.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.test.SWTJBTBot;
+
+/**
+ * Test Saving Changes To File
+ * @author Vladimir Pakan
+ *
+ */
+public class CheckFileChangesSaving {
+ private static final int sleepTime = 1000;
+ /**
+ * Insert changeText to file in editor, close file, save file dependent on saveFile
input parameter
+ * reopen file and check if change was saved or not
+ * @param editor
+ * @param tree
+ * @param fileTreeItem
+ * @param changeText
+ * @param saveFile
+ */
+ public static String checkIt (SWTJBTBot bot, SWTBotEclipseEditor editor , SWTBotTree
tree, SWTBotTreeItem fileTreeItem,
+ String changeText, boolean saveFile){
+ String result = null;
+ // Test Saving
+ editor.insertText(changeText);
+ bot.sleep(sleepTime);
+ bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.CLOSE).click();
+ bot.shell(IDELabel.Shell.SAVE_RESOURCE).activate();
+ bot.button(saveFile ? IDELabel.Button.YES : IDELabel.Button.NO).click();
+ bot.sleep(sleepTime);
+ // Reopen Test File
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree , fileTreeItem);
+
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.OPEN,
true)).click();
+ bot.sleep(sleepTime);
+
+ if (saveFile &&
!bot.editorByTitle(fileTreeItem.getText()).toTextEditor().getText().startsWith(changeText)){
+ result = fileTreeItem.getText() + " was not saved properly.";
+ }
+ else if (!saveFile &&
bot.editorByTitle(fileTreeItem.getText()).toTextEditor().getText().startsWith(changeText)){
+ result = fileTreeItem.getText() + " was saved even it should not be.";
+ }
+
+ return result;
+
+ }
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckFileChangesSaving.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckRenaming.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckRenaming.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckRenaming.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.test.SWTJBTBot;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+
+/**
+ * Check Renaming Functionality within WebProjects View
+ * Tests if file war properly renamed in WebProjects View
+ * and Title of file in Editor was renamed also.
+ * @author Vladimir Pakan
+ *
+ */
+public class CheckRenaming {
+ private static final int sleepTime = 1000;
+ /**
+ * Check File Renaming
+ * @param bot
+ * @param oldFileName
+ * @param newFileName
+ * @param treePathItems
+ * @return
+ */
+ public static String checkRenameJSPFile(SWTJBTBot bot , String oldFileName, String
newFileName, String... treePathItems){
+
+ bot.sleep(sleepTime);
+ SWTBot webProjects = bot.viewByTitle(WidgetVariables.WEB_PROJECTS).bot();
+ SWTBotTree tree = webProjects.tree();
+
+ tree.setFocus();
+
+ if (treePathItems != null && treePathItems.length > 0){
+ SWTBotTreeItem parentTreeItem = tree.getTreeItem(treePathItems[0]);
+ parentTreeItem.expand();
+ int index = 1;
+ while (treePathItems.length > index){
+ parentTreeItem = parentTreeItem.getNode(treePathItems[index]);
+ parentTreeItem.expand();
+ index++;
+ }
+ // Open File
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree ,
parentTreeItem.getNode(oldFileName));
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.OPEN,
true)).click();
+ bot.sleep(sleepTime);
+ // Rename file
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.RENAME,
true)).click();
+ bot.shell(IDELabel.Shell.RENAME_RESOURCE).activate();
+ bot.textWithLabel(IDELabel.RenameResourceDialog.NEW_NAME)
+ .setText(newFileName);
+ bot.button(IDELabel.Button.OK).click();
+ bot.sleep(sleepTime);
+ // Check Results
+ // File with Old Name doesn't exists within WebProjects View
+ try{
+ parentTreeItem.getNode(oldFileName);
+ return "File " + oldFileName + " was not renamed to " +
newFileName + ".";
+ }catch (WidgetNotFoundException wnfe) {
+ // do nothing
+ }
+ // File with New Name exists within WebProjects View
+ try{
+ parentTreeItem.getNode(newFileName);
+ }catch (WidgetNotFoundException wnfe) {
+ return "Renamed File " + newFileName + " was not found.";
+ }
+ // Editor Title was renamed
+ try{
+ bot.editorByTitle(newFileName);
+ }catch (WidgetNotFoundException wnfe) {
+ return "Editor Title was not changed to " + newFileName + " after
renaming.";
+ }
+ }
+ else{
+ return "Unable to find file for renaming.";
+ }
+
+ return null;
+
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CheckRenaming.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/EditorSynchronizationTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/EditorSynchronizationTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/EditorSynchronizationTest.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.ui.bot.test.smoke;
+
+import java.util.Iterator;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+/**
+ * Test VPE Editor synchronization with Properties and Outline View
+ * @author Vladimir Pakan
+ *
+ */
+public class EditorSynchronizationTest extends VPEEditorTestCase{
+
+ public void testEditorSynchronization() throws Throwable{
+
+ openPage();
+ openOutlineView();
+ openPropertiesView();
+ checkVPEEditorSynchronization();
+
+ setException(null);
+
+ }
+ /**
+ * Check VPE Editor synchronization with Properties and Outline View
+ */
+ private void checkVPEEditorSynchronization(){
+
+ final SWTBotEclipseEditor jspTextEditor =
bot.editorByTitle(TEST_PAGE).toTextEditor();
+
+ int lineIndex = 0;
+ int messageLineIndex = -1;
+ Iterator<String> lineIterator = jspTextEditor.getLines().iterator();
+ while (lineIterator.hasNext() && messageLineIndex == -1) {
+ if (lineIterator.next().trim().startsWith("<h:messages ")) {
+ messageLineIndex = lineIndex;
+ } else {
+ lineIndex++;
+ }
+ }
+
+ jspTextEditor.navigateTo(messageLineIndex, 3);
+
+ KeyboardHelper.pressKeyCode(bot.getDisplay(), SWT.ARROW_LEFT);
+
+ delay();
+
+ assertTrue("h:messages node is not selected within Outline View",
+
bot.viewByTitle(WidgetVariables.OUTLINE).bot().tree().selection().get(0).get(0).startsWith("h:messages
"));
+
+ SWTBotTree outlineTree = bot.viewByTitle(WidgetVariables.PROPERTIES).bot().tree();
+
outlineTree.getTreeItem("Attributes").expand().getNode("style").select();
+
+ assertTrue("style attribute of h:message node has wrong value within Properties
view" +
+ ". Should be 'color: red'",
+ outlineTree.selection().get(0).get(1).startsWith("color: red"));
+
+ jspTextEditor.close();
+
+ }
+}
\ No newline at end of file
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/EditorSynchronizationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/JSPPageCreationTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/JSPPageCreationTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/JSPPageCreationTest.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+/**
+ * Test JSP page Creation and Saving
+ * @author Vladimir Pakan
+ *
+ */
+public class JSPPageCreationTest extends VPEEditorTestCase{
+
+ public static final String TEST_NEW_JSP_FILE_NAME = "TestJSP.jsp";
+ private static final String SAVE_COMMENT = "<!-- Save This -->\n";
+ private static final String DO_NOT_SAVE_COMMENT = "<!-- Do not Save This
-->\n";
+
+ public void testEditorJSPPageCreation() throws Throwable{
+
+ checkJSPPageCreation();
+
+ setException(null);
+
+ }
+ /**
+ * Test JSP page Creation and Saving
+ */
+ private void checkJSPPageCreation(){
+
+ openWebProjects();
+
+ delay();
+
+ SWTBot webProjects = bot.viewByTitle(WidgetVariables.WEB_PROJECTS).bot();
+ SWTBotTree tree = webProjects.tree();
+
+ tree.setFocus();
+
+ SWTBotTreeItem webContentTreeItem = tree
+ .getTreeItem(JBT_TEST_PROJECT_NAME)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.WEB_CONTENT);
+
+ webContentTreeItem.select();
+ // create new JSP file
+
bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.NEW).menu(IDELabel.Menu.JSP_FILE).click();
+ bot.shell(IDELabel.Shell.NEW_JSP_FILE).activate();
+ bot.textWithLabel(IDELabel.NewJSPFileDialog.NAME).setText(TEST_NEW_JSP_FILE_NAME);
+
bot.comboBoxWithLabel(IDELabel.NewJSPFileDialog.TEMPLATE).setText(IDELabel.NewJSPFileDialog.TEMPLATE_JSF_BASE_PAGE);
+ bot.button(IDELabel.Button.FINISH).click();
+
+ SWTBotTreeItem jspTestPageTreeItem =
webContentTreeItem.getNode(TEST_NEW_JSP_FILE_NAME);
+
+ String checkResult = CheckFileChangesSaving.checkIt(bot,
bot.editorByTitle(TEST_NEW_JSP_FILE_NAME).toTextEditor(),
+ tree, jspTestPageTreeItem,
+ SAVE_COMMENT, true);
+
+ assertNull(checkResult,checkResult);
+
+ checkResult = CheckFileChangesSaving.checkIt(bot,
bot.editorByTitle(TEST_NEW_JSP_FILE_NAME).toTextEditor(),
+ tree, jspTestPageTreeItem,
+ DO_NOT_SAVE_COMMENT, false);
+
+ assertNull(checkResult,checkResult);
+
+ delay();
+
+ bot.editorByTitle(TEST_NEW_JSP_FILE_NAME).toTextEditor().close();
+
+ }
+
+
+}
\ No newline at end of file
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/JSPPageCreationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameFacesConfigFileTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameFacesConfigFileTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameFacesConfigFileTest.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+/**
+ * Test renaming of faces-config.xml file
+ * @author Vladimir Pakan
+ *
+ */
+public class RenameFacesConfigFileTest extends VPEEditorTestCase{
+
+ private static final String NEW_FACES_CONFIG_FILE_NAME =
"faces-config-renamed.xml";
+ private static final String OLD_FACES_CONFIG_FILE_NAME = "faces-config.xml";
+
+ public void testRenameFacesConfigFile() throws Throwable{
+
+ checkRenameFacesConfigFile();
+
+ setException(null);
+
+ }
+ /**
+ * Check renaming of faces-config.xml file
+ */
+ private void checkRenameFacesConfigFile(){
+
+ openWebProjects();
+
+ delay();
+
+ SWTBot webProjects = bot.viewByTitle(WidgetVariables.WEB_PROJECTS).bot();
+ SWTBotTree tree = webProjects.tree();
+
+ tree.setFocus();
+ String checkResult = CheckRenaming.checkRenameJSPFile(bot,
OLD_FACES_CONFIG_FILE_NAME, NEW_FACES_CONFIG_FILE_NAME,
+ JBT_TEST_PROJECT_NAME,IDELabel.WebProjectsTree.CONFIGURATION);
+ assertNull(checkResult,checkResult);
+ // web.xml file was properly modified
+ SWTBotTreeItem configFilesTreeItem = tree
+ .getTreeItem(JBT_TEST_PROJECT_NAME)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.WEB_XML)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.CONTEXT_PARAMS)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.JAVAX_FACES_CONFIG_FILES);
+
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree,configFilesTreeItem);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.PROPERTIES,
true)).click();
+ bot.shell(IDELabel.Shell.PROPERTIES).activate();
+ SWTBotTable propertiesTable = bot.table();
+ String fullConfigFileName =
propertiesTable.cell(propertiesTable.indexOf(IDELabel.PropertiesDialog.PARAM_VALUE, 0),
1);
+ bot.button(IDELabel.Button.CLOSE).click();
+ assertTrue(NEW_FACES_CONFIG_FILE_NAME + "Name of "
+ + OLD_FACES_CONFIG_FILE_NAME
+ + " file was not changed in web.xml file.",
+ fullConfigFileName.endsWith(NEW_FACES_CONFIG_FILE_NAME));
+ }
+}
\ No newline at end of file
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameFacesConfigFileTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameJSPFileTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameJSPFileTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameJSPFileTest.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+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;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+/**
+ * Test renaming of JSP file
+ * @author Vladimir Pakan
+ *
+ */
+public class RenameJSPFileTest extends VPEEditorTestCase{
+
+ private static final String NEW_JSP_FILE_NAME = "renamed-"
+ + JSPPageCreationTest.TEST_NEW_JSP_FILE_NAME;
+
+ public void testRenameJSPFile() throws Throwable{
+
+ checkRenameJSPFile();
+
+ setException(null);
+
+ }
+
+ private void checkRenameJSPFile(){
+
+ openWebProjects();
+
+ delay();
+
+ SWTBot webProjects = bot.viewByTitle(WidgetVariables.WEB_PROJECTS).bot();
+ SWTBotTree tree = webProjects.tree();
+
+ tree.setFocus();
+ String checkResult = CheckRenaming.checkRenameJSPFile(bot,
+ JSPPageCreationTest.TEST_NEW_JSP_FILE_NAME, NEW_JSP_FILE_NAME,
+ JBT_TEST_PROJECT_NAME, IDELabel.WebProjectsTree.WEB_CONTENT);
+ assertNull(checkResult, checkResult);
+
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameJSPFileTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameXHTMLFileTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameXHTMLFileTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameXHTMLFileTest.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+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;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+
+/**
+ * Test renaming of XHTML file
+ *
+ * @author Vladimir Pakan
+ *
+ */
+public class RenameXHTMLFileTest extends VPEEditorTestCase {
+
+ private static final String NEW_XHTML_FILE_NAME = "renamed-"
+ + XHTMLPageCreationTest.TEST_NEW_XHTML_FILE_NAME;
+
+ public void testRenameFacesConfigFile() throws Throwable {
+
+ checkRenameXHTMLFile();
+
+ setException(null);
+
+ }
+
+ /**
+ * Check renaming of faces-config.xml file
+ */
+ private void checkRenameXHTMLFile() {
+
+ openWebProjects();
+
+ delay();
+
+ SWTBot webProjects = bot.viewByTitle(WidgetVariables.WEB_PROJECTS).bot();
+ SWTBotTree tree = webProjects.tree();
+
+ tree.setFocus();
+ String checkResult = CheckRenaming.checkRenameJSPFile(bot,
+ XHTMLPageCreationTest.TEST_NEW_XHTML_FILE_NAME, NEW_XHTML_FILE_NAME,
+ JBT_TEST_PROJECT_NAME, IDELabel.WebProjectsTree.WEB_CONTENT);
+ assertNull(checkResult, checkResult);
+
+ }
+}
\ No newline at end of file
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/RenameXHTMLFileTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/XHTMLPageCreationTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/XHTMLPageCreationTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/XHTMLPageCreationTest.java 2009-11-23
10:04:06 UTC (rev 18775)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+/**
+ * Test XHTML page Creation and Saving
+ * @author Vladimir Pakan
+ *
+ */
+public class XHTMLPageCreationTest extends VPEEditorTestCase{
+
+ public static final String TEST_NEW_XHTML_FILE_NAME = "TestXHTML.xhtml";
+ private static final String SAVE_COMMENT = "<!-- Save This -->\n";
+ private static final String DO_NOT_SAVE_COMMENT = "<!-- Do not Save This
-->\n";
+
+ public void testXHTMLPageCreation() throws Throwable{
+
+ checkXHTMLPageCreation();
+
+ setException(null);
+
+ }
+
+ /**
+ * Test XHTML page Creation and Saving
+ */
+ private void checkXHTMLPageCreation(){
+
+ openWebProjects();
+
+ delay();
+
+ SWTBot webProjects = bot.viewByTitle(WidgetVariables.WEB_PROJECTS).bot();
+ SWTBotTree tree = webProjects.tree();
+
+ tree.setFocus();
+
+ SWTBotTreeItem webContentTreeItem = tree
+ .getTreeItem(JBT_TEST_PROJECT_NAME)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.WEB_CONTENT);
+
+ webContentTreeItem.select();
+ // create new JSP file
+
bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.NEW).menu(IDELabel.Menu.XHTML_FILE).click();
+ bot.shell(IDELabel.Shell.NEW_XHTML_FILE).activate();
+
bot.textWithLabel(IDELabel.NewXHTMLFileDialog.NAME).setText(TEST_NEW_XHTML_FILE_NAME);
+
bot.comboBoxWithLabel(IDELabel.NewXHTMLFileDialog.TEMPLATE).setText(IDELabel.NewXHTMLFileDialog.TEMPLATE_FACELET_FORM_XHTML);
+ bot.button(IDELabel.Button.FINISH).click();
+
+ SWTBotTreeItem xhtmlTestPageTreeItem =
webContentTreeItem.getNode(TEST_NEW_XHTML_FILE_NAME);
+
+ String checkResult =
CheckFileChangesSaving.checkIt(bot,bot.editorByTitle(TEST_NEW_XHTML_FILE_NAME).toTextEditor(),
tree, xhtmlTestPageTreeItem,
+ SAVE_COMMENT, true);
+
+ assertNull(checkResult,checkResult);
+
+ checkResult =
CheckFileChangesSaving.checkIt(bot,bot.editorByTitle(TEST_NEW_XHTML_FILE_NAME).toTextEditor(),
tree, xhtmlTestPageTreeItem,
+ DO_NOT_SAVE_COMMENT, false);
+
+ assertNull(checkResult,checkResult);
+
+ delay();
+
+ bot.editorByTitle(TEST_NEW_XHTML_FILE_NAME).toTextEditor().close();
+
+ }
+}
\ No newline at end of file
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/XHTMLPageCreationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain