Author: jjamrich
Date: 2011-09-23 09:26:37 -0400 (Fri, 23 Sep 2011)
New Revision: 22744
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/EditorAttributes.java
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/RichEditorComponentAttribute.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/TestRichEditor.java
Log:
RFPL-1439: Update editor tests to use unified way to setting attributes
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-23
13:26:09 UTC (rev 22743)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-23
13:26:37 UTC (rev 22744)
@@ -1,6 +1,7 @@
package org.richfaces.tests.metamer.ftest.attributes;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+import javassist.expr.NewArray;
import org.jboss.test.selenium.request.RequestType;
import org.richfaces.tests.metamer.ftest.BasicAttributes;
@@ -19,6 +20,7 @@
import org.richfaces.tests.metamer.ftest.richDragIndicator.DragIndicatorAttributes;
import org.richfaces.tests.metamer.ftest.richDragSource.DragSourceAttributes;
import org.richfaces.tests.metamer.ftest.richDropTarget.DropTargetAttributes;
+import org.richfaces.tests.metamer.ftest.richEditor.EditorAttributes;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
public class AttributeList {
@@ -42,5 +44,6 @@
public static Attributes<DragIndicatorAttributes> dragIndicatorAttributes = new
Attributes<DragIndicatorAttributes>();
public static Attributes<DragSourceAttributes> dragSourceAttributes = new
Attributes<DragSourceAttributes>();
public static Attributes<DropTargetAttributes> dropTargetAttributes = new
Attributes<DropTargetAttributes>();
+ public static Attributes<EditorAttributes> editorAttributes = new
Attributes<EditorAttributes>();
}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/EditorAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/EditorAttributes.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/EditorAttributes.java 2011-09-23
13:26:37 UTC (rev 22744)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richEditor;
+
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
+
+/**
+ * Rich Editor attributes bean
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ *
+ * @version $Revision$
+ */
+public enum EditorAttributes implements AttributeEnum {
+
+ immediate,
+ lang,
+ height,
+ oninit,
+ readonly,
+ rendered,
+ required,
+ requiredMessage,
+ style,
+ styleClass,
+ toolbar,
+ title,
+ value,
+ width,
+
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/EditorAttributes.java
___________________________________________________________________
Added: svn:executable
+ *
Deleted:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/RichEditorComponentAttribute.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/RichEditorComponentAttribute.java 2011-09-23
13:26:09 UTC (rev 22743)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/RichEditorComponentAttribute.java 2011-09-23
13:26:37 UTC (rev 22744)
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- *******************************************************************************/
-package org.richfaces.tests.metamer.ftest.richEditor;
-
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
-
-/**
- * Rich Editor attributes bean
- *
- * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
- *
- * @version $Revision$
- */
-public class RichEditorComponentAttribute extends AbstractComponentAttributes {
-
- public void setImmediate(Boolean immediate) {
- setProperty("immediate", immediate);
- }
-
- public void setLang(String lang) {
- setProperty("lang", lang);
- }
-
- public void setHeight(String height) {
- setProperty("height", height);
- }
-
- public void setReadonly(Boolean readonly) {
- setProperty("readonly", readonly);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setRequired (Boolean required) {
- setProperty("required", required);
- }
-
- public void setRequiredMessage(String requiredMessage) {
- setProperty("requiredMessage", requiredMessage);
- }
-
- public void setStyle(String style) {
- setProperty("style", style);
- }
-
- public void setStyleClass(String styleClass) {
- setProperty("styleClass", styleClass);
- }
-
- public void setToolbar(String toolbar) {
- setProperty("toolbar", toolbar);
- }
-
- public void setTitle(String title) {
- setProperty("title", title);
- }
-
- public void setValue(String value) {
- setProperty("value", value);
- }
-
- public void setWidth(String width) {
- setProperty("width", width);
- }
-
- public void setOnInit(String onInit) {
- setProperty("oninit", onInit);
- }
-
-}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/TestRichEditor.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/TestRichEditor.java 2011-09-23
13:26:09 UTC (rev 22743)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/TestRichEditor.java 2011-09-23
13:26:37 UTC (rev 22744)
@@ -8,6 +8,8 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static
org.richfaces.tests.metamer.ftest.attributes.AttributeList.editorAttributes;
+import static org.richfaces.tests.metamer.ftest.richEditor.EditorAttributes.*;
import java.net.URL;
@@ -68,8 +70,6 @@
}
}
- private RichEditorComponentAttribute attributes = new
RichEditorComponentAttribute();
-
private String text1 = "text1";
private String text2 = "text2";
@@ -154,7 +154,7 @@
public void testHeight() {
String height = "250px";
- attributes.setHeight(height);
+ editorAttributes.set(EditorAttributes.height, height);
// height style is set for area used as editor canvas (not for whole editor
component)
String style = selenium.getAttribute(
@@ -165,7 +165,7 @@
@Test
public void testImmediate() {
- attributes.setImmediate(Boolean.TRUE);
+ editorAttributes.set(immediate, Boolean.TRUE);
// set first value
typeTextToEditor(text1);
@@ -189,7 +189,7 @@
@IssueTracking("https://issues.jboss.org/browse/RF-11394")
public void testLang() {
String langVal = "xyz";
- attributes.setLang(langVal);
+ editorAttributes.set(lang, langVal);
// there is lang attribute present in 2 editor's elements
assertTrue(langVal.equals(selenium.getAttribute(editorTextArea.getAttribute(langAttribute))));
@@ -225,7 +225,7 @@
String currentText = getEditorText();
assertTrue(currentText != null && currentText.contains(text1));
- attributes.setReadonly(Boolean.TRUE);
+ editorAttributes.set(readonly, Boolean.TRUE);
// waitModel.until(elementPresent.locator(editor));
typeTextToEditor("test");
@@ -234,7 +234,7 @@
assertFalse(currentText != null &&
currentText.contains("test"));
// now set read-only back to false
- attributes.setReadonly(Boolean.FALSE);
+ editorAttributes.set(readonly, Boolean.FALSE);
// waitModel.until(elementPresent.locator(editor));
// and type another text
@@ -247,13 +247,13 @@
@Test
public void testRendered() {
- attributes.setRendered(Boolean.FALSE);
+ editorAttributes.set(rendered, Boolean.FALSE);
assertFalse(selenium.isElementPresent(editor), "Editor is rendered even
rendered attribute set to false.");
}
@Test
public void testRequired() {
- attributes.setRequired(Boolean.TRUE);
+ editorAttributes.set(required, Boolean.TRUE);
selenium.click(hSubmit);
waitGui.until(textEquals.locator(validationMsgLoc).text(validationMsg1));
@@ -265,12 +265,12 @@
@Test
public void testRequiredMessage() {
- attributes.setRequired(Boolean.TRUE);
- attributes.setRequiredMessage(validationMsg2);
+ editorAttributes.set(required, Boolean.TRUE);
+ editorAttributes.set(requiredMessage, validationMsg2);
selenium.click(hSubmit);
waitGui.until(textEquals.locator(validationMsgLoc).text(validationMsg2));
- attributes.setRequiredMessage(validationMsg1);
+ editorAttributes.set(requiredMessage, validationMsg1);
selenium.click(a4jSubmit);
waitGui.until(textEquals.locator(validationMsgLoc).text(validationMsg1));
}
@@ -281,7 +281,7 @@
final AttributeLocator<?> styleAttr =
editor.getAttribute(Attribute.STYLE);
final String style = "background-color: yellow; font-size: 1.5em;";
- attributes.setStyle(style);
+ editorAttributes.set(EditorAttributes.style, style);
waitModel.failWith("Attribute style should contain \"" + style +
"\"")
.until(new SeleniumCondition() {
@@ -296,10 +296,10 @@
@Test
public void testStyleClass() {
- final String styleClass = "metamer-ftest-class";
- attributes.setStyleClass(styleClass);
+ final String styleClassVal = "metamer-ftest-class";
+ editorAttributes.set(styleClass, styleClassVal);
- JQueryLocator elementWhichHasntThatClass = jq(editor.getRawLocator() +
":not(.{0})").format(styleClass);
+ JQueryLocator elementWhichHasntThatClass = jq(editor.getRawLocator() +
":not(.{0})").format(styleClassVal);
waitModel.until(elementPresent.locator(editor));
assertTrue(selenium.isElementPresent(editor));
assertFalse(selenium.isElementPresent(elementWhichHasntThatClass));
@@ -308,25 +308,25 @@
@Test
public void testTitle() {
- String title = "RichFaces 4";
+ String titleVal = "RichFaces 4";
AttributeLocator<?> attribute = editor.getAttribute(new
Attribute("title"));
// title = null
- assertFalse(title.equals(selenium.getAttribute(attribute)), "Attribute title
should not be present.");
+ assertFalse(titleVal.equals(selenium.getAttribute(attribute)), "Attribute
title should not be present.");
// set title
- attributes.setTitle(title);
+ editorAttributes.set(title, titleVal);
// wait until attribute present
assertTrue(selenium.isAttributePresent(attribute), "Attribute title should
be present.");
// assert correct attribute value: title
- waitModel.until(attributeEquals.locator(attribute).text(title));
+ waitModel.until(attributeEquals.locator(attribute).text(titleVal));
}
@Test
public void testToolbar() {
- attributes.setToolbar("basic");
+ editorAttributes.set(toolbar, "basic");
/* for basic configuration of editor's toolbar there should be only one
toolgroup
(toolgroup is group of buttons, while span.toolbar is his container)
@@ -335,11 +335,11 @@
*/
assertEquals(selenium.getCount(editorToolbarGroup), 1);
- attributes.setToolbar("full");
+ editorAttributes.set(toolbar, "full");
assertEquals(selenium.getCount(editorToolbarGroup), 11);
// since config facet has been introduced...
- attributes.setToolbar("custom");
+ editorAttributes.set(toolbar, "custom");
assertEquals(selenium.getCount(editorToolbarGroup), 9);
}
@@ -351,7 +351,7 @@
selenium.click(hSubmit);
// then set value from outside, and check this value in editor
- attributes.setValue(text2);
+ editorAttributes.set(value, text2);
selenium.selectFrame(frameLocator);
String found = selenium.getText(editorArea);
assertTrue(found!=null && found.contains(text2));
@@ -364,7 +364,7 @@
public void testWidth() {
String STYLE_WIDTH = "345px";
- attributes.setWidth(STYLE_WIDTH);
+ editorAttributes.set(width, STYLE_WIDTH);
String styleAttr = selenium.getAttribute(editor.getAttribute(styleAttribute));
assertTrue(styleAttr != null && styleAttr.contains(STYLE_WIDTH),
"Style attribute should contain width value");