Sha256: bffd50d582e7394c1aad940fd350ddb48f7fbd7787f93f0e4787e28945ad5ba3
Contents?: true
Size: 1.95 KB
Versions: 7
Compression:
Stored size: 1.95 KB
Contents
require 'watirspec_helper' describe 'Alert API' do before do browser.goto WatirSpec.url_for('alerts.html') end after do browser.alert.ok if browser.alert.exists? end context 'Waits' do context 'when acting on an alert' do it 'raises exception after timing out' do expect { browser.alert.text }.to wait_and_raise_unknown_object_exception end end end context 'alert' do describe '#text' do it 'returns text of alert' do browser.button(id: 'alert').click expect(browser.alert.text).to include('ok') end end describe '#exists?' do it 'returns false if alert is not present' do expect(browser.alert).to_not exist end it 'returns true if alert is present' do browser.button(id: 'alert').click browser.wait_until(timeout: 10) { browser.alert.exists? } end end describe '#ok' do it 'closes alert' do browser.button(id: 'alert').click browser.alert.ok expect(browser.alert).to_not exist end end describe '#close' do it 'closes alert' do browser.button(id: 'alert').click browser.alert.close expect(browser.alert).to_not exist end end end context 'confirm' do describe '#ok' do it 'accepts confirm' do browser.button(id: 'confirm').click browser.alert.ok expect(browser.button(id: 'confirm').value).to eq 'true' end end describe '#close' do it 'cancels confirm' do browser.button(id: 'confirm').click browser.alert.close expect(browser.button(id: 'confirm').value).to eq 'false' end end end context 'prompt' do describe '#set' do it 'enters text to prompt' do browser.button(id: 'prompt').click browser.alert.set 'My Name' browser.alert.ok expect(browser.button(id: 'prompt').value).to eq 'My Name' end end end end
Version data entries
7 entries across 7 versions & 1 rubygems