flipside-org / aw-datacollection

The Airwolf application that handles data collection.
http://demo.flipside.org/airwolf
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

1st batch of CasperJS #52

Closed nunoveloso closed 10 years ago

danielfdsilva commented 10 years ago

@nunoveloso Checked out the code, looks simple and easy to understand. However, the tests need to run from the vagrant box. Could you provide installation instructions and how to test?

danielfdsilva commented 10 years ago
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install -y nodejs

sudo npm install -g casperjs

sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2
sudo tar -xf phantomjs-1.9.7-linux-i686.tar.bz2
sudo rm phantomjs-1.9.7-linux-i686.tar.bz2
sudo mv phantomjs-1.9.7-linux-i686/ /opt/phantomjs
sudo ln -s /opt/phantomjs/bin/phantomjs /usr/bin/phantomjs
danielfdsilva commented 10 years ago

to run the tests:

casperjs test tests/casperjs/ --uri="http://192.168.99.10/work/aw-datacollection"
danielfdsilva commented 10 years ago

Running from Vagrant box Tests fail:

Test file: /vagrant/aw-datacollection/tests/casperjs/users/login.js             
# AW login
Checking login form.
PASS Found username field
PASS Found password field
PASS Found submit field
Attempting login without credentials.
PASS Checking if we are still on login page.
FAIL No element matching selector found: div.error[data-ref="signin_username"]
#    type: uncaughtError
#    file: /vagrant/aw-datacollection/tests/casperjs/users/login.js:1152
#    error: No element matching selector found: div.error[data-ref="signin_username"]
#           CasperError: No element matching selector found: div.error[data-ref="signin_username"]
#               at getHTML (/usr/lib/node_modules/casperjs/modules/casper.js:1152)
#               at test_field_error (/vagrant/aw-datacollection/tests/casperjs/users/login.js:136)
#               at /vagrant/aw-datacollection/tests/casperjs/users/login.js:57
#               at runStep (/usr/lib/node_modules/casperjs/modules/casper.js:1553)
#               at checkStep (/usr/lib/node_modules/casperjs/modules/casper.js:399)
#    stack: not provided
PASS Checking if we are still on login page.
PASS Found password error: The Password field is required.
Attempting login without username.
PASS Checking if we are still on login page.
PASS Found username error: The Username field is required.
Attempting login with unknown username.
PASS Checking if we are still on login page.
PASS Found password error: Invalid username or password.
Attempting login with known username but bad password.
PASS Checking if we are still on login page.
PASS Found password error: Invalid username or password.
Attempting login with correct credentials.
FAIL log in successful: logout button was found
#    type: assertExists
#    file: /vagrant/aw-datacollection/tests/casperjs/users/login.js:111
#    code: test.assertExists('a#logout-button', "log in successful: logout button was found")
#    subject: false
#    selector: "a#logout-button"
FAIL 14 tests executed in 1.361s, 12 passed, 2 failed, 0 dubious, 0 skipped.    

Details for the 2 failed tests:

In /vagrant/aw-datacollection/tests/casperjs/users/login.js:1152
  AW login
    uncaughtError: No element matching selector found: div.error[data-ref="signin_username"]
In /vagrant/aw-datacollection/tests/casperjs/users/login.js:111
  AW login
    assertExists: log in successful: logout button was found

@nunoveloso Could you check the problem?

nunoveloso commented 10 years ago

@danielfdsilva all good here. Fixed conflicts, pulled master in. Working fine for me.