Integration tests and login

10 views
Skip to first unread message

Marc

unread,
Mar 14, 2013, 4:32:08 AM3/14/13
to alche...@googlegroups.com
Hi all,

while updating an app to alchemy 2.5 I figured out, that it is quite hard to integration test custom backend modules due to the login process:

In my integration test I want to follow the normal process: go to 'admin', fill in the form, submit it.

By using ids for the fields I can make it to the click_on step...
    fill_in 'user_login', :with => @admin.login
    fill_in 'user_login', :with => @admin.password

But depending on the driver one can not predict which language is used. So it can be both:
    click_on 'Login'
    click_on 'anmelden'
(anything else for non-english/german developers...)

As the login button has no id I can't use the same trick as above.

    begin
      click_on 'Login'
    rescue
      click_on 'anmelden'
    end

works but, well, you know.

What do you think?

Is it an issue with my test? Or with the different drivers (rack_test and poltergeist in my case)? Or with the way I18n::locale is set?

Best
Marc
Reply all
Reply to author
Forward
0 new messages