Author: lfryc(a)redhat.com
Date: 2010-01-18 11:36:28 -0500 (Mon, 18 Jan 2010)
New Revision: 16322
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractDataIterationTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/SeleniumLoggingTestListener.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/actionParameter/ActionParameterTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxForm/AjaxFormTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxRegion/AjaxRegionTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxSupport/AjaxSupportTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AbstractAjaxValidatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/colorPicker/ColorPickerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/columns/ColumnsTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/comboBox/ComboBoxTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandButton/CommandButtonTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandLink/CommandLinkTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuImageTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuTableTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataFilterSlider/DataFilterSliderTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataGrid/DataGridTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataList/DataListTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataScroller/DataScrollerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/DataTableTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/EditTableWithModalPanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/ExtendedDataModelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/ModifiableDataModelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dragSupport/DragSupportTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dropDownMenu/HorizontalMenuTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/AdvancedEditorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/SimpleEditorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/AbstractExtendedDataTableTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/FilteringTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/GroupingTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorAfterModelUpdateTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/include/IncludeTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceInput/InplaceInputTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceSelect/InplaceSelectTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inputNumberSlider/InputNumberSliderTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/jsFunction/JSFunctionTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/keepAlive/KeepAliveTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/listShuttle/ListShuttleTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/log/LogTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/mediaOutput/MediaOutputTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/modalPanel/ModalPanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/orderingList/OrderingListTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/outputPanel/OutputPanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/paint2d/Paint2DTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelCustomizationTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelBar/PanelBarTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelMenu/PanelMenuTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/pickList/PickListTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/progressBar/ProgressBarTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/push/PushTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueSettingsTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/repeat/RepeatTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/script/ScriptTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/separator/SeparatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spacer/SpacerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/stateManager/StateManagerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status/StatusTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/style/StyleTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tableFiltering/TableFilteringTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tableSorting/TableSortingTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/togglePanel/TogglePanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/toolBar/ToolBarTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipDataTableTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tree/TreeNodesAdaptorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tree/TreeTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dataTable/messages-DataTableTestCase.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/testng.xml
Log:
- Merge IE tests branch back to 3.3.X branch (RFPL-334, RFPL-69)
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml 2010-01-18
14:30:05 UTC (rev 16321)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml 2010-01-18
16:36:28 UTC (rev 16322)
@@ -549,7 +549,7 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>5.8</version>
+ <version>5.9</version>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractDataIterationTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractDataIterationTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractDataIterationTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -30,7 +30,7 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class AbstractDataIterationTestCase extends AbstractSeleniumRichfacesTestCase {
+public abstract class AbstractDataIterationTestCase extends
AbstractSeleniumRichfacesTestCase {
protected final String LOC_TABLE_COMMON = getLoc("data-table-common--table");
protected final String LOC_BUTTON_FIRST_PAGE =
getLoc("data-scroller--button--first-page");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -29,21 +29,22 @@
import java.util.Properties;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
import org.jboss.test.selenium.AbstractSeleniumTestCase;
import org.jboss.test.selenium.waiting.Condition;
import org.jboss.test.selenium.waiting.Wait;
import org.jboss.test.selenium.waiting.Wait.Waiting;
import org.testng.ITestContext;
+import org.testng.SkipException;
import org.testng.TestRunner;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
-import com.thoughtworks.selenium.DefaultSelenium;
-
/**
*
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>, <a
@@ -52,7 +53,7 @@
*
*/
-public class AbstractSeleniumRichfacesTestCase extends AbstractSeleniumTestCase {
+public abstract class AbstractSeleniumRichfacesTestCase extends AbstractSeleniumTestCase
{
/**
* context root can be used to obtaining full URL paths, is set to actual
@@ -72,6 +73,7 @@
protected String mavenProjectBuildDirectory; // usually ${project}/target
protected String mavenResourcesDir; // usually ${project}/target/test-classes
protected boolean seleniumDebug; // if used specified debug mode of selenium
testing
+ protected String browser;
/**
* predefined waitings to use in inheritors
@@ -96,6 +98,19 @@
runner.addTestListener(loggingTestListener);
}
+ @BeforeClass
+ @Parameters( { "context.root", "context.path", "browser",
"selenium.host", "selenium.port", "selenium.debug",
+ "selenium.maximize", "maven.resources.dir",
"maven.project.build.directory" })
+ public void initializeParameters(String contextRoot, String contextPath, String browser,
String seleniumDebug,
+ String mavenResourcesDir, String mavenProjectBuildDirectory) {
+ this.contextRoot = contextRoot;
+ this.contextPath = contextPath;
+ this.mavenResourcesDir = mavenResourcesDir;
+ this.mavenProjectBuildDirectory = mavenProjectBuildDirectory;
+ this.seleniumDebug = Boolean.valueOf(seleniumDebug);
+ this.browser = browser;
+ }
+
/**
* Initializes context before each class run.
*
@@ -111,19 +126,10 @@
* @param seleniumPort
* specifies on which port should selenium server run
*/
- @BeforeClass
- @Parameters( { "context.root", "context.path", "browser",
"selenium.host", "selenium.port", "selenium.debug",
- "selenium.maximize", "maven.resources.dir",
"maven.project.build.directory" })
- public void initializeContext(String contextRoot, String contextPath, String browser,
String seleniumHost,
- String seleniumPort, String seleniumDebug, String seleniumMaximize, String
mavenResourcesDir,
- String mavenProjectBuildDirectory) {
- this.contextRoot = contextRoot;
- this.contextPath = contextPath;
- this.mavenResourcesDir = mavenResourcesDir;
- this.mavenProjectBuildDirectory = mavenProjectBuildDirectory;
- this.seleniumDebug = Boolean.valueOf(seleniumDebug);
-
- selenium = new DefaultSelenium(seleniumHost, Integer.valueOf(seleniumPort), browser,
contextRoot);
+ @BeforeClass(dependsOnMethods = { "initializeParameters",
"isTestBrowserEnabled" })
+ @Parameters( { "selenium.host", "selenium.port",
"selenium.maximize" })
+ public void initializeBrowser(String seleniumHost, String seleniumPort, String
seleniumMaximize) {
+ selenium = RichfacesSelenium.getInstance(seleniumHost, Integer.valueOf(seleniumPort),
browser, contextRoot);
selenium.start();
allowInitialXpath();
loadCustomLocationStrategies();
@@ -164,14 +170,58 @@
* Finalize context after each class run.
*/
@AfterClass
- public void finalizeContext() {
+ public void finalizeBrowser() {
loggingTestListener.setSelenium(null);
selenium.close();
selenium.stop();
selenium = null;
- contextPath = null;
}
+ @Parameters( { "internet-explorer-enabled", "firefox-enabled" })
+ @BeforeClass(dependsOnMethods="initializeParameters")
+ public void isTestBrowserEnabled(@Optional("true") String
internetExplorerEnabled, @Optional("true") String firefoxEnabled) {
+ boolean isTestBrowserEnabled = false;
+
+ if (Boolean.valueOf(internetExplorerEnabled) && browserIsInternetExplorer()) {
+ isTestBrowserEnabled = true;
+ }
+
+ if (Boolean.valueOf(firefoxEnabled) && browserIsFirefox()) {
+ isTestBrowserEnabled = true;
+ }
+
+ if (!isTestBrowserEnabled) {
+ throw new SkipException("The test isn't enabled for current browser");
+ }
+ }
+
+ @BeforeMethod(alwaysRun = true)
+ public void callLoadPage() {
+ loadPage();
+ }
+
+ protected abstract void loadPage();
+
+ private final String[] INTERNET_EXPLORER_PREFIXES = new String[] {
"*iexplore", "*piiexplore", "*iehta" };
+ private final String[] FIREFOX_PREFIXES = new String[] { "*firefox",
"*pifirefox", "*chrome" };
+
+ public boolean browserIsInternetExplorer() {
+ return containsBrowserOneOfPrefixes(browser, INTERNET_EXPLORER_PREFIXES);
+ }
+
+ public boolean browserIsFirefox() {
+ return containsBrowserOneOfPrefixes(browser, FIREFOX_PREFIXES);
+ }
+
+ private boolean containsBrowserOneOfPrefixes(String browser, String[] prefixes) {
+ for (String prefix : prefixes) {
+ if (StringUtils.defaultString(browser).startsWith(prefix)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Default implementation of obtaining properties for each class.
*
@@ -181,7 +231,7 @@
protected Properties getLocatorsProperties() {
return getNamedPropertiesForClass(this.getClass(), "locators");
}
-
+
/**
* Default implementation of obtaining properties for each class.
*
@@ -254,37 +304,37 @@
* name of component given from components' menu on the left of
* RF Live Demo application
*/
- protected void openComponent(final String componentName) {
+ protected void openComponent(final String componentName) {
final String LOC_MENU_ITEM = format("jquery=table.left_menu td.text a >
span:textEquals('{0}')", componentName);
// TODO needs to open clean page, see {@link
- //
https://jira.jboss.org/jira/browse/RF-7640}
- selenium.getEval("selenium.doDeleteAllVisibleCookies()");
+ //
https://jira.jboss.org/jira/browse/RF-7640}
+ selenium.getEval("selenium.doDeleteAllVisibleCookies()");
- // open context path of application
+ // open context path of application
selenium.open(contextPath);
- // wait for new page is opened
- selenium.waitForPageToLoad("5000");
+ // wait for new page is opened
+ selenium.waitForPageToLoad("5000");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return selenium.isElementPresent(LOC_MENU_ITEM);
- }
- });
-
- // click the menu item
- selenium.click(LOC_MENU_ITEM);
+ Wait.until(new Condition() {
+ public boolean isTrue() {
+ return selenium.isElementPresent(LOC_MENU_ITEM);
+ }
+ });
- // wait for component's page opened
- waitModelUpdate.until(new Condition() {
- public boolean isTrue() {
- return isComponentPageActive(componentName);
- }
- });
- }
+ // click the menu item
+ selenium.click(LOC_MENU_ITEM);
+ // wait for component's page opened
+ waitModelUpdate.until(new Condition() {
+ public boolean isTrue() {
+ return isComponentPageActive(componentName);
+ }
+ });
+ }
+
private boolean isComponentPageActive(String componentName) {
final String LOC_OUTPUT_COMPONENT_NAME = "jquery=body table.left_menu
*.panel_documents strong";
return componentName.equals(getTextOrNull(LOC_OUTPUT_COMPONENT_NAME));
Copied:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java
(from rev 16320,
branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java)
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -0,0 +1,88 @@
+package org.jboss.richfaces.integrationTest;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.jboss.test.selenium.waiting.Retrieve;
+import org.jboss.test.selenium.waiting.Wait;
+
+import com.thoughtworks.selenium.CommandProcessor;
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.HttpCommandProcessor;
+import com.thoughtworks.selenium.SeleniumException;
+
+public class RichfacesSelenium extends DefaultSelenium {
+
+ public RichfacesSelenium(CommandProcessor processor) {
+ super(processor);
+ }
+
+ public static RichfacesSelenium getInstance(String serverHost, int serverPort, String
browserStartCommand,
+ String browserURL) {
+ return new RichfacesSelenium(new RichfacesCommandProcessor(serverHost, serverPort,
browserStartCommand,
+ browserURL));
+ }
+
+ public static class RichfacesCommandProcessor extends HttpCommandProcessor {
+ public RichfacesCommandProcessor(String serverHost, int serverPort, String
browserStartCommand,
+ String browserURL) {
+ super(serverHost, serverPort, browserStartCommand, browserURL);
+ }
+
+ private abstract class AjaxCommand<T> {
+ public abstract T command();
+ }
+
+ private static String[] PERMISSION_DENIED = new String[] {
+ "ERROR: Threw an exception: Error executing strategy function jquery: Permission
denied",
+ "ERROR: Threw an exception: Permission denied",
+ "ERROR: Threw an exception: Object doesn't support this property or
method",
+ "ERROR: Command execution failure. Please search the forum at
http://clearspace.openqa.org for error details from the log window. The error message is:
Permission denied",
+ "ERROR: Threw an exception: null property value" };
+
+ private <T> T doAjax(final AjaxCommand<T> ajaxCommand) {
+ final AssertionError fail = new AssertionError("Fails with Permission denied when
trying to execute jQuery");
+
+ final T start = null;
+ return
Wait.noDelay().timeout(Wait.DEFAULT_TIMEOUT).interval(1000).failWith(fail).waitForChangeAndReturn(start,
+ new Retrieve<T>() {
+ boolean exceptionLogged = false;
+
+ public T retrieve() {
+ try {
+ return ajaxCommand.command();
+ } catch (SeleniumException e) {
+ final String message = StringUtils.defaultString(e.getMessage());
+ if (ArrayUtils.contains(PERMISSION_DENIED, message)) {
+ System.err.println(message);
+ if (!exceptionLogged) {
+ exceptionLogged = true;
+ System.err.println(ajaxCommand);
+ e.printStackTrace();
+ } else {
+ }
+ return null;
+ }
+
+ throw e;
+ }
+ }
+ });
+ }
+
+ @Override
+ public String doCommand(final String commandName, final String[] args) {
+ return doAjax(new AjaxCommand<String>() {
+ @Override
+ public String command() {
+ return RichfacesCommandProcessor.super.doCommand(commandName, args);
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("commandName",
commandName).append("args", args).toString();
+ }
+ });
+ }
+ }
+}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/SeleniumLoggingTestListener.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/SeleniumLoggingTestListener.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/SeleniumLoggingTestListener.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -97,7 +97,12 @@
if (selenium != null) {
String eval = String.format("/*\n%s\n%s\n%s\n*/", line, message, line);
- selenium.getEval(eval);
+ try {
+ selenium.selectFrame("relative=top");
+ selenium.getEval(eval);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/actionParameter/ActionParameterTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/actionParameter/ActionParameterTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/actionParameter/ActionParameterTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -137,9 +137,7 @@
/**
* Loads a specific component's page
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Action Parameter");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxForm/AjaxFormTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxForm/AjaxFormTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxForm/AjaxFormTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -100,9 +100,7 @@
/**
* Opens specific component's page
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Ajax Form");
scrollIntoView(LOC_LEGEND_HEADER, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxRegion/AjaxRegionTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxRegion/AjaxRegionTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxRegion/AjaxRegionTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -223,9 +223,7 @@
/**
* Opens specific component's page
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Ajax Region");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxSupport/AjaxSupportTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxSupport/AjaxSupportTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxSupport/AjaxSupportTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -81,9 +81,7 @@
waitForTextEquals(LOC_INPUT_TEXT, "");
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Ajax Support");
scrollIntoView(LOC_INPUT_TEXT, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AbstractAjaxValidatorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AbstractAjaxValidatorTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AbstractAjaxValidatorTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -36,7 +36,6 @@
/**
* Opens specified component's page before each test method
*/
- @BeforeMethod
protected void loadPage() {
openComponent("Ajax Validator");
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -227,9 +227,7 @@
return format(LOC_VALIDATION_MESSAGE_RELATIVE, locator);
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Bean Validator");
scrollIntoView(LOC_FIELDSET_HEADER, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -87,9 +87,7 @@
/**
* Loads the page containing the calendar component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Calendar");
openTab("Client Side Disable/Styling");
scrollIntoView(LOC_STYLING_FIELDSET, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -360,9 +360,7 @@
/**
* Loads the page containing the calendar component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Calendar");
scrollIntoView(LOC_CALENDAR_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -270,9 +270,7 @@
/**
* Loads the page containing the calendar component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Calendar");
openTab("Organizer Creation");
scrollIntoView(LOC_FIELDSET, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/colorPicker/ColorPickerTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/colorPicker/ColorPickerTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/colorPicker/ColorPickerTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -39,6 +39,8 @@
import javax.imageio.ImageIO;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import static org.jboss.test.selenium.utils.ColorUtils.convertToAWTColor;
+import org.jboss.test.selenium.utils.URLUtils;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -128,22 +130,16 @@
@Test
public void testInitialState() {
// get color from the input field
- Color inputColor = createColor(selenium.getValue(LOC_COLOR_INPUT).substring(1));
+ Color inputColor = convertToAWTColor(selenium.getValue(LOC_COLOR_INPUT));
Map<Color, Integer> histogram = getHistogram();
assertTrue(histogram.containsKey(inputColor),
"Image should have the same color as the one defined in input
field.");
// get color of the button
- String attr = getStyle(LOC_COLOR_BUTTON,
"background-color").replace("rgb(",
"").replace(")", "");
+ Color colorButton = convertToAWTColor(getStyle(LOC_COLOR_BUTTON,
"background-color"));
- int[] values = new int[3];
- for (int i = 0; i < 3; i++) {
- values[i] = Integer.parseInt(attr.split(",")[i].trim());
- }
-
- assertTrue(histogram.containsKey(new Color(values[0], values[1], values[2])),
- "Image should have the same color as the button.");
+ assertTrue(histogram.containsKey(colorButton), "Image should have the same
color as the button.");
}
/**
@@ -158,7 +154,7 @@
waitFor(1500);
Map<Color, Integer> histogram = getHistogram();
- Color inputColor = createColor(selenium.getValue(LOC_COLOR_INPUT).substring(1));
+ Color inputColor = convertToAWTColor(selenium.getValue(LOC_COLOR_INPUT));
assertTrue(histogram.containsKey(inputColor),
"Image should have the same color as the one defined in input
field.");
@@ -358,7 +354,7 @@
*/
@Test
public void testCancelButton() {
- Color original = createColor(selenium.getValue(LOC_COLOR_INPUT).substring(1));
+ Color original = convertToAWTColor(selenium.getValue(LOC_COLOR_INPUT));
selenium.click(LOC_COLOR_BUTTON);
selenium.type(LOC_RED_VALUE, "100");
@@ -366,7 +362,7 @@
selenium.type(LOC_BLUE_VALUE, "100");
selenium.click(LOC_CANCEL_BUTTON);
- Color newColor = createColor(selenium.getValue(LOC_COLOR_INPUT).substring(1));
+ Color newColor = convertToAWTColor(selenium.getValue(LOC_COLOR_INPUT));
assertEquals(newColor, original, "Color in input should not change after
clicking on \"Cancel\"");
Map<Color, Integer> histogram = getHistogram();
@@ -444,30 +440,18 @@
*/
@Test
public void testLeftColorBox() {
- String attr = getStyle(LOC_CURRENT_COLOR_BOX,
"background-color").replace("rgb(",
"").replace(")", "");
+ Color leftBoxColor = convertToAWTColor(getStyle(LOC_CURRENT_COLOR_BOX,
"background-color"));
+ Color expectedColor = convertToAWTColor("#" +
selenium.getValue(LOC_HEX_COLOR));
- int red = Integer.parseInt(attr.split(",")[0].trim());
- int green = Integer.parseInt(attr.split(",")[1].trim());
- int blue = Integer.parseInt(attr.split(",")[2].trim());
-
- Color leftBoxColor = new Color(red, green, blue);
- Color expectedColor = createColor(selenium.getValue(LOC_HEX_COLOR));
-
assertEquals(leftBoxColor, expectedColor, "At the beginning box should be of
color from input field.");
selenium.type(LOC_RED_VALUE, "100");
selenium.type(LOC_GREEN_VALUE, "100");
selenium.type(LOC_BLUE_VALUE, "100");
- attr = getStyle(LOC_CURRENT_COLOR_BOX,
"background-color").replace("rgb(",
"").replace(")", "");
+ leftBoxColor = convertToAWTColor(getStyle(LOC_CURRENT_COLOR_BOX,
"background-color"));
+ expectedColor = convertToAWTColor("#" +
selenium.getValue(LOC_HEX_COLOR));
- red = Integer.parseInt(attr.split(",")[0].trim());
- green = Integer.parseInt(attr.split(",")[1].trim());
- blue = Integer.parseInt(attr.split(",")[2].trim());
-
- leftBoxColor = new Color(red, green, blue);
- expectedColor = createColor(selenium.getValue(LOC_HEX_COLOR));
-
assertEquals(leftBoxColor, expectedColor, "Color of the box should change
afted a color was chosen.");
}
@@ -477,30 +461,18 @@
*/
@Test
public void testRightColorBox() {
- String attr = getStyle(LOC_ORIGINAL_COLOR_BOX,
"background-color").replace("rgb(",
"").replace(")", "");
+ Color rightBoxColor = convertToAWTColor(getStyle(LOC_ORIGINAL_COLOR_BOX,
"background-color"));
+ Color expectedColor = convertToAWTColor("#" +
selenium.getValue(LOC_HEX_COLOR));
- int red = Integer.parseInt(attr.split(",")[0].trim());
- int green = Integer.parseInt(attr.split(",")[1].trim());
- int blue = Integer.parseInt(attr.split(",")[2].trim());
-
- Color rightBoxColor = new Color(red, green, blue);
- Color expectedColor = createColor(selenium.getValue(LOC_HEX_COLOR));
-
assertEquals(rightBoxColor, expectedColor, "At the beginning box should be
of color from input field.");
selenium.type(LOC_RED_VALUE, "100");
selenium.type(LOC_GREEN_VALUE, "100");
selenium.type(LOC_BLUE_VALUE, "100");
- attr = getStyle(LOC_ORIGINAL_COLOR_BOX,
"background-color").replace("rgb(",
"").replace(")", "");
+ rightBoxColor = convertToAWTColor(getStyle(LOC_ORIGINAL_COLOR_BOX,
"background-color"));
+ expectedColor = convertToAWTColor("#" +
selenium.getValue(LOC_HEX_COLOR));
- red = Integer.parseInt(attr.split(",")[0].trim());
- green = Integer.parseInt(attr.split(",")[1].trim());
- blue = Integer.parseInt(attr.split(",")[2].trim());
-
- rightBoxColor = new Color(red, green, blue);
- expectedColor = createColor(selenium.getValue(LOC_HEX_COLOR));
-
assertNotSame(rightBoxColor, expectedColor, "Color of the box should change
afted a color was chosen.");
}
@@ -527,10 +499,15 @@
* that color
*/
private Map<Color, Integer> getHistogram() {
- String url = selenium.getAttribute(LOC_IMAGE + "@src");
- // the index of first '/' not counting http://
- int index = selenium.getLocation().indexOf('/', 7);
- url = selenium.getLocation().substring(0, index) + url;
+ final String src = selenium.getAttribute(LOC_IMAGE + "@src");
+ final String location = selenium.getLocation();
+ String url = null;
+ try {
+ url = URLUtils.buildUrl(location, src);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ fail(format("Could not build an URL from location '{0}' and src
'{1}'", location, src));
+ }
BufferedImage image = null;
try {
@@ -571,32 +548,9 @@
}
/**
- * Creates a Color object from the string. The string has to contain
- * hexadecimal representation of an RGB color without leading hash
- * character, e.g. ffffff, 0ab3c4.
- *
- * @param color
- * hexadecimal representation of an RGB color
- * @return a Color object
- */
- private Color createColor(String color) {
- if (color.length() != 6) {
- throw new IllegalArgumentException("color");
- }
-
- int red = Integer.parseInt(color.substring(0, 2), 16);
- int green = Integer.parseInt(color.substring(2, 4), 16);
- int blue = Integer.parseInt(color.substring(4, 6), 16);
-
- return new Color(red, green, blue);
- }
-
- /**
* Loads the page containing the color picker component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Color Picker");
scrollIntoView(LOC_COMPONENT_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/columns/ColumnsTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/columns/ColumnsTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/columns/ColumnsTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -149,9 +149,7 @@
});
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Columns");
scrollIntoView(LOC_TABLE, true);
selenium.allowNativeXpath("true");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/comboBox/ComboBoxTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/comboBox/ComboBoxTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/comboBox/ComboBoxTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -27,6 +27,7 @@
import static org.testng.Assert.assertEqualsNoOrder;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.jboss.test.selenium.dom.Event;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -105,32 +106,39 @@
selenium.click(LOC_FIRST_COMBO_BUTTON);
waitForElement(format(LOC_FIRST_COMBO_SUGGESTIONS, 0));
int count = getJQueryCount(format(LOC_FIRST_COMBO_SUGGESTIONS,-1));
- assertEquals(count, MSG_SUGGESTIONS_FIRST_COMBO_COUNT_1, "Number of
suggestions after after clicking on button.");
+ assertEquals(count, MSG_SUGGESTIONS_FIRST_COMBO_COUNT_1, "Number of
suggestions after clicking on button.");
- selenium.click(LOC_FIRST_COMBO_INPUT);
- selenium.typeKeys(LOC_FIRST_COMBO_INPUT, "su");
- selenium.typeKeys(LOC_FIRST_COMBO_INPUT, " ");
+ // verify selecting item by mouse
+ try {
+ selenium.clickAt(format(LOC_FIRST_COMBO_SUGGESTIONS, 2), "");
+ } catch (Exception ex) {
+ // TODO: why the exception is thrown?
+ }
+ waitFor(1000);
+ String text = selenium.getValue(LOC_FIRST_COMBO_INPUT);
+ assertEquals(text, MSG_SUGGESTIONS_FIRST_COMBO_INPUT, "Third suggestion was
chosen.");
+
+ // verify filtering
+ selenium.type(LOC_FIRST_COMBO_INPUT, "suggestion ");
+ selenium.fireEvent(LOC_FIRST_COMBO_INPUT, Event.KEYUP);
count = getJQueryCount(format(LOC_FIRST_COMBO_SUGGESTIONS, -1));
- assertEquals(count, MSG_SUGGESTIONS_FIRST_COMBO_COUNT_2, "Number of
suggestions after typing 'su'.");
+ assertEquals(count, MSG_SUGGESTIONS_FIRST_COMBO_COUNT_1, "Number of
suggestions after typing 'sugestion '.");
+
+ selenium.type(LOC_FIRST_COMBO_INPUT, "suggestion 1");
+ selenium.fireEvent(LOC_FIRST_COMBO_INPUT, Event.KEYUP);
- String[] suggestions = new String[5];
- for (int i = 0; i < 5; i++) {
+ count = getJQueryCount(format(LOC_FIRST_COMBO_SUGGESTIONS, -1));
+ assertEquals(count, MSG_SUGGESTIONS_FIRST_COMBO_COUNT_2, "Number of
suggestions after typing 'suggestion 1'.");
+
+ String[] suggestions = new String[count];
+ for (int i = 0; i < count; i++) {
suggestions[i] = selenium.getText(format(LOC_FIRST_COMBO_SUGGESTIONS, i));
}
- String[] expected = new String[] { "suggestion 1", "suggestion
2", "suggestion 3", "suggestion 4", "suggestion 5", };
+ String[] expected = new String[] { "suggestion 1" };
- assertEqualsNoOrder(suggestions, expected, "Suggestions after typing
'sa'.");
-
- try {
- selenium.clickAt(format(LOC_FIRST_COMBO_SUGGESTIONS, 2), "");
- } catch (Exception ex) {
- // why the exception is thrown?
- }
- waitFor(1000);
- String text = selenium.getValue(LOC_FIRST_COMBO_INPUT);
- assertEquals(text, MSG_SUGGESTIONS_FIRST_COMBO_INPUT, "Third suggestion was
chosen.");
+ assertEqualsNoOrder(suggestions, expected, "Suggestions after typing
'suggestion 1'.");
}
/**
@@ -149,8 +157,8 @@
assertEquals(count, MSG_SUGGESTIONS_SECOND_COMBO_COUNT_1, "Number of
suggestions after after clicking on button.");
selenium.click(LOC_SECOND_COMBO_INPUT);
- selenium.typeKeys(LOC_SECOND_COMBO_INPUT, "sa");
- selenium.typeKeys(LOC_SECOND_COMBO_INPUT, " ");
+ selenium.type(LOC_SECOND_COMBO_INPUT, "sa");
+ selenium.fireEvent(LOC_SECOND_COMBO_INPUT, Event.KEYUP);
count = getJQueryCount(format(LOC_SECOND_COMBO_SUGGESTIONS, -1));
assertEquals(count, MSG_SUGGESTIONS_SECOND_COMBO_COUNT_2, "Number of
suggestions after typing 'sa'.");
@@ -167,7 +175,7 @@
try {
selenium.clickAt(format(LOC_SECOND_COMBO_SUGGESTIONS, 2), "");
} catch (Exception ex) {
- // why the exception is thrown?
+ // TODO: why the exception is thrown?
}
waitFor(1000);
@@ -190,8 +198,8 @@
assertEquals(count, MSG_SUGGESTIONS_THIRD_COMBO_COUNT_1, "Number of
suggestions after after clicking on button.");
selenium.click(LOC_THIRD_COMBO_INPUT);
- selenium.typeKeys(LOC_THIRD_COMBO_INPUT, "sa");
- selenium.typeKeys(LOC_THIRD_COMBO_INPUT, " ");
+ selenium.type(LOC_THIRD_COMBO_INPUT, "sa");
+ selenium.fireEvent(LOC_THIRD_COMBO_INPUT, Event.KEYUP);
count = getJQueryCount(format(LOC_THIRD_COMBO_SUGGESTIONS, -1));
assertEquals(count, MSG_SUGGESTIONS_THIRD_COMBO_COUNT_2, "Number of
suggestions after typing 'sa'.");
@@ -208,7 +216,7 @@
try {
selenium.clickAt(format(LOC_THIRD_COMBO_SUGGESTIONS, 3), "");
} catch (Exception ex) {
- // why the exception is thrown?
+ // TODO: why the exception is thrown?
}
waitFor(1000);
@@ -268,9 +276,7 @@
/**
* Loads the page containing the calendar component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Combo Box");
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandButton/CommandButtonTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandButton/CommandButtonTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandButton/CommandButtonTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -87,9 +87,7 @@
waitForTextEquals(LOC_OUTPUT_TEXT, expectedOutputText);
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Command Button");
scrollIntoView(LOC_BUTTON_SAY_HELLO, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandLink/CommandLinkTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandLink/CommandLinkTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandLink/CommandLinkTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -87,9 +87,7 @@
waitForTextEquals(LOC_OUTPUT_TEXT, expectedOutputText);
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Command Link");
scrollIntoView(LOC_LINK_SAY_HELLO, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuImageTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuImageTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuImageTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -171,9 +171,7 @@
/**
* Loads the needed page.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Context Menu");
// XXX: context menu opens in top left corner so it isn't visible if it
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuTableTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuTableTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuTableTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -205,9 +205,7 @@
/**
* Loads the needed page.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Context Menu");
scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataFilterSlider/DataFilterSliderTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataFilterSlider/DataFilterSliderTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataFilterSlider/DataFilterSliderTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -179,7 +179,7 @@
waitTableTextStabilizes.until(conditionTableTextStabilizes);
}
- private Waiting waitTableTextStabilizes =
Wait.interval(100).timeout(10000).failWith("Table text never got stabilized");
+ private Waiting waitTableTextStabilizes =
Wait.interval(1000).timeout(15000).failWith("Table text never got stabilized");
private Condition conditionTableTextStabilizes = new Condition() {
String memory;
@@ -199,7 +199,7 @@
count = 0;
}
- if (count >= 10) {
+ if (count >= 3) {
return true;
}
@@ -209,9 +209,7 @@
}
};
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Data Filter Slider");
scrollIntoView(LOC_FIELDSET_HEADER, true);
selenium.allowNativeXpath("true");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataGrid/DataGridTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataGrid/DataGridTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataGrid/DataGridTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -84,9 +84,7 @@
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Data Grid");
scrollIntoView(LOC_TABLE_COMMON, true);
selenium.allowNativeXpath("true");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataList/DataListTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataList/DataListTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataList/DataListTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -48,9 +48,7 @@
MSG_OUTPUT_PRESENT_TEXT_2));
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Data List");
scrollIntoView(LOC_FIELDSET_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataScroller/DataScrollerTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataScroller/DataScrollerTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataScroller/DataScrollerTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -215,9 +215,7 @@
return tableText;
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Data Scroller");
scrollIntoView(LOC_FIELDSET_HEADER, true);
selenium.allowNativeXpath("true");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/DataTableTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/DataTableTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/DataTableTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -23,6 +23,7 @@
import static org.testng.Assert.*;
+import org.apache.commons.lang.StringUtils;
import org.jboss.richfaces.integrationTest.AbstractDataIterationTestCase;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -47,12 +48,12 @@
openTab(MSG_TAB_TO_OPEN);
scrollIntoView(LOC_FIELDSET_HEADER, true);
- assertEquals(selenium.getText(LOC_TABLE), MSG_TABLE_TEXT_CONTENT, "Table
doesn't contain expected text");
+ String tableText = selenium.getText(LOC_TABLE);
+ tableText = StringUtils.deleteWhitespace(tableText);
+ assertEquals(tableText, MSG_TABLE_TEXT_CONTENT, "Table doesn't contain
expected text");
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Data Table");
openTab("Usage");
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/EditTableWithModalPanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/EditTableWithModalPanelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/EditTableWithModalPanelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -188,9 +188,7 @@
});
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Data Table");
openTab(MSG_TAB_TO_OPEN);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/ExtendedDataModelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/ExtendedDataModelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/ExtendedDataModelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -116,9 +116,7 @@
assertEquals(yourBid, highestBidString);
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Data Table");
openTab(MSG_TAB_TO_OPEN);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/ModifiableDataModelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/ModifiableDataModelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/ModifiableDataModelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -125,9 +125,7 @@
assertTrue(assigneeName.contains(MSG_INPUT_ASSIGNEE));
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Data Table");
openTab(MSG_TAB_TO_OPEN);
scrollIntoView(LOC_TABLE_COMMON, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dragSupport/DragSupportTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dragSupport/DragSupportTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dragSupport/DragSupportTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -227,9 +227,7 @@
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Drag Support");
scrollIntoView(LOC_FIELDSET_HEADER, true);
selenium.allowNativeXpath("true");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dropDownMenu/HorizontalMenuTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dropDownMenu/HorizontalMenuTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dropDownMenu/HorizontalMenuTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -158,9 +158,7 @@
/**
* Loads the page containing needed component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Drop Down Menu");
scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/AdvancedEditorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/AdvancedEditorTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/AdvancedEditorTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -840,9 +840,7 @@
/**
* Loads the page containing the calendar component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Editor");
// wait for iframe to load
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/SimpleEditorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/SimpleEditorTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/SimpleEditorTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -348,9 +348,7 @@
/**
* Loads the page containing needed component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Editor");
// wait for iframe to load
waitFor(1000);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/AbstractExtendedDataTableTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/AbstractExtendedDataTableTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/AbstractExtendedDataTableTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -21,9 +21,12 @@
*******************************************************************************/
package org.jboss.richfaces.integrationTest.extendedDataTable;
+import org.apache.commons.lang.StringUtils;
import org.jboss.richfaces.integrationTest.AbstractDataIterationTestCase;
import org.jboss.test.selenium.waiting.Condition;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Parameters;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -47,7 +50,6 @@
private final String MSG_OPTION_SELECTION_MODE_PREFORMATTED =
getMsg("OPTION_SELECTION_MODE_PREFORMATTED");
- @BeforeMethod
protected void loadPage() {
openComponent("Extended Data Table");
openTab("Usage");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/FilteringTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/FilteringTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/FilteringTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -21,7 +21,7 @@
*******************************************************************************/
package org.jboss.richfaces.integrationTest.extendedDataTable;
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertTrue;
import org.apache.commons.lang.StringUtils;
import org.jboss.test.selenium.dom.Event;
@@ -79,6 +79,10 @@
int rows = getJQueryCount(format(cellsState, 0));
for (int row = 1; row <= rows; row++) {
+ if (row == 1 && browserIsInternetExplorer()) {
+ continue;
+ }
+
if (statePrefix.length() > 0) {
String state = selenium.getText(format(cellsState, row));
assertTrue(state.startsWith(statePrefix), format("'{0}' doesn't
start with prefix '{1}'", state,
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/GroupingTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/GroupingTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/GroupingTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -58,6 +58,10 @@
String expectedGroup = null;
for (int row = 1; row <= rows; row++) {
+ if (row == 1 && browserIsInternetExplorer()) {
+ continue;
+ }
+
if (belongsClass(MSG_TR_CLASS, format(LOC_TR_PREFORMATTED, row))) {
// table row is type group
expectedGroup = selenium.getText(format(LOC_TD_GROUP_PREFORMATTED,
row)).replace("State Name: ", "").replace("(1)",
"");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -523,16 +523,16 @@
return new Color(red, green, blue);
}
- @SuppressWarnings("unused")
- @BeforeClass
- private void createImages() {
- createImage(Color.RED, 128, 128);
- createImage(Color.BLUE, 128, 128);
- createImage(Color.CYAN, 128, 128);
- createImage(Color.YELLOW, 128, 128);
- createImage(Color.ORANGE, 128, 128);
- createImage(Color.GREEN, 2000, 3500);
- }
+ @SuppressWarnings("unused")
+ @BeforeClass(dependsOnMethods = "initializeBrowser")
+ private void createImages() {
+ createImage(Color.RED, 128, 128);
+ createImage(Color.BLUE, 128, 128);
+ createImage(Color.CYAN, 128, 128);
+ createImage(Color.YELLOW, 128, 128);
+ createImage(Color.ORANGE, 128, 128);
+ createImage(Color.GREEN, 2000, 3500);
+ }
@SuppressWarnings("unused")
@AfterClass
@@ -547,9 +547,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("File Upload");
openTab("Usage");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorAfterModelUpdateTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorAfterModelUpdateTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorAfterModelUpdateTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -117,9 +117,7 @@
assertEquals(selenium.getText(LOC_OUTPUT_VALIDATION_MESSAGE), text, "Given
validation message isn't expected");
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Graph Validator");
scrollIntoView(LOC_FIELDSET_HEADER_ACTIVITIES, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -227,9 +227,7 @@
return format(LOC_VALIDATION_MESSAGE_RELATIVE, locator);
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Graph Validator");
scrollIntoView(LOC_FIELDSET_HEADER_USEF_INFO, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/include/IncludeTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/include/IncludeTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/include/IncludeTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -207,9 +207,7 @@
&& (nextPresent == selenium.isElementPresent(LOC_BUTTON_NEXT));
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Include");
scrollIntoView(LOC_FIELDSET_HEADER, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceInput/InplaceInputTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceInput/InplaceInputTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceInput/InplaceInputTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -289,9 +289,7 @@
/**
* Loads the page containing needed component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Inplace Input");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceSelect/InplaceSelectTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceSelect/InplaceSelectTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceSelect/InplaceSelectTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -260,9 +260,7 @@
/**
* Loads the page containing the calendar component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Inplace Select");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inputNumberSlider/InputNumberSliderTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inputNumberSlider/InputNumberSliderTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inputNumberSlider/InputNumberSliderTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -79,16 +79,16 @@
*/
@Test
public void testFirstSliderMouse() {
- assertTrue(Math.abs(getOffset(LOC_FIRST_HANDLE + "@style") - 75) < DELTA,
format(MSG_HANDLE_N_PX, 75));
- assertTrue(Math.abs(getOffset(LOC_FIRST_TIP + "@style") - 75) < DELTA,
format(MSG_TIP_N_PX, 75));
+ assertTrue(Math.abs(getOffset(LOC_FIRST_HANDLE) - 75) < DELTA,
format(MSG_HANDLE_N_PX, 75));
+ assertTrue(Math.abs(getOffset(LOC_FIRST_TIP) - 75) < DELTA, format(MSG_TIP_N_PX,
75));
assertFalse(isDisplayed(LOC_FIRST_TIP), MSG_TIP_SHOULD_NOT_BE_VISIBLE);
selenium.mouseDownAt(LOC_FIRST, "20,3");
assertTrue(isDisplayed(LOC_FIRST_TIP), MSG_TIP_SHOULD_BE_VISIBLE);
selenium.mouseUp(LOC_FIRST);
- int tipOffset = getOffset(LOC_FIRST_TIP + "@style");
- int handleOffset = getOffset(LOC_FIRST_HANDLE + "@style");
+ int tipOffset = getOffset(LOC_FIRST_TIP);
+ int handleOffset = getOffset(LOC_FIRST_HANDLE);
int value = Integer.parseInt(selenium.getValue(LOC_FIRST_INPUT));
assertEquals(tipOffset, handleOffset, MSG_OFFSETS_SHOULD_BE_THE_SAME);
@@ -107,16 +107,16 @@
@Test
public void testFirstSliderKeyboard() {
selenium.type(LOC_FIRST_INPUT, "10");
- int tipOffset = getOffset(LOC_FIRST_TIP + "@style");
- int handleOffset = getOffset(LOC_FIRST_HANDLE + "@style");
+ int tipOffset = getOffset(LOC_FIRST_TIP);
+ int handleOffset = getOffset(LOC_FIRST_HANDLE);
assertEquals(tipOffset, handleOffset, MSG_OFFSETS_SHOULD_BE_THE_SAME);
assertTrue(Math.abs(tipOffset - 10 * 1.5) < DELTA, MSG_TIP_FIRST_HALF);
assertTrue(handleOffset < 75, MSG_HANDLE_FIRST_HALF);
selenium.type(LOC_FIRST_INPUT, "90");
- tipOffset = getOffset(LOC_FIRST_TIP + "@style");
- handleOffset = getOffset(LOC_FIRST_HANDLE + "@style");
+ tipOffset = getOffset(LOC_FIRST_TIP);
+ handleOffset = getOffset(LOC_FIRST_HANDLE);
assertEquals(tipOffset, handleOffset, MSG_OFFSETS_SHOULD_BE_THE_SAME);
assertTrue(Math.abs(tipOffset - 90 * 1.5) < DELTA, MSG_TIP_SECOND_HALF);
@@ -151,8 +151,8 @@
*/
@Test
public void testSecondSlider() {
- assertTrue(Math.abs(getOffset(LOC_SECOND_HANDLE + "@style") - 96) < DELTA,
format(MSG_HANDLE_N_PX, 96));
- assertTrue(Math.abs(getOffset(LOC_SECOND_TIP + "@style") - 96) < DELTA,
format(MSG_TIP_N_PX, 96));
+ assertTrue(Math.abs(getOffset(LOC_SECOND_HANDLE) - 96) < DELTA,
format(MSG_HANDLE_N_PX, 96));
+ assertTrue(Math.abs(getOffset(LOC_SECOND_TIP) - 96) < DELTA, format(MSG_TIP_N_PX,
96));
assertFalse(isDisplayed(LOC_SECOND_TIP), MSG_TIP_SHOULD_NOT_BE_VISIBLE);
selenium.mouseDownAt(LOC_SECOND, "20,3");
@@ -160,8 +160,8 @@
assertFalse(isDisplayed(LOC_SECOND_TIP), MSG_TIP_SHOULD_NOT_BE_VISIBLE);
selenium.mouseUp(LOC_SECOND);
- int tipOffset = getOffset(LOC_SECOND_TIP + "@style");
- int handleOffset = getOffset(LOC_SECOND_HANDLE + "@style");
+ int tipOffset = getOffset(LOC_SECOND_TIP);
+ int handleOffset = getOffset(LOC_SECOND_HANDLE);
int value = Integer.parseInt(selenium.getValue(LOC_SECOND_INPUT));
assertEquals(tipOffset, handleOffset, MSG_OFFSETS_SHOULD_BE_THE_SAME);
@@ -177,8 +177,8 @@
*/
@Test
public void testThirdSliderMouse() {
- assertTrue(Math.abs(getOffset(LOC_THIRD_HANDLE + "@style") - 225) < DELTA,
format(MSG_HANDLE_N_PX, 225));
- assertTrue(Math.abs(getOffset(LOC_THIRD_TIP + "@style") - 225) < DELTA,
format(MSG_TIP_N_PX, 225));
+ assertTrue(Math.abs(getOffset(LOC_THIRD_HANDLE) - 225) < DELTA,
format(MSG_HANDLE_N_PX, 225));
+ assertTrue(Math.abs(getOffset(LOC_THIRD_TIP) - 225) < DELTA, format(MSG_TIP_N_PX,
225));
assertFalse(isDisplayed(LOC_THIRD_TIP), MSG_TIP_SHOULD_NOT_BE_VISIBLE);
selenium.mouseDownAt(LOC_THIRD, "20,3");
@@ -186,8 +186,8 @@
assertFalse(isDisplayed(LOC_THIRD_TIP), MSG_TIP_SHOULD_NOT_BE_VISIBLE);
selenium.mouseUp(LOC_THIRD);
- int tipOffset = getOffset(LOC_THIRD_TIP + "@style");
- int handleOffset = getOffset(LOC_THIRD_HANDLE + "@style");
+ int tipOffset = getOffset(LOC_THIRD_TIP);
+ int handleOffset = getOffset(LOC_THIRD_HANDLE);
int value = Integer.parseInt(selenium.getValue(LOC_THIRD_INPUT));
assertEquals(tipOffset, handleOffset, MSG_OFFSETS_SHOULD_BE_THE_SAME);
@@ -207,16 +207,16 @@
@Test
public void testThirdSliderKeyboard() {
selenium.type(LOC_THIRD_INPUT, "10"); // 10 -> 0
- int tipOffset = getOffset(LOC_THIRD_TIP + "@style");
- int handleOffset = getOffset(LOC_THIRD_HANDLE + "@style");
+ int tipOffset = getOffset(LOC_THIRD_TIP);
+ int handleOffset = getOffset(LOC_THIRD_HANDLE);
assertEquals(tipOffset, handleOffset, MSG_OFFSETS_SHOULD_BE_THE_SAME);
assertTrue(tipOffset < 5, MSG_TIP_FIRST_HALF);
assertTrue(handleOffset < 75, MSG_HANDLE_FIRST_HALF);
selenium.type(LOC_THIRD_INPUT, "690"); // 690 -> 700
- tipOffset = getOffset(LOC_THIRD_TIP + "@style");
- handleOffset = getOffset(LOC_THIRD_HANDLE + "@style");
+ tipOffset = getOffset(LOC_THIRD_TIP);
+ handleOffset = getOffset(LOC_THIRD_HANDLE);
assertEquals(tipOffset, handleOffset, MSG_OFFSETS_SHOULD_BE_THE_SAME);
assertTrue(Math.abs(tipOffset - 0.69 * 450) < DELTA, MSG_TIP_SECOND_HALF);
@@ -269,27 +269,25 @@
};
abstractTestSource(1, "View Source", strings);
- }
-
+ }
+
/**
- * Returns the offset of the element. It requires a locator for an
- * attribute, e.g. //div@style. It returns the 'left' attribute, e.g. for
- * style="visibility: visible; left: 51px;" would return 51.
+ * Returns the offset of the element for given locator. It returns the
+ * 'left' attribute.
*/
private int getOffset(String locator) {
- StringBuilder attr = new StringBuilder(selenium.getAttribute(locator));
- attr = attr.delete(0, attr.indexOf("left: "));
- attr = attr.delete(0, 6);
- attr = attr.delete(attr.indexOf("px;"), attr.length());
- return Integer.parseInt(attr.toString());
+ String jquery = locator.replaceAll("^jquery=", "");
+ String eval = "var inDocument =
this.browserbot.getCurrentWindow().document;"
+ + "var handle = $('{0}', inDocument); var hidden =
handle.css('display') === 'none';"
+ + "hidden ? handle.css('display', '') : true;" + "var
result = handle.position().left;"
+ + "hidden ? handle.css('display','none') : true;" +
"result";
+ return Integer.parseInt(selenium.getEval(format(eval, jquery)));
}
/**
- * Loads the page containing needed component.
- */
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ * Loads the page containing needed component.
+ */
+ protected void loadPage() {
openComponent("Input Number Slider");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/jsFunction/JSFunctionTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/jsFunction/JSFunctionTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/jsFunction/JSFunctionTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -70,9 +70,7 @@
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("JS Function");
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/keepAlive/KeepAliveTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/keepAlive/KeepAliveTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/keepAlive/KeepAliveTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -66,13 +66,8 @@
selenium.fireEvent(LOC_INPUT_INCORRECT2, Event.KEYUP);
// wait for "equal sign" button became enabled (lost disabled status)
- Wait.failWith("Button \"=\" never became enabled").until(new
Condition() {
- public boolean isTrue() {
- return !selenium.isElementPresent(format("{0}/@disabled",
LOC_BUTTON_INCORRECT));
+ Wait.failWith("Button \"=\" never became enabled").until(new
ButtonDisabled(LOC_BUTTON_INCORRECT));
- }
- });
-
// try to count result
selenium.click(LOC_BUTTON_INCORRECT);
@@ -101,11 +96,7 @@
selenium.fireEvent(LOC_INPUT_CORRECT2, Event.KEYUP);
// wait for "equal sign" button became enabled (lost disabled status)
- Wait.failWith("Button \"=\" never became enabled").until(new
Condition() {
- public boolean isTrue() {
- return !selenium.isElementPresent(format("{0}/@disabled",
LOC_BUTTON_CORRECT));
- }
- });
+ Wait.failWith("Button \"=\" never became enabled").until(new
ButtonDisabled(LOC_BUTTON_CORRECT));
// try to count result
selenium.click(LOC_BUTTON_CORRECT);
@@ -119,10 +110,27 @@
}
});
}
+
+ private class ButtonDisabled implements Condition {
+ private String locButton;
+
+ public ButtonDisabled(String locButton) {
+ this.locButton = locButton;
+ }
+
+ public boolean isTrue() {
+ final String attrDisabled = format("{0} @disabled", locButton);
+
+ if (!selenium.isElementPresent(attrDisabled)) {
+ return true;
+ }
+
+ return "false".equals(selenium.getValue(attrDisabled));
+ }
+
+ }
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Keep Alive");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/listShuttle/ListShuttleTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/listShuttle/ListShuttleTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/listShuttle/ListShuttleTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -458,9 +458,7 @@
/**
* Loads the needed page.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("List Shuttle");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/log/LogTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/log/LogTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/log/LogTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -125,9 +125,7 @@
});
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Log");
scrollIntoView(LOC_FIELDSET_HEADER, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/mediaOutput/MediaOutputTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/mediaOutput/MediaOutputTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/mediaOutput/MediaOutputTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -85,9 +85,7 @@
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Media Output");
scrollIntoView(LOC_FIELDSET_HEADER, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/modalPanel/ModalPanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/modalPanel/ModalPanelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/modalPanel/ModalPanelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -219,9 +219,7 @@
/**
* Loads the page containing the calendar component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Modal Panel");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/orderingList/OrderingListTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/orderingList/OrderingListTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/orderingList/OrderingListTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -549,9 +549,7 @@
/**
* Loads the page containing needed component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Ordering List");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/outputPanel/OutputPanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/outputPanel/OutputPanelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/outputPanel/OutputPanelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -104,9 +104,7 @@
errorMessageShouldAppear ? "Error message should appear" :
"No error message should appear");
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Output Panel");
scrollIntoView(LOC_FIELDSET_HEADER, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/paint2d/Paint2DTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/paint2d/Paint2DTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/paint2d/Paint2DTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -331,9 +331,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Paint2D");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelCustomizationTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelCustomizationTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelCustomizationTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -116,9 +116,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Panel");
openTab("Look Customization");
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -150,9 +150,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Panel");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelBar/PanelBarTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelBar/PanelBarTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelBar/PanelBarTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -111,9 +111,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Panel Bar");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelMenu/PanelMenuTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelMenu/PanelMenuTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelMenu/PanelMenuTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -264,9 +264,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Panel Menu");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/pickList/PickListTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/pickList/PickListTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/pickList/PickListTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -368,9 +368,7 @@
/**
* Loads the needed page.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Pick List");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -125,9 +125,7 @@
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Poll");
scrollIntoView(LOC_OUTPUT_POLL_STATUS, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/progressBar/ProgressBarTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/progressBar/ProgressBarTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/progressBar/ProgressBarTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -64,7 +64,7 @@
}
public boolean isTrue() {
- newValue = (int) Double.parseDouble(getStyle(locator,
"width").replace("px", ""));
+ newValue = (int) Double.parseDouble(getStyle(locator,
"width").replaceAll("(px|%)$", ""));
return newValue > oldValue;
}
}
@@ -187,9 +187,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Progress Bar");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/push/PushTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/push/PushTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/push/PushTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -145,9 +145,7 @@
return !MSG_OUTPUT_PUSH_INACTIVE.equals(selenium.getText(LOC_OUTPUT_TEXT));
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Push");
scrollIntoView(LOC_BUTTON_POLL_CONTROL, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueSettingsTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueSettingsTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueSettingsTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -201,9 +201,7 @@
}
};
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Queue");
openTab("Queue Settings");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -60,9 +60,7 @@
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Queue");
openTab("Usage");
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/repeat/RepeatTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/repeat/RepeatTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/repeat/RepeatTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -118,9 +118,7 @@
return Double.parseDouble(string);
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Repeat");
scrollIntoView(LOC_FIELDSET_HEADER, true);
selenium.allowNativeXpath("true");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/script/ScriptTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/script/ScriptTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/script/ScriptTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -148,9 +148,7 @@
});
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Script");
scrollIntoView(LOC_FIELDSET_HEADER, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/separator/SeparatorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/separator/SeparatorTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/separator/SeparatorTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -23,9 +23,12 @@
package org.jboss.richfaces.integrationTest.separator;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.utils.URLUtils;
@@ -80,10 +83,10 @@
String text = getStyle(format(LOC_SEPARATOR_N, 1), "height");
assertEquals(text, MSG_SECOND_HEIGHT, "Height of the separator.");
- double widthFull = Double.parseDouble(getStyle(format(LOC_SEPARATOR_N, 0),
"width").replace("px", ""));
- double width75 = Double.parseDouble(getStyle(format(LOC_SEPARATOR_N, 1),
"width").replace("px", ""));
+ long widthFull = selenium.getElementWidth(format(LOC_SEPARATOR_N,
0)).longValue();
+ long width75 = selenium.getElementWidth(format(LOC_SEPARATOR_N, 1)).longValue();
- assertEquals(width75, widthFull * 0.75, "Width of the separator.");
+ assertTrue(Math.abs(width75 - widthFull * 0.75) < 1, "Width of the second
separator isn't 75% of first");
text = getSeparatorHash(format(LOC_SEPARATOR_N, 1));
assertEquals(text, MSG_SECOND_HASH, "Hash code of the image that makes the
separator.");
@@ -167,7 +170,12 @@
private String getSeparatorHash(String locator) {
// create URL of the image
String url = getStyle(locator, "background-image");
- url = url.replace("url(", "").replace(")",
"");
+ Matcher matcher =
Pattern.compile("url\\(\"?([^\"\\)]+)\"?\\)").matcher(url);
+ if (matcher.matches()) {
+ url = matcher.group(1);
+ } else {
+ fail("Url '" + url + "' doesn't match url
pattern");
+ }
String hash = null;
try {
@@ -183,9 +191,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Separator");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -184,9 +184,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Simple Toggle Panel");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spacer/SpacerTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spacer/SpacerTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spacer/SpacerTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -92,9 +92,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Spacer");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -301,9 +301,7 @@
/**
* Loads the page containing needed component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Input Number Spinner");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/stateManager/StateManagerTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/stateManager/StateManagerTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/stateManager/StateManagerTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -123,9 +123,7 @@
/**
* Loads the needed page.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("State Manager API");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status/StatusTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status/StatusTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status/StatusTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -185,9 +185,7 @@
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Status");
openTab("Usage");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/style/StyleTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/style/StyleTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/style/StyleTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -21,12 +21,14 @@
*******************************************************************************/
package org.jboss.richfaces.integrationTest.style;
+import java.awt.Color;
import java.util.LinkedHashMap;
import java.util.Map;
import static org.testng.Assert.*;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.jboss.test.selenium.utils.ColorUtils;
import org.jboss.test.selenium.waiting.Wait;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -69,14 +71,14 @@
selenium.waitForPageToLoad(Long.toString(Wait.DEFAULT_TIMEOUT));
scrollIntoView(LOC_FIELDSET_HEADER, true);
- assertEquals(msgColor, getStyle(LOC_PANEL, "background-color"), format(
- "background-color for '{0}' skin does not match",
selenium.getText(locLink)));
+ Color expected = ColorUtils.convertToAWTColor(msgColor);
+ Color actual = ColorUtils.convertToAWTColor(getStyle(LOC_PANEL,
"background-color"));
+ assertEquals(actual, expected, format("background-color for '{0}' skin
does not match", selenium
+ .getText(locLink)));
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Style");
scrollIntoView(LOC_FIELDSET_HEADER, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -24,7 +24,9 @@
import static org.testng.Assert.assertEquals;
+import org.apache.commons.lang.math.Range;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.waiting.Condition;
import org.jboss.test.selenium.waiting.Wait;
import org.testng.annotations.BeforeMethod;
@@ -33,7 +35,8 @@
/**
* Test case that tests the suggestion box.
*
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>,
<a
+ * href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
public class SuggestionBoxTestCase extends AbstractSeleniumRichfacesTestCase {
@@ -85,15 +88,18 @@
scrollIntoView(LOC_FIRST_INPUT, true);
// select Atlanta
- selenium.typeKeys(LOC_FIRST_INPUT, "at");
+ selenium.type(LOC_FIRST_INPUT, "at");
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
+
waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0));
selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0));
// select Madison
- selenium.typeKeys(LOC_FIRST_INPUT, ",ma");
+ selenium.type(LOC_FIRST_INPUT, selenium.getValue(LOC_FIRST_INPUT) +
",ma");
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
- waitForTextEquals(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0),
"MadisonWisconsin");
+ waitForTextEquals(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0),
"Wisconsin");
selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0));
String text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 0));
@@ -130,17 +136,23 @@
scrollIntoView(LOC_FIRST_INPUT, true);
// select Atlanta
- selenium.typeKeys(LOC_FIRST_INPUT, "[at");
+ selenium.type(LOC_FIRST_INPUT, "[at");
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
+
waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0));
selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0));
- selenium.typeKeys(LOC_FIRST_INPUT, "]");
+ selenium.type(LOC_FIRST_INPUT, selenium.getValue(LOC_FIRST_INPUT) +
"]");
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
// select Madison
- selenium.typeKeys(LOC_FIRST_INPUT, "[ma");
- waitForTextEquals(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0),
"MadisonWisconsin");
+ selenium.type(LOC_FIRST_INPUT, selenium.getValue(LOC_FIRST_INPUT) +
"[ma");
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
+
+ waitForTextEquals(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0),
"Wisconsin");
selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0));
- selenium.typeKeys(LOC_FIRST_INPUT, "]");
+ selenium.type(LOC_FIRST_INPUT, selenium.getValue(LOC_FIRST_INPUT) +
"]");
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
String text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 0));
assertEquals(text, "Georgia", format(MSG_TABLE_PREFORMATTED, 1, 0));
@@ -176,7 +188,8 @@
scrollIntoView(LOC_FIRST_INPUT, true);
// select aaa
- selenium.typeKeys(LOC_FIRST_INPUT, "aaa");
+ selenium.type(LOC_FIRST_INPUT, "aaa");
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 0));
String text = selenium.getText(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED,
0));
@@ -184,242 +197,106 @@
}
/**
- * Tests the "Border" slider. It tests values 3, 5, and 7.
+ * Tests the "Border" slider. It tests values 5, 0, 3, 7, 1
*/
- @Test
- public void testBorder() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ @Test
+ public void testBorder() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_BORDER_INPUT, "3");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_BORDER_STYLE, "border-width") == 3;
- }
- });
+ StepRange range = new StepRange(1, 5, 1);
+ for (int i : new int[] { 5, 0, 3, 7, 1 }) {
+ selenium.type(LOC_FIRST_BORDER_INPUT, String.valueOf(i));
+ selenium.fireEvent(LOC_FIRST_BORDER_INPUT, Event.BLUR);
+ String result = range.getRoundedValue(i).toString();
+ Wait.failWith(format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED,
String.valueOf(i))).until(
+ new StyleCondition(LOC_FIRST_BORDER_STYLE, "border-top-width", result));
+ assertEquals(getStyleValue(LOC_FIRST_BORDER_STYLE, "border-right-width"),
result);
+ assertEquals(getStyleValue(LOC_FIRST_BORDER_STYLE, "border-bottom-width"),
result);
+ assertEquals(getStyleValue(LOC_FIRST_BORDER_STYLE, "border-left-width"),
result);
+ assertEquals(selenium.getValue(LOC_FIRST_BORDER_INPUT), result);
+ }
+ }
- int width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 3, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 3));
-
- selenium.type(LOC_FIRST_BORDER_INPUT, "5");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_BORDER_STYLE, "border-width") == 5;
- }
- });
-
- width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 5, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 5));
-
- selenium.type(LOC_FIRST_BORDER_INPUT, "7"); // 7 -> 5
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_BORDER_STYLE, "border-width") == 5;
- }
- });
-
- width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 5, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 7));
- }
-
/**
- * Tests the "Width" slider. It tests values 150, 350, 400, and 176.
+ * Tests the "Width" slider. It tests values 350, 149, 176, 351, 200, 150,
500
*/
@Test
public void testWidth() {
scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_WIDTH_INPUT, "150");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_WIDTH_STYLE, "width") == 150;
- }
- });
-
- int width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 150, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 150));
-
- selenium.type(LOC_FIRST_WIDTH_INPUT, "350");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_WIDTH_STYLE, "width") == 350;
- }
- });
-
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 350, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 350));
-
- selenium.type(LOC_FIRST_WIDTH_INPUT, "400"); // 400 -> 350
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_WIDTH_STYLE, "width") == 350;
- }
- });
-
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 350, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 400));
-
- selenium.type(LOC_FIRST_WIDTH_INPUT, "176"); // 176 -> 200
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_WIDTH_STYLE, "width") == 200;
- }
- });
-
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 200, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 176));
+ StepRange range = new StepRange(150, 350, 50);
+ final String locInput = LOC_FIRST_WIDTH_INPUT;
+ for (int i : new int[] { 350, 149, 176, 351, 200, 150, 500 }) {
+ selenium.type(locInput, String.valueOf(i));
+ selenium.fireEvent(locInput, Event.BLUR);
+ String result = range.getRoundedValue(i).toString();
+ Wait.failWith(format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED,
String.valueOf(i))).until(
+ new StyleCondition(LOC_FIRST_WIDTH_STYLE, "width", result));
+ assertEquals(selenium.getValue(locInput), result);
+ }
}
/**
- * Tests the "Height" slider. It tests values 100, 300, 400, and 176.
+ * Tests the "Height" slider. It tests values 300, 99, 176, 301, 200, 100,
400
*/
@Test
public void testHeight() {
scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "100");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_HEIGHT_STYLE, "height") == 100;
- }
- });
-
- int height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 100, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 100));
-
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "300");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_HEIGHT_STYLE, "height") == 300;
- }
- });
-
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 300, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 300));
-
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "400"); // 400 -> 300
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_HEIGHT_STYLE, "height") == 300;
- }
- });
-
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 300, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 400));
-
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "176"); // 176 -> 200
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_HEIGHT_STYLE, "height") == 200;
- }
- });
-
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 200, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 176));
+ StepRange range = new StepRange(100, 300, 50);
+ final String locInput = LOC_FIRST_HEIGHT_INPUT;
+ for (int i : new int[] { 300, 99, 176, 301, 200, 100, 400 }) {
+ selenium.type(locInput, String.valueOf(i));
+ selenium.fireEvent(locInput, Event.BLUR);
+ String result = range.getRoundedValue(i).toString();
+ Wait.failWith(format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED,
String.valueOf(i))).until(
+ new StyleCondition(LOC_FIRST_HEIGHT_STYLE, "height", result));
+ assertEquals(selenium.getValue(locInput), result);
+ }
}
/**
- * Tests the "Shadow Depth" slider. It tests values 3, 5, 6, and 7. It
test
+ * Tests the "Shadow Depth" slider. It tests values 7, 4, 2, 6, 3, 0, 8. It
test
* both top and left offset.
*/
- @Test
- public void testShadowDepth() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ @Test
+ public void testShadowDepth() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "3");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top") == 3;
- }
- });
-
- int top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 3, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 3));
- int left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 3, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 3));
-
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "5");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top") == 5;
- }
- });
-
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 5, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 5));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 5, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 5));
-
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "6");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top") == 6;
- }
- });
-
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 6));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 6));
-
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "7"); // 7 -> 6
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top") == 6;
- }
- });
-
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 7));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 7));
+ StepRange range = new StepRange(3, 6, 1);
+ final String locInput = LOC_FIRST_SHADOW_DEPTH_INPUT;
+ for (int i : new int[] { 7, 4, 2, 6, 3, 0, 8 }) {
+ selenium.type(locInput, String.valueOf(i));
+ selenium.fireEvent(locInput, Event.BLUR);
+ selenium.type(LOC_FIRST_INPUT, String.valueOf(i));
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
+ String result = range.getRoundedValue(i).toString();
+ Wait.failWith(format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED,
String.valueOf(i))).until(
+ new StyleCondition(LOC_FIRST_SHADOW_DEPTH_STYLE, "top", result));
+ assertEquals(getStyleValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left"), result);
+ assertEquals(selenium.getValue(locInput), result);
+ }
}
/**
- * Tests the "Shadow Opacity" slider. It tests values 1, 5, 9, and 11.
+ * Tests the "Shadow Opacity" slider. It tests values 10, 5, 0, 9, 1, -1,
12.
*/
@Test
public void testShadowOpacity() {
scrollIntoView(LOC_FIRST_INPUT, true);
-
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "1");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE) == 0.1;
- }
- });
-
- double opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.1, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
1));
-
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "5");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE) == 0.5;
- }
- });
-
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.5, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
5));
-
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "9");
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE) == 0.9;
- }
- });
-
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.9, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
9));
-
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "11"); // 11 -> 9
- Wait.until(new Condition() {
- public boolean isTrue() {
- return getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE) == 0.9;
- }
- });
-
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.9, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
11));
+
+ StepRange range = new StepRange(1, 9, 1);
+ final String locInput = LOC_FIRST_SHADOW_OPACITY_INPUT;
+ for (int i : new int[] { 10, 5, 0, 9, 1, -1, 12 }) {
+ selenium.type(locInput, String.valueOf(i));
+ selenium.fireEvent(locInput, Event.BLUR);
+ selenium.type(LOC_FIRST_INPUT, String.valueOf(i));
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
+ String result = range.getRoundedValue(i).toString();
+ Wait.failWith(format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
String.valueOf(i))).until(
+ new StyleCondition(LOC_FIRST_SHADOW_OPACITY_STYLE, "opacity",
format("0.{0}", result)));
+ assertEquals(selenium.getValue(locInput), result);
+ }
}
/**
@@ -494,7 +371,9 @@
public void testSecondExampleOneCity() {
scrollIntoView(LOC_SECOND_INPUT, true);
- selenium.typeKeys(LOC_SECOND_INPUT, "a");
+ selenium.type(LOC_SECOND_INPUT, "a");
+ selenium.fireEvent(LOC_SECOND_INPUT, Event.KEYDOWN);
+
waitForElement(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 1));
selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 1)); // Augusta
@@ -512,11 +391,15 @@
public void testSecondExampleMoreCities() {
scrollIntoView(LOC_SECOND_INPUT, true);
- selenium.typeKeys(LOC_SECOND_INPUT, "a");
+ selenium.type(LOC_SECOND_INPUT, "a");
+ selenium.fireEvent(LOC_SECOND_INPUT, Event.KEYDOWN);
+
waitForElement(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 1));
selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 1)); // Augusta
- selenium.typeKeys(LOC_SECOND_INPUT, ",m");
+ selenium.type(LOC_SECOND_INPUT, selenium.getValue(LOC_SECOND_INPUT) +
",m");
+ selenium.fireEvent(LOC_SECOND_INPUT, Event.KEYDOWN);
+
waitForTextEquals(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2),
"Madison");
selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2)); // Madison
@@ -587,44 +470,107 @@
abstractTestSource(2, "View Source", strings);
}
- /**
- * Pulls out the value of the specified attribute from the specified
- * location.
- *
- * @param loc
- * an attribute locator
- * @param attr
- * an 'subattribute' whose value we want (e.g. <div
- * style="left: 4px;"/>, then loc=//div@style and attr=left
- * @return the value of the subattribute
- */
- private int getValue(String loc, String attr) {
- String tmp = selenium.getAttribute(loc);
- int firstIdx = tmp.indexOf(attr) + 2 + attr.length();
- int secondIdx = tmp.indexOf("px;", firstIdx);
- return Integer.parseInt(tmp.substring(firstIdx, secondIdx));
- }
+
+ /**
+ * Condition for Wait.until(Condition) which waits for the item specified by
+ * locator becomes in given style given value
+ */
+ private class StyleCondition implements Condition {
+ private String locator;
+ private String style;
+ private String value;
- /**
- * Pulls out opacity from the specified attribute.
- *
- * @param loc
- * an attribute locator
- * @return the value of opacity
- */
- private double getOpacity(String loc) {
- String tmp = selenium.getAttribute(loc);
- int firstIdx = tmp.indexOf("opacity") + 9;
- int secondIdx = tmp.indexOf(";", firstIdx);
- return Double.parseDouble(tmp.substring(firstIdx, secondIdx));
- }
+ /**
+ * @param locator
+ * locator of item which we will be testing for becoming
+ * given style in given value
+ * @param style
+ * tested on item given by locator to equality with given
+ * value
+ * @param value
+ * of given style which we are testing on item specified by
+ * locator
+ */
+ public StyleCondition(String locator, String style, String value) {
+ this.locator = locator;
+ this.style = style;
+ this.value = value;
+ }
- /**
- * Loads the page containing the calendar component.
- */
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ public boolean isTrue() {
+ return getStyleValue(locator, style).equals(value);
+ }
+ }
+
+ /**
+ * Pulls out the value of the specified attribute from the specified
+ * location.
+ *
+ * @param loc
+ * an attribute locator
+ * @param attr
+ * an style value what we want to pull out
+ * @return the value of the subattribute
+ */
+ private String getStyleValue(String loc, String attr) {
+ return getStyle(loc, attr).replaceFirst("px", "");
+ }
+
+ /**
+ * Class representing Range of numbers with defined offset between them (step)
+ *
+ * Can test the number for presence in range and round the number into number, which is
in the range.
+ */
+ private class StepRange extends Range {
+
+ private int minimum;
+ private int maximum;
+ private int step;
+
+ public StepRange(int minimum, int maximum, int step) {
+ this.minimum = minimum;
+ this.maximum = maximum;
+ this.step = step;
+ }
+
+ @Override
+ public boolean containsNumber(Number number) {
+ return number.intValue() == getRoundedValue(number).intValue();
+ }
+
+ @Override
+ public Number getMaximumNumber() {
+ return maximum;
+ }
+
+ @Override
+ public Number getMinimumNumber() {
+ return minimum;
+ }
+
+ public Number getRoundedValue(Number number) {
+ if (number.intValue() < minimum)
+ return minimum;
+ if (number.intValue() > maximum)
+ return maximum;
+ int delta = number.intValue() % step;
+ if (delta != 0) {
+ if (delta > (step / 2)) {
+ return number.intValue() - delta + step;
+ } else {
+ return number.intValue() - delta;
+ }
+ }
+ return number;
+ }
+ }
+
+ /**
+ * Loads the page containing the calendar component.
+ */
+ protected void loadPage() {
openComponent("Suggestion Box");
}
+
+
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -192,9 +192,7 @@
/**
* Loads the page containing the calendar component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Tab Panel");
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tableFiltering/TableFilteringTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tableFiltering/TableFilteringTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tableFiltering/TableFilteringTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -177,9 +177,7 @@
}
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Table Filtering");
selenium.allowNativeXpath("true");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tableSorting/TableSortingTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tableSorting/TableSortingTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tableSorting/TableSortingTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -144,9 +144,7 @@
checkSortingForColumnOrder(LOC_LIST_OF_TD_PREFORMATTED);
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Table Sorting");
selenium.allowNativeXpath("true");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/togglePanel/TogglePanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/togglePanel/TogglePanelTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/togglePanel/TogglePanelTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -158,9 +158,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Toggle Panel");
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/toolBar/ToolBarTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/toolBar/ToolBarTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/toolBar/ToolBarTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -287,9 +287,7 @@
/**
* Loads the page containing the component.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Tool Bar");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipDataTableTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipDataTableTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipDataTableTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -96,9 +96,7 @@
return
!"0".equals(selenium.getEval(format("jqFind('{0}:visible').size()",
locator.replaceFirst("^jquery=", "").trim())));
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("ToolTip");
openTab("Use ToolTip with DataTable");
scrollIntoView(LOC_FIELDSET_HEADER_2, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tooltip/TooltipTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -196,9 +196,7 @@
});
}
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("ToolTip");
openTab("Usage");
scrollIntoView(LOC_FIELDSET_HEADER_1, true);
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tree/TreeNodesAdaptorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tree/TreeNodesAdaptorTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tree/TreeNodesAdaptorTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -178,9 +178,7 @@
/**
* Loads the needed page.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Tree Adaptor");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tree/TreeTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tree/TreeTestCase.java 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tree/TreeTestCase.java 2010-01-18
16:36:28 UTC (rev 16322)
@@ -206,9 +206,7 @@
/**
* Loads the needed page.
*/
- @SuppressWarnings("unused")
- @BeforeMethod
- private void loadPage() {
+ protected void loadPage() {
openComponent("Tree");
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/messages.properties 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/messages.properties 2010-01-18
16:36:28 UTC (rev 16322)
@@ -3,7 +3,7 @@
INITIAL_STATE_INITIAL_VALUE_3=Enter some value
SUGGESTIONS_FIRST_COMBO_COUNT_1=5
-SUGGESTIONS_FIRST_COMBO_COUNT_2=5
+SUGGESTIONS_FIRST_COMBO_COUNT_2=1
SUGGESTIONS_FIRST_COMBO_INPUT=suggestion 3
SUGGESTIONS_SECOND_COMBO_COUNT_1=50
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dataTable/messages-DataTableTestCase.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dataTable/messages-DataTableTestCase.properties 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dataTable/messages-DataTableTestCase.properties 2010-01-18
16:36:28 UTC (rev 16322)
@@ -1,2 +1,2 @@
TAB_TO_OPEN=Usage
-TABLE_TEXT_CONTENT=ExpensessubtotalsMealsHotelsTransportTotals$196.27$442.00$162.00$800.27San
Jose25-Aug-97$37.74$112.00$45.0026-Aug-97$27.28$112.00$45.00$65.02$224.00$90.00$379.02Seattle27-Aug-97$96.25$109.00$36.0028-Aug-97$35.00$109.00$36.00$131.25$218.00$72.00$421.25
+TABLE_TEXT_CONTENT=ExpensessubtotalsMealsHotelsTransportTotals$196.27$442.00$162.00$800.27SanJose25-Aug-97$37.74$112.00$45.0026-Aug-97$27.28$112.00$45.00$65.02$224.00$90.00$379.02Seattle27-Aug-97$96.25$109.00$36.0028-Aug-97$35.00$109.00$36.00$131.25$218.00$72.00$421.25
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/locators.properties 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/locators.properties 2010-01-18
16:36:28 UTC (rev 16322)
@@ -8,4 +8,4 @@
BUTTON_SUBMIT_ACTIVITIES=jquery=input[value=Store my details]
OUTPUT_VALIDATION_MESSAGE=jquery=form#graphValidatorForm2 span.rich-messages-label
CLASS_VALIDATION_MESSAGE=jquery=form#graphValidatorForm2 dt@class
-INPUT_ACTIVITY_HOURS_PREFORMATTED=jquery=form#graphValidatorForm2 > table > tbody
> tr:nth-child({0}) input.rich-spinner-input
+INPUT_ACTIVITY_HOURS_PREFORMATTED=jquery\=form\#graphValidatorForm2 tr\:nth-child({0})
input.rich-spinner-input
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/locators.properties 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/locators.properties 2010-01-18
16:36:28 UTC (rev 16322)
@@ -1,5 +1,5 @@
EXAMPLE_HEADER=jquery=fieldset > legend
-PANEL=jquery=fieldset span[id=form\\:current]
+PANEL=jquery\=fieldset span[id\=form\:current]
GROUP_N_IMAGE_BEFORE=jquery=fieldset table.rich-pmenu-top-group:eq({0}) td:eq(0) img@src
GROUP_N_IMAGE_AFTER=jquery=fieldset table.rich-pmenu-top-group:eq({0}) td:eq(2) img@src
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties 2010-01-18
16:36:28 UTC (rev 16322)
@@ -1,4 +1,4 @@
-FIRST_SUGGESTION_BOX_PREFORMATTED=jquery=table[id$=suggest].rich-sb-int-decor-table
tr:eq({0})
+FIRST_SUGGESTION_BOX_PREFORMATTED=jquery\=table[id$\=suggest].rich-sb-int-decor-table
tr\:eq({0}) td\:last
FIRST_INPUT=jquery=fieldset:eq(0) input[id$=text]
FIRST_BORDER_INPUT=jquery=fieldset:eq(0) td.sb_test_column1 > table > tbody >
tr:eq(0) > td:eq(1) input
@@ -10,15 +10,15 @@
FIRST_TOWN_TABLE_PREFORMATTED=jquery=fieldset:eq(0) td.sb_test_column2 div#myDiv
tr:eq({0}) > td:eq({1})
-FIRST_BORDER_STYLE=jquery=div[id$=suggestionBoxId] div.rich-sb-ext-decor-2@style
-FIRST_WIDTH_STYLE=jquery=div[id$=suggestionBoxId]@style
-FIRST_HEIGHT_STYLE=jquery=div[id$=suggestionBoxId]@style
-FIRST_SHADOW_DEPTH_STYLE=jquery=div[id$=suggestionBoxId] > div:eq(1)@style
-FIRST_SHADOW_OPACITY_STYLE=jquery=div[id$=suggestionBoxId] > div:eq(1)@style
+FIRST_BORDER_STYLE=jquery\=div[id$\=suggestionBoxId] div.rich-sb-ext-decor-2
+FIRST_WIDTH_STYLE=jquery\=div[id$\=suggestionBoxId]
+FIRST_HEIGHT_STYLE=jquery\=div[id$\=suggestionBoxId]
+FIRST_SHADOW_DEPTH_STYLE=jquery\=div[id$\=suggestionBoxId] > div\:eq(1)
+FIRST_SHADOW_OPACITY_STYLE=jquery\=div[id$\=suggestionBoxId] > div\:eq(1)
FIRST_CELLPADDING=jquery=div[id$=suggestionBoxId] table[id$=suggest]@cellpadding
SECOND_INPUT=jquery=fieldset:eq(1) input[id$=statesinput]
SECOND_BUTTON=jquery=fieldset:eq(1) img[src*=arrow.png]
SECOND_SUGGESTION_LINES=jquery=div[id$=suggestion] table[id$=suggest] tr
-SECOND_SUGGESTION_BOX_PREFORMATTED=jquery=div[id$=suggestion] table[id$=suggest]
tr:eq({0})
+SECOND_SUGGESTION_BOX_PREFORMATTED=jquery\=div[id$\=suggestion] table[id$\=suggest]
tr\:eq({0}) td\:last
SECOND_STATE=jquery=fieldset:eq(1) span[id$=objects]
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties 2010-01-18
16:36:28 UTC (rev 16322)
@@ -6,12 +6,12 @@
# second tab
CUST_EXAMPLE_HEADER=jquery=div#itme > p
-CUST_TABS_ALIGN=jquery=div#itme > table.rich-tabpanel td.rich-tab-bottom-line@align
-CUST_PANEL_TEXT_PREFORMATTED=jquery=div#itme > table.rich-tabpanel > tbody >
tr:eq(1) > td:eq({0})
-CUST_PANEL_TAB_PREFORMATTED=jquery=div#itme > table.rich-tabpanel > tbody form
td[id$=cell]:eq({0}) > table
+CUST_TABS_ALIGN=jquery\=div\#itme table.rich-tabpanel td.rich-tab-bottom-line@align
+CUST_PANEL_TEXT_PREFORMATTED=jquery\=div\#itme table.rich-tabpanel tbody > tr\:eq(1)
> td\:eq({0})
+CUST_PANEL_TAB_PREFORMATTED=jquery\=div\#itme table.rich-tabpanel form
td[id$\=cell]\:eq({0}) > table
# third tab
DELET_EXAMPLE_HEADER=jquery=td.content_tab
DELET_PANEL_TABS=jquery=table[id$=RemoveAbleTabPanel] td[id$=cell]
-DELET_PANEL_TAB_CLOSE_PREFORMATTED=jquery=img[id=tabs_form\:hidelink{0}]
+DELET_PANEL_TAB_CLOSE_PREFORMATTED=jquery\=img[id\=tabs_form\:hidelink{0}]
DELET_RESET_BUTTON=jquery=input[value=Reset Tabs]
\ No newline at end of file
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/testng.xml
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/testng.xml 2010-01-18
14:30:05 UTC (rev 16321)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/testng.xml 2010-01-18
16:36:28 UTC (rev 16322)
@@ -80,6 +80,7 @@
<test
name="org.jboss.richfaces.integrationTest.colorPicker.ColorPickerTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.colorPicker.ColorPickerTestCase"
/>
@@ -194,6 +195,7 @@
<test
name="org.jboss.richfaces.integrationTest.dragSupport.DragSupportTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.dragSupport.DragSupportTestCase"
/>
@@ -210,6 +212,7 @@
<test
name="org.jboss.richfaces.integrationTest.editor.AdvancedEditorTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.editor.AdvancedEditorTestCase"
/>
@@ -217,6 +220,7 @@
</test>
<test
name="org.jboss.richfaces.integrationTest.editor.SimpleEditorTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.editor.SimpleEditorTestCase"
/>
@@ -225,6 +229,7 @@
<test
name="org.jboss.richfaces.integrationTest.extendedDataTable.DraggingTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.extendedDataTable.DraggingTestCase"
/>
@@ -249,6 +254,7 @@
<test
name="org.jboss.richfaces.integrationTest.extendedDataTable.SelectingTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.extendedDataTable.SelectingTestCase"
/>
@@ -265,6 +271,7 @@
<test
name="org.jboss.richfaces.integrationTest.fileUpload.FileUploadTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.fileUpload.FileUploadTestCase"
/>
@@ -303,6 +310,7 @@
<test
name="org.jboss.richfaces.integrationTest.inplaceSelect.InplaceSelectTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.inplaceSelect.InplaceSelectTestCase"
/>
@@ -372,6 +380,7 @@
<test
name="org.jboss.richfaces.integrationTest.orderingList.OrderingListTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.orderingList.OrderingListTestCase"
/>
@@ -560,6 +569,7 @@
<test
name="org.jboss.richfaces.integrationTest.tooltip.TooltipDataTableTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class
name="org.jboss.richfaces.integrationTest.tooltip.TooltipDataTableTestCase"
/>
@@ -567,6 +577,7 @@
</test>
<test
name="org.jboss.richfaces.integrationTest.tooltip.TooltipTestCase">
+ <parameter name="internet-explorer-enabled"
value="false"></parameter>
<classes>
<class name="org.jboss.richfaces.integrationTest.tooltip.TooltipTestCase"
/>
</classes>