1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Fix typo and explain sleep usage in tests

This commit is contained in:
Thomas Walpole 2018-10-09 10:29:25 -07:00
parent 9d5f1b38ae
commit cf2e4d8ba3
8 changed files with 33 additions and 2 deletions

View file

@ -211,7 +211,7 @@ Capybara::SpecHelper.spec '#click_link' do
download_file = File.join(Capybara.save_path, 'download.csv')
expect(File).not_to exist(download_file)
@session.click_link('Download Me')
sleep 2
sleep 2 # allow time for file to download
expect(File).to exist(download_file)
FileUtils.rm_rf download_file
end

View file

@ -1,5 +1,9 @@
# frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior.
Capybara::SpecHelper.spec '#html' do
it 'should return the unmodified page body' do
@session.visit('/')
@ -8,6 +12,7 @@ Capybara::SpecHelper.spec '#html' do
it 'should return the current state of the page', requires: [:js] do
@session.visit('/with_js')
sleep 1
expect(@session.html).to include('I changed it')
expect(@session.html).not_to include('This is text')
end
@ -21,6 +26,7 @@ Capybara::SpecHelper.spec '#source' do
it 'should return the current state of the page', requires: [:js] do
@session.visit('/with_js')
sleep 1
expect(@session.source).to include('I changed it')
expect(@session.source).not_to include('This is text')
end
@ -34,6 +40,7 @@ Capybara::SpecHelper.spec '#body' do
it 'should return the current state of the page', requires: [:js] do
@session.visit('/with_js')
sleep 1
expect(@session.body).to include('I changed it')
expect(@session.body).not_to include('This is text')
end

View file

@ -1,5 +1,9 @@
# frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior.
Capybara::SpecHelper.spec 'node' do
before do
@session.visit('/with_html')
@ -478,7 +482,7 @@ Capybara::SpecHelper.spec 'node' do
expect(@session.find(:css, '#address1_city').value).to eq 'Oceanside'
end
it 'should hold modifers at top level' do
it 'should hold modifiers at top level' do
@session.visit('/form')
@session.find(:css, '#address1_city').send_keys('ocean', :shift, 'side')
expect(@session.find(:css, '#address1_city').value).to eq 'oceanSIDE'

View file

@ -1,5 +1,9 @@
# frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior.
Capybara::SpecHelper.spec '#refresh' do
it 'reload the page' do
@session.visit('/form')

View file

@ -1,5 +1,9 @@
# frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior.
Capybara::SpecHelper.spec '#switch_to_window', requires: [:windows] do
before do
@window = @session.current_window

View file

@ -1,5 +1,9 @@
# frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior.
Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
before do
@window = @session.current_window

View file

@ -1,5 +1,9 @@
# frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior.
Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
before do
@window = @session.current_window

View file

@ -1,5 +1,9 @@
# frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior.
Capybara::SpecHelper.spec '#windows', requires: [:windows] do
before do
@window = @session.current_window