akephalos icon indicating copy to clipboard operation
akephalos copied to clipboard

Could you add a way to test for a prompt?

Open therubymug opened this issue 13 years ago • 1 comments

In Selenium, it's like this:

selenium.get_alert.should eql("Are you sure?")

I would think it'd be more appropriate to have one for alert, prompt, and confirm.

therubymug avatar Sep 22 '10 18:09 therubymug

I've got a few ideas for this; but there are other ways of solving this sort of requirement, such as this step definition for testing confirmations:

Given /^I will press 'ok' for the "([^"]*)" confirmation$/ do |message|
  page.execute_script <<-JS
  window.confirm = function(msg) {
    if ( msg === #{message.to_json} )
      return true;
    else
      return false;
  }
  JS
end

bernerdschaefer avatar Nov 24 '10 21:11 bernerdschaefer