Closed nunoveloso closed 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
to run the tests:
casperjs test tests/casperjs/ --uri="http://192.168.99.10/work/aw-datacollection"
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?
@danielfdsilva all good here. Fixed conflicts, pulled master in. Working fine for me.
@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?