Author: jpapouse
Date: 2011-09-19 13:09:40 -0400 (Mon, 19 Sep 2011)
New Revision: 22727
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/IconsChecker.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuGroup/TestPanelMenuGroupSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuItem/TestPanelMenuItemSimple.java
Log:
RFPL-1667: added transparent icon to the tests, unified tests for icon
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/IconsChecker.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/IconsChecker.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/IconsChecker.java 2011-09-19
17:09:40 UTC (rev 22727)
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * 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.checker;
+
+import static org.jboss.test.selenium.locator.option.OptionLocatorFactory.optionLabel;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang.Validate;
+import org.jboss.test.selenium.css.CssProperty;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.option.OptionLabelLocator;
+
+/**
+ * Checker for icon attributes (e.g. rich:accordion, rich:panelMenu)
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class IconsChecker {
+
+ private String iconPrefix;
+ private String iconSuffix;
+ private AjaxSelenium selenium;
+
+ /**
+ * Create a new instance of icons checker
+ *
+ * @param selenium instance of ajax selenium
+ * @param iconPrefix prefix used for icon elements
+ * @param iconSuffix suffix used for icon elements
+ */
+ public IconsChecker(AjaxSelenium selenium, String iconPrefix, String iconSuffix) {
+ Validate.notNull(iconPrefix);
+ Validate.notNull(iconSuffix);
+ Validate.notNull(selenium);
+ this.iconPrefix = iconPrefix;
+ this.iconSuffix = iconSuffix;
+ this.selenium = selenium;
+ }
+
+ /**
+ * Checks whether icons controlled by CSS work properly (only icons which produce an
image)
+ *
+ * @param attributeInput
+ * @param icon
+ * @param classSuffix
+ */
+ public void checkCssImageIcons(ElementLocator<JQueryLocator> attributeInput,
ElementLocator<JQueryLocator> icon, String classSuffix) {
+ String imageNameSuffix = "";
+ if (classSuffix.contains("dis")) {
+ imageNameSuffix = "Disabled";
+ }
+ // option -> css class
+ Map<String, String> cssImageIcons = new HashMap<String, String>();
+ cssImageIcons.put("chevron", "chevron");
+ cssImageIcons.put("chevronDown", "chevron-down");
+ cssImageIcons.put("chevronUp", "chevron-up");
+ cssImageIcons.put("disc", "disc");
+ cssImageIcons.put("grid", "grid");
+ cssImageIcons.put("triangle", "triangle");
+ cssImageIcons.put("triangleDown", "triangle-down");
+ cssImageIcons.put("triangleUp", "triangle-up");
+ for(String cssIcon : cssImageIcons.keySet()) {
+ if (!selectOptionSilently(attributeInput, cssIcon)) {
+ continue;
+ }
+ assertTrue(selenium.belongsClass(icon, iconPrefix +
cssImageIcons.get(cssIcon) + iconSuffix + classSuffix),
+ "Div should have set class " + iconPrefix +
cssImageIcons.get(cssIcon) + iconSuffix + classSuffix + ".");
+ assertTrue(
+ selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains(cssIcon +
imageNameSuffix),
+ "Icon should contain a " + cssIcon + ".");
+ }
+ }
+
+ /**
+ * Checks whether icons controlled by CSS work properly (only icons which don't
produce any image)
+ *
+ * @param attributeInput
+ * @param icon
+ * @param classSuffix
+ */
+ public void checkCssNoImageIcons(ElementLocator<JQueryLocator> attributeInput,
ElementLocator<JQueryLocator> icon, String classSuffix) {
+ String[] cssNoImageIcons = new String[] { "transparent" };
+ for(String cssIcon : cssNoImageIcons) {
+ if (!selectOptionSilently(attributeInput, cssIcon)) {
+ continue;
+ }
+ assertTrue(selenium.belongsClass(icon, iconPrefix + cssIcon + iconSuffix +
classSuffix),
+ "Div should have set class " + iconPrefix + cssIcon +
iconSuffix + classSuffix +".");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).equals("none"),
+ "Icon should not contain any image.");
+ }
+ }
+
+ /**
+ * Checks whether icon with custom URL works properly
+ *
+ * @param attributeInput
+ * @param icon
+ * @param image
+ * @param classSuffix
+ */
+ public void checkImageIcons(ElementLocator<JQueryLocator> attributeInput,
ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image,
String classSuffix) {
+ checkImageIcons(attributeInput, icon, image, classSuffix, true);
+ }
+
+ /**
+ * Checks whether icon with custom URL works properly
+ *
+ * @param attributeInput
+ * @param icon
+ * @param image
+ * @param classSuffix
+ * @param disableIcon set to TRUE if the presence of image element causes that icon
element shouldn't be present
+ */
+ public void checkImageIcons(ElementLocator<JQueryLocator> attributeInput,
ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image,
String classSuffix, boolean disableIcon) {
+ // option -> image
+ Map<String, String> imageIcons = new HashMap<String, String>();
+ imageIcons.put("nonexisting", "nonexisting");
+ imageIcons.put("star", "star.png");
+ for(String imageIcon : imageIcons.keySet()) {
+ if (!selectOptionSilently(attributeInput, imageIcon)) {
+ continue;
+ }
+ if (disableIcon) {
+ assertFalse(selenium.isElementPresent(icon), "Icon's div ("
+ icon.getRawLocator() + ") should not be present when icon=" + imageIcon +
".");
+ }
+ assertTrue(selenium.isElementPresent(image), "Icon's image should be
rendered (" + image.getRawLocator() + ") when icon=" + imageIcon +
".");
+
assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains(imageIcons.get(imageIcon)),
+ "Icon's src attribute (" + image.getRawLocator() + ")
should contain " + imageIcons.get(imageIcon) + " when icon=" + imageIcon +
".");
+ }
+ }
+
+ public void checkNone(ElementLocator<JQueryLocator> attributeInput,
ElementLocator<JQueryLocator> icon, String classSuffix) {
+ if (!selectOptionSilently(attributeInput, "none")) {
+ return;
+ }
+ assertFalse(selenium.isElementPresent(icon), "Icon should not be present
when icon=none.");
+ }
+
+ public String getIconPrefix() {
+ return iconPrefix;
+ }
+
+ public String getIconSuffix() {
+ return iconSuffix;
+ }
+
+ private boolean selectOptionSilently(ElementLocator<?> selectLocator, String
label) {
+ OptionLabelLocator optionLocator = optionLabel(label);
+ try {
+ selenium.select(selectLocator, optionLocator);
+ selenium.waitForPageToLoad();
+ return true;
+ } catch(RuntimeException e) {
+ // silent
+ return false;
+ }
+ }
+}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2011-09-19
17:04:58 UTC (rev 22726)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2011-09-19
17:09:40 UTC (rev 22727)
@@ -32,6 +32,8 @@
import static org.testng.Assert.assertTrue;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.event.PhaseId;
@@ -45,6 +47,7 @@
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.testng.annotations.Test;
/**
@@ -181,7 +184,6 @@
}
@Test
- @RegressionTest("https://issues.jboss.org/browse/RF-10054")
public void testImmediate() {
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
@@ -207,7 +209,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10352")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10352")
public void testItemActiveLeftIcon() {
JQueryLocator icon =
leftIcon.format(1).getDescendant(jq("div.rf-ac-itm-ico-act"));
JQueryLocator input = pjq("select[id$=itemActiveLeftIconInput]");
@@ -219,7 +221,7 @@
+ " should not be present on the page.");
}
- verifyStandardIcons(input, icon, image, "-hdr");
+ verifyStandardIcons(input, icon, image, "");
}
@Test
@@ -234,7 +236,7 @@
+ " should not be present on the page.");
}
- verifyStandardIcons(input, icon, image, "-hdr");
+ verifyStandardIcons(input, icon, image, "");
}
@Test
@@ -253,7 +255,7 @@
JQueryLocator input = pjq("select[id$=itemDisabledLeftIconInput]");
JQueryLocator image = leftIcon.format(4).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-hdr-dis");
+ verifyStandardIcons(input, icon, image, "-dis");
}
@Test
@@ -262,7 +264,7 @@
JQueryLocator input = pjq("select[id$=itemDisabledRightIconInput]");
JQueryLocator image = rightIcon.format(4).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-hdr-dis");
+ verifyStandardIcons(input, icon, image, "-dis");
}
@Test
@@ -282,7 +284,7 @@
JQueryLocator input = pjq("select[id$=itemInactiveLeftIconInput]");
JQueryLocator image = leftIcon.format(3).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-hdr");
+ verifyStandardIcons(input, icon, image, "");
}
@Test
@@ -291,7 +293,7 @@
JQueryLocator input = pjq("select[id$=itemInactiveRightIconInput]");
JQueryLocator image = rightIcon.format(3).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-hdr");
+ verifyStandardIcons(input, icon, image, "");
}
@Test
@@ -459,87 +461,10 @@
}
private void verifyStandardIcons(JQueryLocator input, JQueryLocator icon,
JQueryLocator image, String classSuffix) {
- String imageNameSuffix = "";
- if (classSuffix.contains("dis")) {
- imageNameSuffix = "Disabled";
- }
-
- selenium.select(input, optionLabel("chevron"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron" +
classSuffix),
- "Div should have set class rf-ico-chevron" + classSuffix +
".");
- assertTrue(
- selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("chevron" + imageNameSuffix +
".png"),
- "Icon should contain a chevron.");
-
- selenium.select(input, optionLabel("chevronDown"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-down" +
classSuffix),
- "Div should have set class rf-ico-chevron-down" + classSuffix +
".");
- assertTrue(
- selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("chevronDown" + imageNameSuffix +
".png"),
- "Icon should contain a chevron down.");
-
- selenium.select(input, optionLabel("chevronUp"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-up" +
classSuffix),
- "Div should have set class rf-ico-chevron-up" + classSuffix +
".");
- assertTrue(
- selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("chevronUp" + imageNameSuffix +
".png"),
- "Icon should contain a chevron up.");
-
- selenium.select(input, optionLabel("disc"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-disc" + classSuffix),
"Div should have set class rf-ico-disc"
- + classSuffix + ".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("disc" + imageNameSuffix +
".png"),
- "Icon should contain a disc.");
-
- selenium.select(input, optionLabel("grid"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-grid" + classSuffix),
"Div should have set class rf-ico-grid"
- + classSuffix + ".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("grid" + imageNameSuffix +
".png"),
- "Icon should contain a grid.");
-
- selenium.select(input, optionLabel("triangle"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle" +
classSuffix),
- "Div should have set class rf-ico-triangle" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("triangle" + imageNameSuffix +
".png"), "Icon should contain a triangle.");
-
- selenium.select(input, optionLabel("triangleDown"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-down" +
classSuffix),
- "Div should have set class rf-ico-triangle-down" + classSuffix
+ ".");
- assertTrue(
- selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("triangleDown" + imageNameSuffix +
".png"),
- "Icon should contain a triangle down.");
-
- selenium.select(input, optionLabel("triangleUp"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-up" +
classSuffix),
- "Div should have set class rf-ico-triangle-up" + classSuffix +
".");
- assertTrue(
- selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("triangleUp" + imageNameSuffix +
".png"),
- "Icon should contain a triangle up.");
-
- selenium.select(input, optionLabel("none"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon should not be present
when icon=none.");
-
- selenium.select(input, optionLabel("star"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon's div should not be
present when icon=star.");
- assertTrue(selenium.isElementPresent(image), "Icon's image should be
rendered.");
-
assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("star.png"),
- "Icon's src attribute should contain star.png.");
-
- selenium.select(input, optionLabel("nonexisting"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon's div should not be
present when icon=nonexisting.");
- assertTrue(selenium.isElementPresent(image), "Icon's image should be
rendered.");
-
assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("nonexisting"),
- "Icon's src attribute should contain nonexisting.");
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-",
"-hdr");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix);
+ checker.checkNone(input, icon, classSuffix);
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java 2011-09-19
17:04:58 UTC (rev 22726)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java 2011-09-19
17:09:40 UTC (rev 22727)
@@ -32,6 +32,9 @@
import static org.testng.Assert.assertTrue;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
import org.jboss.test.selenium.css.CssProperty;
import org.jboss.test.selenium.dom.Event;
@@ -40,6 +43,8 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.testng.annotations.Test;
/**
@@ -164,7 +169,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10488")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10488")
public void testLeftActiveIcon() {
JQueryLocator icon =
leftIcon.format(1).getDescendant(jq("div.rf-ac-itm-ico-act"));
JQueryLocator input = pjq("select[id$=leftActiveIconInput]");
@@ -213,7 +218,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10488")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10488")
public void testName() {
selenium.type(pjq("input[id$=nameInput]"), "new name");
selenium.waitForPageToLoad();
@@ -233,7 +238,6 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-9821
https://issues.jboss.org/browse/RF-10488")
public void testOnenter() {
testFireEvent(Event.CLICK, itemHeaders[0], "enter");
}
@@ -264,7 +268,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-9821
https://issues.jboss.org/browse/RF-10488")
+ @RegressionTest("https://issues.jboss.org/browse/RF-9821
https://issues.jboss.org/browse/RF-10488")
public void testOnleave() {
selenium.type(pjq("input[type=text][id$=onleaveInput]"),
"metamerEvents += \"leave \"");
selenium.waitForPageToLoad();
@@ -317,7 +321,6 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10488")
public void testRightActiveIcon() {
JQueryLocator icon =
rightIcon.format(1).getDescendant(jq("div.rf-ac-itm-ico-act"));
JQueryLocator input = pjq("select[id$=rightActiveIconInput]");
@@ -376,7 +379,6 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10488")
public void testSwitchTypeNull() {
guardXhr(selenium).click(itemHeaders[0]);
waitGui.failWith("Item 1 is not
displayed.").until(isDisplayed.locator(itemContents[0]));
@@ -414,69 +416,10 @@
}
private void verifyStandardIcons(JQueryLocator input, JQueryLocator icon,
JQueryLocator image, String classSuffix) {
- String imageNameSuffix = "";
- if (classSuffix.contains("dis")) {
- imageNameSuffix = "Disabled";
- }
-
- selenium.select(input, optionLabel("chevron"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-hdr" +
classSuffix), "Div should have set class rf-ico-chevron" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("chevron" + imageNameSuffix +
".png"), "Icon should contain a chevron.");
-
- selenium.select(input, optionLabel("chevronDown"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-down-hdr" +
classSuffix), "Div should have set class rf-ico-chevron-down" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("chevronDown" + imageNameSuffix +
".png"), "Icon should contain a chevron down.");
-
- selenium.select(input, optionLabel("chevronUp"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-up-hdr" +
classSuffix), "Div should have set class rf-ico-chevron-up" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("chevronUp" + imageNameSuffix +
".png"), "Icon should contain a chevron up.");
-
- selenium.select(input, optionLabel("disc"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-disc-hdr" +
classSuffix), "Div should have set class rf-ico-disc" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("disc" + imageNameSuffix +
".png"), "Icon should contain a disc.");
-
- for (int i = 2; i < 6; i++) {
- assertFalse(selenium.isElementPresent(leftIcon.format(i)), "Left icon of
item" + i + " should not be present on the page.");
- }
-
- selenium.select(input, optionLabel("grid"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-grid-hdr" +
classSuffix), "Div should have set class rf-ico-grid" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("grid" + imageNameSuffix +
".png"), "Icon should contain a grid.");
-
- selenium.select(input, optionLabel("triangle"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-hdr" +
classSuffix), "Div should have set class rf-ico-triangle" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("triangle" + imageNameSuffix +
".png"), "Icon should contain a triangle.");
-
- selenium.select(input, optionLabel("triangleDown"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-down-hdr" +
classSuffix), "Div should have set class rf-ico-triangle-down" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("triangleDown" + imageNameSuffix +
".png"), "Icon should contain a triangle down.");
-
- selenium.select(input, optionLabel("triangleUp"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-up-hdr" +
classSuffix), "Div should have set class rf-ico-triangle-up" + classSuffix +
".");
- assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("triangleUp" + imageNameSuffix +
".png"), "Icon should contain a triangle up.");
-
- selenium.select(input, optionLabel("none"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon should not be present
when icon=none.");
-
- selenium.select(input, optionLabel("star"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon's div should not be
present when icon=star.");
- assertTrue(selenium.isElementPresent(image), "Icon's image should be
rendered.");
-
assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("star.png"),
"Icon's src attribute should contain star.png.");
-
- selenium.select(input, optionLabel("nonexisting"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon's div should not be
present when icon=nonexisting.");
- assertTrue(selenium.isElementPresent(image), "Icon's image should be
rendered.");
-
assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("nonexisting"),
"Icon's src attribute should contain nonexisting.");
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-",
"-hdr");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix);
+ checker.checkNone(input, icon, classSuffix);
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java 2011-09-19
17:04:58 UTC (rev 22726)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java 2011-09-19
17:09:40 UTC (rev 22727)
@@ -21,10 +21,11 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richPanelMenu;
-import static org.testng.Assert.assertTrue;
-
-import org.richfaces.tests.metamer.ftest.model.PanelMenu.Icon;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.testng.annotations.Test;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -32,146 +33,185 @@
*/
public class TestPanelMenuIcon extends AbstractPanelMenuTest {
- private static String customURL = "/resources/images/loading.gif";
-
@Test
public void testGroupCollapsedLeftIcon() {
- attributes.setGroupCollapsedLeftIcon(customURL);
- group2.toggle();
- verifyIcon(group24.getLeftIcon());
+ group2.toggle();
+ JQueryLocator input = pjq("select[id$=groupCollapsedLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group24.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group24.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testGroupCollapsedRightIcon() {
- attributes.setGroupCollapsedRightIcon(customURL);
- group2.toggle();
- verifyIcon(group24.getRightIcon());
+ group2.toggle();
+ JQueryLocator input = pjq("select[id$=groupCollapsedRightIcon]");
+ ElementLocator<JQueryLocator> icon = group24.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group24.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testGroupDisabledLeftIcon() {
- attributes.setGroupDisabledLeftIcon(customURL);
- group2.toggle();
- assertTrue(group26.getLeftIcon().isCustomURL());
- assertTrue(group26.getLeftIcon().getCustomURL().endsWith(customURL));
- verifyIcon(group26.getLeftIcon());
+ group2.toggle();
+ JQueryLocator input = pjq("select[id$=groupDisabledLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group26.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group26.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testDisabledRightIcon() {
- attributes.setGroupDisabledRightIcon(customURL);
- group2.toggle();
- verifyIcon(group26.getRightIcon());
+ group2.toggle();
+ JQueryLocator input = pjq("select[id$=disabledRightIcon]");
+ ElementLocator<JQueryLocator> icon = group26.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group26.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testGroupExpandedLeftIcon() {
- attributes.setGroupExpandedLeftIcon(customURL);
group2.toggle();
- group24.toggle();
- verifyIcon(group24.getLeftIcon());
+ group24.toggle();
+ JQueryLocator input = pjq("select[id$=groupExpandedLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group24.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group24.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testGroupExpandedRightIcon() {
- attributes.setGroupExpandedRightIcon(customURL);
group2.toggle();
- group24.toggle();
- verifyIcon(group24.getRightIcon());
+ group24.toggle();
+ JQueryLocator input = pjq("select[id$=groupExpandedRightIcon]");
+ ElementLocator<JQueryLocator> icon = group24.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group24.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testItemDisabledLeftIcon() {
- attributes.setItemDisabledLeftIcon(customURL);
group2.toggle();
- verifyIcon(item25.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=itemDisabledLeftIcon]");
+ ElementLocator<JQueryLocator> icon = item25.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(item25.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testItemDisabledRightIcon() {
- attributes.setItemDisabledRightIcon(customURL);
group2.toggle();
- verifyIcon(item25.getRightIcon());
+ JQueryLocator input = pjq("select[id$=itemDisabledRightIcon]");
+ ElementLocator<JQueryLocator> icon = item25.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(item25.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testItemLeftIcon() {
- attributes.setItemLeftIcon(customURL);
group2.toggle();
- verifyIcon(item22.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=itemLeftIcon]");
+ ElementLocator<JQueryLocator> icon = item22.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(item22.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testItemRightIcon() {
- attributes.setItemRightIcon(customURL);
group2.toggle();
- verifyIcon(item22.getRightIcon());
+ JQueryLocator input = pjq("select[id$=itemRightIcon]");
+ ElementLocator<JQueryLocator> icon = item22.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(item22.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupCollapsedLeftIcon() {
- attributes.setTopGroupCollapsedLeftIcon(customURL);
- verifyIcon(group1.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topGroupCollapsedLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group1.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group1.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupCollapsedRightIcon() {
- attributes.setTopGroupCollapsedRightIcon(customURL);
- verifyIcon(group1.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topGroupCollapsedRightIcon]");
+ ElementLocator<JQueryLocator> icon = group1.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group1.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupDisabledLeftIcon() {
- attributes.setTopGroupDisabledLeftIcon(customURL);
- verifyIcon(group4.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topGroupDisabledLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group4.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group4.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupDisabledRightIcon() {
- attributes.setTopGroupDisabledRightIcon(customURL);
- verifyIcon(group4.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topGroupDisabledRightIcon]");
+ ElementLocator<JQueryLocator> icon = group4.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group4.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupExpandedLeftIcon() {
- attributes.setTopGroupExpandedLeftIcon(customURL);
group1.toggle();
- verifyIcon(group1.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topGroupExpandedLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group1.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group1.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupExpandedRightIcon() {
- attributes.setTopGroupExpandedRightIcon(customURL);
group1.toggle();
- verifyIcon(group1.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topGroupExpandedRightIcon]");
+ ElementLocator<JQueryLocator> icon = group1.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(group1.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopItemDisabledLeftIcon() {
- attributes.setTopItemDisabledLeftIcon(customURL);
- verifyIcon(item4.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topItemDisabledLeftIcon]");
+ ElementLocator<JQueryLocator> icon = item4.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(item4.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopItemDisabledRightIcon() {
- attributes.setTopItemDisabledRightIcon(customURL);
- verifyIcon(item4.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topItemDisabledRightIcon]");
+ ElementLocator<JQueryLocator> icon = item4.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(item4.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopItemLeftIcon() {
- attributes.setTopItemLeftIcon(customURL);
- verifyIcon(item3.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topItemLefttIconInput]");
+ ElementLocator<JQueryLocator> icon = item3.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(item3.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopItemRightIcon() {
- attributes.setTopItemRightIcon(customURL);
- verifyIcon(item3.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topItemRightIconInput]");
+ ElementLocator<JQueryLocator> icon = item3.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image =
jq(item3.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
- private void verifyIcon(Icon icon) {
- assertTrue(icon.isCustomURL());
- assertTrue(icon.getCustomURL().endsWith(customURL));
+ private void verifyStandardIcons(ElementLocator<JQueryLocator> input,
ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image,
String classSuffix) {
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-",
"");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix, false);
+ checker.checkNone(input, icon, classSuffix);
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuGroup/TestPanelMenuGroupSimple.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuGroup/TestPanelMenuGroupSimple.java 2011-09-19
17:04:58 UTC (rev 22726)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuGroup/TestPanelMenuGroupSimple.java 2011-09-19
17:09:40 UTC (rev 22727)
@@ -1,13 +1,17 @@
package org.richfaces.tests.metamer.ftest.richPanelMenuGroup;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import org.jboss.test.selenium.GuardRequest;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.request.RequestType;
import org.richfaces.PanelMenuMode;
-import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.testng.annotations.Test;
/**
@@ -60,39 +64,34 @@
@Test
public void testLeftDisabledIcon() {
- attributes.setLeftDisabledIcon(sampleImage);
-
- assertTrue(leftIcon.isTransparent());
- assertFalse(leftIcon.isCustomURL());
-
attributes.setDisabled(true);
-
- assertTrue(leftIcon.isCustomURL());
- assertTrue(leftIcon.getCustomURL().endsWith(sampleImage));
+ JQueryLocator input = pjq("select[id$=lefttDisabledIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testLeftCollapsedIcon() {
- attributes.setLeftCollapsedIcon(chevronDown);
-
topGroup.toggle();
+ JQueryLocator input = pjq("select[id$=leftCollapsedIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(leftIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
assertTrue(leftIcon.isTransparent());
}
@Test
public void testLeftExpandedIcon() {
- attributes.setLeftExpandedIcon(chevronDown);
+ JQueryLocator input = pjq("select[id$=leftExpandedIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(leftIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
- assertTrue(leftIcon.isTransparent());
+ assertTrue(rightIcon.isTransparent());
}
@Test
@@ -118,38 +117,33 @@
@Test
public void testRightDisabledIcon() {
- attributes.setRightDisabledIcon(sampleImage);
-
- assertTrue(rightIcon.isTransparent());
- assertFalse(rightIcon.isCustomURL());
-
attributes.setDisabled(true);
-
- assertTrue(rightIcon.isCustomURL());
- assertTrue(rightIcon.getCustomURL().endsWith(sampleImage));
+ JQueryLocator input = pjq("select[id$=rightDisabledIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testRightExpandedIcon() {
- attributes.setRightExpandedIcon(chevronDown);
+ JQueryLocator input = pjq("select[id$=rightExpandedIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(rightIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
assertTrue(rightIcon.isTransparent());
}
@Test
public void testRightCollapsedIcon() {
- attributes.setRightCollapsedIcon(chevronDown);
-
topGroup.toggle();
-
- assertTrue(rightIcon.containsClass(chevronDownClass));
-
+ JQueryLocator input = pjq("select[id$=rightCollapsedIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
+
attributes.setDisabled(true);
-
assertTrue(rightIcon.isTransparent());
}
@@ -176,13 +170,21 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10485")
public void testStyle() {
super.testStyle(topGroup, "style");
}
@Test
+ @RegressionTest("https://issues.jboss.org/browse/RF-10485")
public void testStyleClass() {
super.testStyleClass(topGroup, "styleClass");
}
+
+ private void verifyStandardIcons(ElementLocator<JQueryLocator> input,
ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image,
String classSuffix) {
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-",
"");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix, false);
+ checker.checkNone(input, icon, classSuffix);
+ }
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuItem/TestPanelMenuItemSimple.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuItem/TestPanelMenuItemSimple.java 2011-09-19
17:04:58 UTC (rev 22726)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuItem/TestPanelMenuItemSimple.java 2011-09-19
17:09:40 UTC (rev 22727)
@@ -1,5 +1,6 @@
package org.richfaces.tests.metamer.ftest.richPanelMenuItem;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -8,10 +9,14 @@
import java.net.URL;
import org.jboss.test.selenium.GuardRequest;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.request.RequestType;
import org.richfaces.PanelMenuMode;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.richfaces.tests.metamer.ftest.model.PanelMenu;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -83,25 +88,21 @@
@Test
public void testLeftDisabledIcon() {
- attributes.setLeftDisabledIcon(sampleImage);
-
- assertTrue(leftIcon.isTransparent());
- assertFalse(leftIcon.isCustomURL());
-
attributes.setDisabled(true);
-
- assertTrue(leftIcon.isCustomURL());
- assertTrue(leftIcon.getCustomURL().endsWith(sampleImage));
+ JQueryLocator input = pjq("select[id$=leftDisabledIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testLeftIcon() {
- attributes.setLeftIcon(chevronDown);
+ JQueryLocator input = pjq("select[id$=leftIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(leftIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
assertTrue(leftIcon.isTransparent());
}
@@ -133,31 +134,27 @@
@Test
public void testRightDisabledIcon() {
- attributes.setRightDisabledIcon(sampleImage);
-
- assertTrue(rightIcon.isTransparent());
- assertFalse(rightIcon.isCustomURL());
-
attributes.setDisabled(true);
-
- assertTrue(rightIcon.isCustomURL());
- assertTrue(rightIcon.getCustomURL().endsWith(sampleImage));
+ JQueryLocator input = pjq("select[id$=rightDisabledIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10519")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10519")
public void testRightIcon() {
- attributes.setRightIcon(chevronDown);
+ JQueryLocator input = pjq("select[id$=rightIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image =
jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(rightIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
assertTrue(rightIcon.isTransparent());
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10519")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10519")
public void testRightIconClass() {
super.testStyleClass(rightIcon, "rightIconClass");
}
@@ -204,4 +201,12 @@
public void testStyleClass() {
super.testStyleClass(item, "styleClass");
}
+
+ private void verifyStandardIcons(ElementLocator<JQueryLocator> input,
ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image,
String classSuffix) {
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-",
"");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix, false);
+ checker.checkNone(input, icon, classSuffix);
+ }
}