Created
February 22, 2013 00:57
-
-
Save gongo/5009937 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: アラートとコンフォーム | |
Scenario: hoge | |
Given アクセス | |
When alertボタンをクリック | |
Then あらーーーと | |
Scenario: fuga | |
Given アクセス | |
When confirmボタンをクリック | |
Then こんふぉーーむ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Georgia Point Kure</title> | |
<meta charset='UTF-8'> | |
</head> | |
<body> | |
<input type="button" id="alert_button" onclick="alert('aiueo')" value="alert" /> | |
<input type="button" id="confirm_button" onclick="if (confirm('ok?')) { document.getElementById('confirm_result').innerHTML = 'ok'; } else { document.getElementById('confirm_result').innerHTML = 'no...'; }" value="confirm" /> | |
<div id="confirm_result"></div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
step "アクセス" do | |
visit 'http://localhost:5000' | |
end | |
step "alertボタンをクリック" do | |
click_button 'alert_button' | |
end | |
step "confirmボタンをクリック" do | |
click_button 'confirm_button' | |
end | |
step "あらーーーと" do | |
alert = page.driver.browser.switch_to.alert | |
expect(alert.text).to eq("aiueo") | |
alert.accept | |
end | |
step "こんふぉーーむ" do | |
alert = page.driver.browser.switch_to.alert | |
expect(alert.text).to eq("ok?") | |
alert.accept # <= confirm ダイアログの OK | |
#alert.dismiss # <= confirm ダイアログの キャンセル | |
expect(find('#confirm_result')).to have_text('ok') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment