Skip to content
This repository has been archived by the owner on Aug 13, 2018. It is now read-only.

Commit

Permalink
WebDriverHelper, wait behavior tests and other stuff introduced
Browse files Browse the repository at this point in the history
added test for multiple fixtures support with selenium table. Attributes test merged into one test. Doc improved

added run script. Send keys action enhanced to work with file upload remote driver (resolves #21 and resolves #22)
  • Loading branch information
andrealbinop authored and Andre Albino Pereira committed Sep 21, 2015
1 parent 02f808a commit d2844b6
Show file tree
Hide file tree
Showing 41 changed files with 737 additions and 588 deletions.
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
language: java
jdk:
- oraclejdk8
- oraclejdk8
env:
global:
- secure: lk5sOGWmEGWHerSPY5QGjZPPTcNo3HokKpmiue7nAfgmwp2l/jvYQuvTCV639KcxegTzDfFR7nIheaw+tqHjudePnP4Py0yWEPduVZUI5Vbs6awyt8t7JcwTaWLQILTpSzjc4iXR6cTi/h+DUEjYRgxSbhPKk4IlBeRQ3FvTIAXoegZoTLjmBGR8b/Azs7DzU3fAntZnOK8PKRFj6U4ZsUJg6ESKLs0gPFMfgK7Q6STQ4T1qC1tlfCb2ToflILb2mcccwIGDtDSWQksnL4FS9EXTi0RaJ/DkWP1bctsvW9ACrvG0mjzZLSO0yQ5tua/Q0WgClU1C0bXikFOSPLBEP8Lec7Abhnd1P0xMEN/9lQ3JEj822eZayrqGpuxNPvGW5Mi6NESZyx4AJPNwwIAGwYibAV01bQj0dZLlvY8AcdbesYaQGf+opTaK0E6OoTxlzVverWDj/+O+OO4b0JvL+6GeP0ohhQkKhobW5Bh3gVbbLPX/VsIPoV66jAhFqLXA3h9OHILedorfh6UvkssOOzn/IuOJPKm0AhRnLSslNBTrvARDCOriz3wCs8DHF6IfCL9FILabkf3kqoVW8JbJ64PrPkGPxQoqxOF5jSDssjH7Fn6bCSX8yXluwt1cCUL42V8pLKng/1kHOOFSvVe57mcJM7jOQkdcZ5p9ediVYZ8=
- M2_REPO: ~/.m2
- PARENT_POM_VERSION: 0.4.1
- M2_REPO: "~/.m2"
- PARENT_POM_VERSION: 0.5.0
- secure: M6R3YjHqMzdayjhLH/7rtbEoh1HNab53DmDZ536Ii+84wG/Xe/qxFcos+BkfHJweEx+3AnC6hZW8zli/65pX4XPQ2CvVzk6RF2veYWNqOtnCj6M/WICY6thRz3C+HFb2/mCsPu3bBxRt62qUt4YlGHXhpFasPNQFu7/LAgrht3cUbhzNJ5Zv9AjjWVOqHA/31onvqYEDiySDxuN6N1ArB01pev3lRpqJtUl94hScoGNABTLo66Fp2MerGyo6m5PyGi0AcFLVTqxHPakI5pkQFiOJCMS/LkU7LctRHR64c5fCvn95x4Dr/4HEEC2FNY7Ztt6mf53BXjbSm06t9FxddsrrMd3QMRLqXHyha10BVb9Kt15/Wy7uxMtM0FnTtXaRYYPZC/3S5NV9FqvtjEv68+FVSkS0Rwmu1UrruG09dIsszIeYlJWQagbA5VDL31DS5DVahsBGi0bFTXlEh1jgTIT0YKXcsWwzUy7u6vlPDFrc0zJAa8DBnZ1L1RIhggc+SR0uTlb7q94F6WoI1Cr+Z2HQD3hmB9UpMgq7+IgjANklu+m83+XeDjmJJKY/SfrXOsgiwYfl8SOHBpkNTawlo6pniFCQatP+C5BFhkznPHBZjSzMU6NBYJmXUpHh1bwdUv22t4rJQCVvlgn4i/9ctcweZk5hU36w6O4DxxEpXIU=

before_install:
- openssl aes-256-cbc -K $encrypted_46b0bb06b333_key -iv $encrypted_46b0bb06b333_iv -in src/deploy/private.key.enc -out src/deploy/private.key -d
- gpg --import src/deploy/private.key && gpg --import src/deploy/public.key
- mvn dependency:get -Dartifact=com.github.andreptb:andreptb-component-parent:$PARENT_POM_VERSION:xml:mvn-settings
- cp $M2_REPO/repository/com/github/andreptb/andreptb-component-parent/$PARENT_POM_VERSION/andreptb-component-parent-$PARENT_POM_VERSION-mvn-settings.xml $M2_REPO/settings.xml
- openssl aes-256-cbc -K $encrypted_46b0bb06b333_key -iv $encrypted_46b0bb06b333_iv -in src/deploy/private.key.enc -out src/deploy/private.key -d
- gpg --import src/deploy/private.key && gpg --import src/deploy/public.key
- mvn dependency:get -Dartifact=com.github.andreptb:andreptb-component-parent:$PARENT_POM_VERSION:xml:mvn-settings
- cp $M2_REPO/repository/com/github/andreptb/andreptb-component-parent/$PARENT_POM_VERSION/andreptb-component-parent-$PARENT_POM_VERSION-mvn-settings.xml $M2_REPO/settings.xml
install:
- mvn dependency:resolve dependency:resolve-plugins
- mvn dependency:resolve dependency:resolve-plugins
script:
- mvn deploy site-deploy
- mvn deploy site-deploy
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Take a look at [this](fitnesse/FitNesseRoot/FitNesseSeleniumSlim/BasicUsageSampl
<dependency>
<groupId>com.github.andreptb</groupId>
<artifactId>fitnesse-selenium-slim</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
| start browser | firefox |
| open | http://www.google.com |
| type | selenium web browser | in | id=lst-ib |
| check | value | id=lst-ib | selenium web browser |
| check | value | id=lst-ib | selenium web browser |
| show | screenshot |
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
| selenium |
| note | since the browser is not started, none of the commands below should work |
| reject | open | http://google.com |
| reject | open window | http://google.com |
| reject | select window | http://google.com |
| reject | open | http://www.roboform.com/filling-test-custom-fields |
| reject | browser available |
| reject | open window | http://www.roboform.com/filling-test-custom-fields |
| reject | select window | http://www.roboform.com/filling-test-custom-fields |
| check | current window | null |
| check | title | null |
| check | current url | null |
| reject | close |
| reject | close browser tab |
| reject | type | some text |
| reject | send keys | some text |
| reject | click |
| check | value | id=lst-ib | null |
| check | text | id=lst-ib | null |
| check | value | name=01___title | null |
| check | text | name=01___title | null |
| check | screenshot | null |
| reject | present | id=lst-ib |
| reject | present | name=01___title |
| reject | select | index=1 | in | name=ttl_select |
| check | selected | index | in | name=ttl_select | null |

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
| selenium |
| note | since test should throw an exception, must be tested manually |
| start browser | invalid browser |
| reject | browser available |
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
!define WAIT_TIMEOUT {5}

Since all actions should fail, this test must be ran manually. Besides each command should take at least ${WAIT_TIMEOUT} seconds to complete, not desirable for CI.

The expected result of this test is the following:
- ensure that each actions tries ${WAIT_TIMEOUT} seconds to complete before failing
- ensure that check failures show the difference of expected and obtained values.
- ensure that inputing elements throws the exception indicating the element to input was not found.

| selenium |
| start browser | ${BROWSER} | with | name='fitnesse-selenium-slim-tests' browserName='firefox' |
| open | http://www.roboform.com/filling-test-custom-fields |
| set wait timeout | ${WAIT_TIMEOUT} |
| check | current window | invalidWindowId |
| check | last command duration | ${WAIT_TIMEOUT} |
| check | title | invalidTitle |
| check | last command duration | ${WAIT_TIMEOUT} |
| check | current url | http://invalidUrl |
| check | last command duration | ${WAIT_TIMEOUT} |
| ensure | type | some text | in | name=invalidField |
| check | last command duration | ${WAIT_TIMEOUT} |
| ensure | send keys | some text | in | name=invalidField |
| check | last command duration | ${WAIT_TIMEOUT} |
| type | some text | in | name=field1 |
| check not | value | name=field1 | some text |
| check | last command duration | ${WAIT_TIMEOUT} |
| check | text | css=h1.mcs | invalid text |
| check | last command duration | ${WAIT_TIMEOUT} |
| check | text | id=invalidField | whatever text |
| check | last command duration | ${WAIT_TIMEOUT} |
| reject | present | name=01___title |
| check | last command duration | ${WAIT_TIMEOUT} |
| ensure | select | index=1 | in | id=invalidField |
| check | last command duration | ${WAIT_TIMEOUT} |
| check | selected | index | in | id=invalidField | 1 |
| check | last command duration | ${WAIT_TIMEOUT} |
| check | selected | index | in | name=ttl_select | 10 |
| check | last command duration | ${WAIT_TIMEOUT} |
| quit browser |
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<properties>
<AddChild/>
<Edit/>
<Files/>
<Properties/>
<Prune/>
<Refactor/>
<Search/>
<Suite/>
<Test/>
<Versions/>
<WhereUsed/>
</properties>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!contents -R2 -g -p -f -h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<properties>
<Edit/>
<Files/>
<Help>Tests intended to be ran and analyzed manually for specific reasons</Help>
<Properties/>
<Prune/>
<RecentChanges/>
<Refactor/>
<Search/>
<Suite/>
<Suites>manual</Suites>
<Versions/>
<WhereUsed/>
</properties>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
| selenium |
| open | http://saucelabs.com |
| check | attribute | class | in | id=signup | callout |
| check | attribute | class | in | css=#signup | callout |
| check | attribute | href | in | xpath=//li[@id='signinout']/a | !-https://saucelabs.com/login-! |
| check | attribute | href | in | //li[@id='signinout']/a | !-https://saucelabs.com/login-! |

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
| selenium |
| open | http://saucelabs.com/login |
| ensure | not present | id=fieldNotOnThePage |
| ensure | not present | id=username@attributeNotOnField |
| note | should return false if id=username exists |
| reject | not present | id=username |
| note | should return false if id=username has class attribute |
| reject | not present | id=username@class |
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
| selenium |
| open | http://saucelabs.com/login |
| ensure | present | id=username |
| ensure | present | id=username@class |
| note | should return false if id=fieldNotOnThePage dont exist |
| reject | present | id=fieldNotOnThePage |
| reject | present | id=fieldNotOnThePage@class |
| note | should return false if id=username@attributeNotOnField dont exist |
| reject | present | id=username@attributeNotOnField |
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Besides testing input file upload, this test also covers javascript running with "run script action".

| scenario | set input file visibility | visibility |
| run script | document.querySelector("span[flow-btn] input[type='file']").style.visibility = "@visibility"; |

| selenium |
| open | http://flowjs.github.io/ng-flow/ |
| set input file visibility | visible |
| ensure | type | fitnesse/plugins.properties | in | css=span[flow-btn] input[type='file'] |
| set input file visibility | hidden |
| run script | window.scrollTo(0,document.body.scrollHeight); |
| check | text | css=div.transfer-box | =~/^plugins.properties.+/ |
| check | attribute | aria-valuenow | in | css=div.transfer-box .progress-bar | 100 |
| show | screenshot |
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Xebium tests disabled for ci, enable when running locally.

|import|
| note | com.xebia.incubator.xebium|

|library|
|jdbc fixture|


| scenario | do jdbc stuff |
| connect jdbc on | db | with url | jdbc:hsqldb:mem:testdb | and driver | org.hsqldb.jdbcDriver | and username | sa | and password | sa |
| run in | db | the sql | CREATE TABLE USER (ID BIGINT IDENTITY, NAME VARCHAR(255) NOT NULL, PASSWORD VARCHAR(255) NOT NULL) |

| scenario | do xebium stuff |
| start browser | firefox | on url | http://www.google.com/ |
| ensure | do | open | on | / |
| ensure | do | type | on | id=lst-ib | with | Xebium |
| ensure | do | click | on | name=btnG |
| stop browser |

| selenium |
| open | http://www.roboform.com/filling-test-all-fields |
| send keys | mytitle${KEY_TAB} | in | name=01___title |
| do jdbc stuff |
| note | do xebium stuff |
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<properties>
<Edit/>
<Files/>
<Help/>
<Properties/>
<Refactor/>
<Search/>
<Suites/>
<Test/>
<Versions/>
<WhereUsed/>
</properties>
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
| selenium |
| open | http://www.roboform.com/filling-test-all-fields |
| show | screenshot |
| send keys | mytitle${KEY_TAB} | in | name=01___title |
| check | value | name=01___title | mytitle |
| send keys | myname |
| check | value | name=02frstname | myname |
| send keys | ${KEY_HOME}preppended |
| check | value | name=02frstname | preppendedmyname |
| show | screenshot |
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
!define WAIT_TIMEOUT {5}

| selenium |
| start browser | ${BROWSER} | with | name='fitnesse-selenium-slim-tests' browserName='firefox' |
| note | changes timeout configuration for 5 seconds (default is 20) |
| set wait timeout | 5 |
| set wait timeout | ${WAIT_TIMEOUT} |
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
| selenium |
| quit |
| quit browser |
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
| $googleWindowId= | current window |
| ensure | select window | https://saucelabs.com/login |
| check | text | css=#login-section h1 | Welcome back. |
| ensure | close |
| ensure | close browser tab |
| select window | $googleWindowId |
| ensure | present | id=lst-ib |
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
| note | tests selector with regex |
| ensure | select window | =~/Sauce Labs.+/ |
| check | text | css=#login-section h1 | Welcome back. |
| ensure | close |
| ensure | close browser tab |
| select window | Google |
| ensure | present | id=lst-ib |
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
| check | title | Google |
| ensure | select window | https://saucelabs.com/login |
| check | text | css=#login-section h1 | Welcome back. |
| ensure | close |
| ensure | close browser tab |
| select window | =~/https://www.google.com.+/ |
| ensure | present | id=lst-ib |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!define TEST_SYSTEM {slim}

!***> classpath config
!pomFile pom.xml@runtime
!pomFile pom.xml@test
***!

!contents -R2 -g -p -f -h
16 changes: 14 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<parent>
<groupId>com.github.andreptb</groupId>
<artifactId>andreptb-component-parent</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>
</parent>
<artifactId>fitnesse-selenium-slim</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>
<name>fitnesse-selenium-slim</name>
<description>FitNesse Selenium fixture in slim format. Allows running selenium commands similar to firefox IDE plugin.</description>
<url>https://github.com/andreptb/fitnesse-selenium-slim</url>
Expand Down Expand Up @@ -90,6 +90,18 @@
<version>1.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.github.andreptb</groupId>
<artifactId>fitnesse-jdbc-slim</artifactId>
<version>0.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.3</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>

0 comments on commit d2844b6

Please sign in to comment.