Permalink
Browse files

change name

  • Loading branch information...
1 parent c9071ca commit c3c84c79af9b6d21376e99950f58064ec02aab3a @MathildeLemee MathildeLemee committed Dec 27, 2011
Showing with 4,661 additions and 0 deletions.
  1. +22 −0 etc/jetty.xml
  2. +257 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/Fluent.java
  3. +64 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/FluentPage.java
  4. +49 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/action/FillConstructor.java
  5. +29 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/action/FluentDefaultActions.java
  6. +25 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/annotation/Page.java
  7. +219 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/domain/FluentList.java
  8. +192 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/domain/FluentWebElement.java
  9. +26 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/exception/ConstructionException.java
  10. +89 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/Filter.java
  11. +87 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/FilterBuilder.java
  12. +175 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/FilterConstructor.java
  13. +43 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/FilterPredicate.java
  14. +24 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/FilterType.java
  15. +172 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/MatcherConstructor.java
  16. +107 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/CalculateService.java
  17. +42 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/ContainsMatcher.java
  18. +40 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/EndsWithMatcher.java
  19. +40 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/EqualMatcher.java
  20. +82 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/Matcher.java
  21. +39 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/MatcherType.java
  22. +40 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/NotContainsMatcher.java
  23. +40 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/NotEndsWithMatcher.java
  24. +40 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/NotStartsWithMatcher.java
  25. +49 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/filter/matcher/StartsWithMatcher.java
  26. +106 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/search/Search.java
  27. +28 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/search/SearchActions.java
  28. +172 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/test/FluentTest.java
  29. +68 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/wait/FluentLeniumWait.java
  30. +109 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/wait/FluentLeniumWaitBuilder.java
  31. +189 −0 fluentlenium-core/src/main/java/org/fluentlenium/core/wait/FluentWaitBuilder.java
  32. +55 −0 fluentlenium-core/src/test/java/org/integration/ActionOnListTest.java
  33. +53 −0 fluentlenium-core/src/test/java/org/integration/ActionOnListWithBddTest.java
  34. +56 −0 fluentlenium-core/src/test/java/org/integration/ActionOnSelectorTest.java
  35. +46 −0 fluentlenium-core/src/test/java/org/integration/ActionOnSelectorWithBddTest.java
  36. +78 −0 fluentlenium-core/src/test/java/org/integration/FluentLeniumWaitOnLabsTest.java
  37. +130 −0 fluentlenium-core/src/test/java/org/integration/FluentLeniumWaitTest.java
  38. +53 −0 fluentlenium-core/src/test/java/org/integration/FluentListParamTest.java
  39. +137 −0 fluentlenium-core/src/test/java/org/integration/FluentSelectorTest.java
  40. +37 −0 fluentlenium-core/src/test/java/org/integration/JavascriptTest.java
  41. +98 −0 fluentlenium-core/src/test/java/org/integration/PageTest.java
  42. +43 −0 fluentlenium-core/src/test/java/org/integration/ParamTest.java
  43. +63 −0 fluentlenium-core/src/test/java/org/integration/SearchTest.java
  44. +227 −0 fluentlenium-core/src/test/java/org/integration/SelectorOnLabsTest.java
  45. +61 −0 fluentlenium-core/src/test/java/org/integration/StateOnElementTest.java
  46. +31 −0 fluentlenium-core/src/test/java/org/integration/localTest/LocalFluentCase.java
  47. +49 −0 fluentlenium-core/src/test/java/org/sample/BingTest.java
  48. +33 −0 fluentlenium-core/src/test/java/org/unit/AfterTest.java
  49. +110 −0 fluentlenium-core/src/test/java/org/unit/CheckFindSelector.java
  50. +113 −0 fluentlenium-core/src/test/java/org/unit/FluentListSearch.java
  51. +184 −0 fluentlenium-core/src/test/java/org/unit/GlobalSearch.java
  52. +71 −0 fluentlenium-core/src/test/java/org/unit/GoToTest.java
  53. +84 −0 fluentlenium-core/src/test/java/org/unit/PreFilterAnalyse.java
  54. +59 −0 fluentlenium-core/src/test/java/org/unit/initialization/AnnotationInitialization.java
  55. +76 −0 fluentlenium-core/src/test/java/org/unit/initialization/BeforeInitialization.java
  56. +38 −0 fluentlenium-core/src/test/java/org/unit/initialization/ConstructorInitialization.java
  57. +12 −0 fluentlenium-core/src/test/java/org/unit/initialization/TestExternalPage.java
View
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License
+
+-->
+
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<Configure id="Server" class="org.mortbay.jetty.Server">
+
+</Configure>
@@ -0,0 +1,257 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.fluentlenium.core;
+
+import org.fluentlenium.core.action.FillConstructor;
+import org.fluentlenium.core.action.FluentDefaultActions;
+import org.fluentlenium.core.domain.FluentList;
+import org.fluentlenium.core.domain.FluentWebElement;
+import org.fluentlenium.core.filter.Filter;
+import org.fluentlenium.core.search.Search;
+import org.fluentlenium.core.search.SearchActions;
+import org.fluentlenium.core.wait.FluentLeniumWait;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+
+import java.util.List;
+
+/**
+ * Util Class which offers some shortcut to webdriver methods
+ */
+public abstract class Fluent implements SearchActions {
+ private WebDriver driver;
+ private Search search;
+ private FluentLeniumWait wait;
+
+ public Fluent(WebDriver driver) {
+ this.driver = driver;
+ this.search = new Search(driver);
+ this.wait = new FluentLeniumWait(driver,search);
+ }
+
+ public Fluent() {
+ }
+
+ protected final void setDriver(WebDriver driver) {
+ this.driver = driver;
+ this.search = new Search(driver);
+ if (driver != null) {
+ this.wait = new FluentLeniumWait(driver,search);
+ }
+ }
+
+ protected WebDriver getDriver() {
+ return driver;
+ }
+
+ public FluentLeniumWait await() {
+ return wait;
+ }
+
+
+ /**
+ * Return the title of the page
+ *
+ * @return
+ */
+ protected String title() {
+ return driver.getTitle();
+ }
+
+ /**
+ * Return the url of the page
+ *
+ * @return
+ */
+ protected String url() {
+ return driver.getCurrentUrl();
+ }
+
+ /**
+ * Return the source of the page
+ *
+ * @return
+ */
+ protected String pageSource() {
+ return driver.getPageSource();
+ }
+
+ public void executeScript(String script) {
+ ((JavascriptExecutor) driver).executeScript(script);
+ }
+
+ /**
+ * Central methods to find elements on the page. Can provide some filters. Able to use css1, css2, css3, see WebDriver restrictions
+ *
+ * @param name
+ * @param filters
+ * @return
+ */
+ public FluentList $(String name, final Filter... filters) {
+ return search.find(name, filters);
+ }
+
+
+ /**
+ * Central methods a find element on the page, the number indicat the index of the desired element on the list. Can provide some filters. Able to use css1, css2, css3, see WebDriver restrictions
+ *
+ * @param name
+ * @param filters
+ * @return
+ */
+ public FluentWebElement $(String name, Integer number, final Filter... filters) {
+ return search.find(name, number, filters);
+ }
+
+
+ /**
+ * return the lists corresponding to the cssSelector with it filters
+ *
+ * @param name
+ * @param filters
+ * @return
+ */
+ public FluentList find(String name, final Filter... filters) {
+ return search.find(name, filters);
+ }
+
+ /**
+ * Return the elements at the numner position into the the lists corresponding to the cssSelector with it filters
+ *
+ * @param name
+ * @param number
+ * @param filters
+ * @return
+ */
+ public FluentWebElement find(String name, Integer number, final Filter... filters) {
+ return search.find(name, number, filters);
+ }
+
+ /**
+ * Return the first elements corresponding to the name and the filters
+ *
+ * @param name
+ * @param filters
+ * @return
+ */
+ public FluentWebElement findFirst(String name, final Filter... filters) {
+ return search.findFirst(name, filters);
+ }
+
+ /**
+ * Construct a FillConstructor in order to allow easy fill
+ * Be careful - only the visible elements are filled
+ *
+ * @param cssSelector
+ */
+ public FillConstructor fill(String cssSelector, Filter... filters) {
+ return new FillConstructor(cssSelector, getDriver(), filters);
+ }
+
+ /**
+ * Construct a FillConstructor in order to allow easy fill
+ * Be careful - only the visible elements are filled
+ *
+ * @param list
+ */
+ public FillConstructor fill(FluentDefaultActions list, Filter... filters) {
+ return new FillConstructor(list, getDriver(), filters);
+ }
+
+ /**
+ * click all elements that are in cssSelector with its filters
+ * Be careful - only the visible elements are clicked
+ *
+ * @param cssSelector
+ */
+ public void click(String cssSelector, Filter... filters) {
+ $(cssSelector, filters).click();
+ }
+
+ /**
+ * Submit all elements that are in cssSelector with its filters
+ * Be careful - only the visible elements are cleared
+ *
+ * @param cssSelector
+ */
+ public void clear(String cssSelector, Filter... filters) {
+ $(cssSelector, filters).clear();
+ }
+
+ /**
+ * Submit all elements that are in cssSelector with its filters
+ * Be careful - only the visible elements are submitted
+ *
+ * @param cssSelector
+ */
+ public void submit(String cssSelector, Filter... filters) {
+ $(cssSelector, filters).submit();
+ }
+
+ /**
+ * get a list all elements that are in cssSelector with its filters
+ * Be careful - only the visible elements are submitted
+ * //TODO UTILITY ? Deprecated ?
+ *
+ * @param cssSelector
+ */
+ public List<String> text(String cssSelector, Filter... filters) {
+ return $(cssSelector, filters).getTexts();
+ }
+
+ /**
+ * Value all elements that are in cssSelector with its filters
+ * Be careful - only the visible elements are returned
+ * //TODO UTILITY ? Deprecated ?
+ *
+ * @param cssSelector
+ */
+ public List<String> value(String cssSelector, Filter... filters) {
+ return $(cssSelector, filters).getValues();
+ }
+
+
+ /**
+ * click all elements that are in the list
+ * Be careful - only the visible elements are clicked
+ *
+ * @param fluentObject
+ */
+ public void click(FluentDefaultActions fluentObject) {
+ fluentObject.click();
+ }
+
+ /**
+ * Submit all elements that are in the list
+ * Be careful - only the visible elements are cleared
+ *
+ * @param fluentObject
+ */
+ public void clear(FluentDefaultActions fluentObject) {
+ fluentObject.clear();
+ }
+
+ /**
+ * Submit all elements that are in the list
+ * Be careful - only the visible elements are submitted
+ *
+ * @param fluentObject
+ */
+ public void submit(FluentDefaultActions fluentObject) {
+ fluentObject.submit();
+ }
+
+
+}
@@ -0,0 +1,64 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.fluentlenium.core;
+
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Use the Page Object Pattern to have more resilient tests.
+ */
+public abstract class FluentPage extends Fluent {
+
+ public FluentPage() {
+ super();
+ }
+
+ public FluentPage(WebDriver driver) {
+ super(driver);
+ }
+
+ /**
+ * Url of the Page
+ *
+ * @return
+ */
+ public String getUrl() {
+ return null;
+ }
+
+ /**
+ * Should check if the navigator is on correct page.
+ * <p/>
+ * For example :
+ * assertThat(title()).isEqualTo("Page 1");
+ * assertThat("#reallyImportantField").hasSize(1);
+ */
+ public void isAt() {
+ }
+
+ /**
+ * Go to the url defined in the page
+ */
+ public final void go() {
+ if (getUrl() == null) {
+ throw new IllegalArgumentException("No URL have been defined for this page");
+ }
+ getDriver().get(getUrl());
+ }
+
+
+
+
+}
@@ -0,0 +1,49 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.fluentlenium.core.action;
+
+import org.fluentlenium.core.filter.Filter;
+import org.openqa.selenium.WebDriver;
+
+public class FillConstructor extends org.fluentlenium.core.Fluent {
+ private String cssSelector;
+ private Filter[] filters;
+ private FluentDefaultActions fluentList;
+
+ public FillConstructor(String cssSelector, WebDriver webDriver, Filter... filters) {
+ super(webDriver);
+ this.cssSelector = cssSelector;
+ this.filters = filters;
+ }
+
+ public FillConstructor(FluentDefaultActions list, WebDriver driver, Filter[] filters) {
+ super(driver);
+ this.filters = filters.clone();
+ this.fluentList = list;
+ }
+
+ /**
+ * Set the values params as text for the fluentList or search a new list with the css selector and filters and add the values param on it
+ *
+ * @param values
+ */
+ public void with(String... values) {
+ if (fluentList != null) {
+ fluentList.text(values);
+ } else {
+ $(cssSelector, filters).text(values);
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit c3c84c7

Please sign in to comment.