Skip to content

Commit

Permalink
auth tests
Browse files Browse the repository at this point in the history
Former-commit-id: 0c8ecbbaae4e1bb3055c018cafc7ec5bd0c4bfee [formerly ec7e74607c32109c1d21099fba4f5ca9ae380704] [formerly 2742a58eb66ff424262f4ad813a6daa726fa1890 [formerly 72912c32507b2a9070f4544c13ce53e7954fb848]] [formerly 01a4525b5dc385aec67c21b1b57d4fe4c0bf4a10 [formerly e75b1e73dfe34fa1e17b2a1353e5295dde383dff] [formerly 3d0ac95d4f692090b64a941dfb7480c02cfa63d8 [formerly 3d0ac95d4f692090b64a941dfb7480c02cfa63d8 [formerly 73b2c52501919fcd7dd07ee667ba0d9393ce6d15]]]]
Former-commit-id: fe1d08b31c897a9047f45218f4317eb57dc953e4 [formerly dbadb1572bf7f699d8f53b4443dd356a5adc8eaf] [formerly 48283e6f8796ee103837f19d8664d3fdbf2758c0 [formerly 5f87977a4e039d6a3e7885d63df15e4d029aa5c0]]
Former-commit-id: 794f8ce76ea28ee2ee7e77835639bcc831b376aa [formerly 7a71588fe9355f1926d67894e0323b8f7fd643e7]
Former-commit-id: 2dbf898bf7da154400883ee844a17629edd8538b
Former-commit-id: de47f06
  • Loading branch information
tkriplean committed Jan 23, 2014
1 parent df94ace commit 2d047e5
Showing 1 changed file with 98 additions and 5 deletions.
103 changes: 98 additions & 5 deletions spec/acceptance/auth_scenario.coffee
Original file line number Diff line number Diff line change
@@ -1,14 +1,107 @@
casper.test.begin 'Authentication tests', 2, (test) ->
###
Tests authentication. Create a new account. Logout. Then log back in with that account.
Not tested here:
- user profile picture upload
- third party authentication
- proper disabling of buttons in various states
###

casper.test.begin 'Authentication tests', 8, (test) ->

casper.start "http://localhost:8787/", ->

casper.wait 500, ->

test.assertExists '[data-target="login"]', "there is an option for logging in"
casper.HTMLCapture '[data-target="login"]',
caption: 'Login opportunity'
casper.then ->
test.assertExists '[data-target="login"]', "there is an option for logging in"
casper.HTMLCapture '[data-target="login"]',
caption: 'Login opportunity'


casper.then ->
# start to create a new account
@mouse.click '[data-target="login"]'
test.assertExists '.auth_overlay', "Create account screen appears"
@HTMLCapture '.auth_overlay',
caption: 'login screen'

@mouse.click 'input#user_email'

@sendKeys 'input#user_email', 'testy_mctesttest@local.dev'


@mouse.click 'input#password_none'

@HTMLCapture '.auth_overlay',
caption: 'login screen after input'

@mouse.click '[data-target="create-account"]'

casper.then ->
# complete paperwork for new user
test.assertExists '.m-user-accounts-complete-paperwork-form', 'Finish paperwork screen appears'

@sendKeys 'input#user_name', 'Testiffer McMuffin'

@sendKeys 'input#user_password', '1234567890'

@mouse.click 'input#pledge1'
@mouse.click 'input#pledge2'
@mouse.click 'input#pledge3'

@HTMLCapture '.auth_overlay',
caption : 'Account paperwork screen'

@mouse.click '[data-target="paperwork_complete"]'

casper.then ->
# verify logged in
casper.wait 500, ->
test.assertExists '.m-user-options-display', 'User is logged in'

@HTMLCapture '#m-user-nav',
caption: 'Nav after login'


casper.then ->
# logout

@mouse.move '.m-user-options'

casper.wait 500, ->
@HTMLCapture 'body',
caption: 'user dropdown options'

test.assertVisible '[data-target="logout"]', 'logout is visible'

@mouse.click '[data-target="logout"]'

casper.wait 500, ->
test.assertExists '[data-target="login"]', 'User has successfully logged out'
@HTMLCapture '#m-user-nav',
caption: 'logged out'

casper.then ->
# now login with that new user
@mouse.click '[data-target="login"]'
test.assertExists '.auth_overlay', "Login screen appears"

@mouse.click 'input#user_email'

@sendKeys 'input#user_email', 'testy_mctesttest@local.dev'

@sendKeys 'input#user_password', '1234567890'

@HTMLCapture '.auth_overlay',
caption: 'login screen after input'

@mouse.click '[data-target="login-submit"]'

casper.wait 500, ->
test.assertExists '.m-user-options-display', 'User is logged in'


test.assertExists '[data-target="NOT EHRE"]', 'blatently failing'


casper.run ->
Expand Down

0 comments on commit 2d047e5

Please sign in to comment.