开发者

How to test Dialogs in Cucumber?

开发者 https://www.devze.com 2023-03-24 02:07 出处:网络
I am using jquery UI dialogs in Rails. How do you use cucumber to test for opening dialogs? I have a re开发者_StackOverflow社区gistration dialog and after that another confirmation dialog. The latter

I am using jquery UI dialogs in Rails.

How do you use cucumber to test for opening dialogs? I have a re开发者_StackOverflow社区gistration dialog and after that another confirmation dialog. The latter appearing after successful signup.

However I noticed that when cucumber presses sign up button to submit, it never really tests for the other pop up dialog. And if I disabled the opening of the 2nd dialog, cucumber still passes. It seems the modal is invisible but it can be seen by cucumber. Has anyone encountered this?

Thanks in advance!


Introduce wrapper step - it will basically evaluate step with scoping it to dialog container.

 Then /^(.*) within the dialog$/ do |wrapped_step, selector_text|
   with_scope(".jquery-ui-dialog-class") do
     Then wrapped_step
   end
 end

After that you'll be able to add steps like

 Then I should see "Confirmation text" within the dialog
 When I press "Ok" within the dialog

P.S: Don't forget to put correct class into the step, I forget which one is used in jQuery UI but I believe that it should be something like ".dialog"

0

精彩评论

暂无评论...
验证码 换一张
取 消