akephalos
akephalos copied to clipboard
Could you add a way to test for a prompt?
trafficstars
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.
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