Balint Erdi wrote:
Hey,

I am writing a simple cucumber feature for a Rails app to test if the
webrat+selenium integration was successful:

 Scenario: Successful log in
    Given the user "pepito" exists # (1)
    And the user "pepito" is active
    When I go to the login page
    And I fill in "login" with "pepito"
    And I fill in "password" with "secret"
    And I press "submit" # (2)
    Then I should see a confirmation message

Now I think I managed to set up the architecture all right (using sep.
setup files for plain and javascript -selenium- features as described
here: http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium).
The problem is that the "Then I should see a confirmation message"
fails.

I put a breakpoint at (2) to investigate the problem. I've found that:

1. the user is succesfully created (User.first in a rails console
gives back pepito)
2. I can log in successfully from the console (User.authenticate
("pepito", "secret") gives back the user meaning successful
authentication.
3. The login and password fields are correctly filled with the values
(checking that in the launched FF browser)
4. If I manually submit the form at the breakpoint, it also fails to
log in, so it's not that the "And I press "submit" step does something
other than submitting the form.
5. the users table in the database that selenium uses is empty.
(mysql> select * from users;
Empty set (0.00 sec) ). That surprises me a bit since in theory
selenium does not use transactional fixtures so the record should
appear right away after (1) runs.

Webrat's Selenium adapter will not change your DB settings. On line 10 on your env.rb file you actually have transactional support turned on. You need to comment that line out when using Selenium. For more info please read about this problem on the wiki:

http://wiki.github.com/aslakhellesoy/cucumber/troubleshooting

HTH,
Ben
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to