Skip to content

Instantly share code, notes, and snippets.

@robertwalsh0
Created September 27, 2014 21:45
Show Gist options
  • Save robertwalsh0/5792a677658082516057 to your computer and use it in GitHub Desktop.
Save robertwalsh0/5792a677658082516057 to your computer and use it in GitHub Desktop.
Help w/Protractor.coffee
#Trying to figure out how to get protractor working
# My first test is simple. Visit the page and see if this thing is on the page
# That test works fine.
# The second test is clicking a button and waiting to see if errors appear
# No matter what I try that I find on the net I can't get it to work. Help?
beforeEach ->
# the following command allows us to
# use protractor with our non-angular application
browser.ignoreSynchronization = true
describe "visit homepage", ->
it "should have a enter your info form ", ->
browser.get 'http://localhost:3000'
form = $('form#request-form')
expect(form.isPresent()).toBe(true)
describe "email validation", ->
it "should trigger errors if you don't fill out an email", ->
button = $('input#submit-pdf-form')
errorMsg = $('ul.server-side-errors.animated.fadeInDown')
browser.get 'http://localhost:3000'
button.click()
# wait a second for errors to appear
browser.wait ->
expect(errorMsg.isPresent()).toBe(true)
, 5000
@nickL
Copy link

nickL commented Sep 27, 2014

@robertwalsh0: At first glance have you tried navigating to the page first, then interacting with the elements? I haven't run this locally but something like https://gist.github.com/nickL/816e15138c9f691faf61. Diff: https://gist.github.com/nickL/816e15138c9f691faf61/revisions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment