So it can access the site and enter an username, but fails with the password.

Does it work well when using some other browsers?

You can try to make a screenshot at the point of failure. For example:

```ruby
def login_as(user, password="test", redirect_to = nil)
    redirect_to ||= edit_user_path(user)
    browser.goto login_path(:redirect_to => redirect_to)

    browser.text_field(:name, "email").set user.email
    browser.text_field(:name, "password").set password

    browser.button(:value, "Login").click
  rescue
    puts "saving the screenshot"
    browser.screenshot.save("/tmp/phantomjs.png")
    puts "screenshot saved"
    exit
  end
```

Does that work?

You can also enable debug mode in Ruby, which might show more information to 
you:

```ruby
$DEBUG = true
browser = Watir::Browser.new :phantomjs
```

You might also experiment of setting the `$DEBUG` to `true` just in `login_as` 
method, but i'm not sure if that will affect anything after the browser has 
already been started.

Can you also check if the Rails test environment itself is working properly 
after the test has failed. Do it like this:

```ruby
def login_as(user, password="test", redirect_to = nil)
    redirect_to ||= edit_user_path(user)
    browser.goto login_path(:redirect_to => redirect_to)

    browser.text_field(:name, "email").set user.email
    browser.text_field(:name, "password").set password

    browser.button(:value, "Login").click
  rescue
    puts Watir::Rails.running?
    puts `wget -O- http://127.0.0.1/#{Watir::Rails.port}`
    exit
  end
```

I'm not sure about multiple `phantomjs` processes. Are you closing the browser 
at the end of your test? I guess if you are not, then the process won't be 
exited either.

---
Reply to this email directly or view it on GitHub:
https://github.com/watir/watir-rails/issues/4#issuecomment-21659030
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to