use_implicit_waits = false properly supports section and sections
EDIT: Also made some syntax changes and amended some cop failures
MODIFY
features/explicit_waiting.feature
features/explicit_waiting.feature
@@ -96,3 +96,13 @@ Feature: Waiting for Elements
When I navigate to the home page
Then the slow elements are not waited for
And implicit waits are not enabled
+
+ Scenario: Section Is Not Automatically Waited For
+ When I navigate to the home page
+ Then the slow section is not waited for
+ And implicit waits are not enabled
+
+ Scenario: Sections Collections Are Not Automatically Waited For
+ When I navigate to the home page
+ Then the slow sections are not waited for
+ And implicit waits are not enabled

MODIFY
features/implicit_waiting.feature
features/implicit_waiting.feature
@@ -13,3 +13,18 @@ Feature: Waiting for Elements Implicitly
When I navigate to the home page
Then the slow elements are waited for
And implicit waits are enabled
+
+ Scenario: Sections Are Automatically Waited For
+ When I navigate to the home page
+ Then the slow section is waited for
+ And implicit waits are enabled
+
+ Scenario: Sections Collections Are Automatically Waited For
+ When I navigate to the home page
+ Then the slow sections are waited for
+ And implicit waits are enabled
+
+ Scenario: Wait time can be overridden at run-time
+ When I navigate to the home page
+ Then the slow element is waited for only as long as a user set Capybara.using_wait_time
+ And implicit waits are enabled

MODIFY
features/step_definitions/wait_steps.rb
features/step_definitions/wait_steps.rb
@@ -203,3 +203,37 @@ Then(/^the slow elements are not waited for$/) do
expect { @test_site.home.slow_elements(count: 1) }.to raise_error(Capybara::ElementNotFound)
expect(Time.now - start_time).to be < 0.5
end
+
+
+Then(/^the slow section is waited for$/) do
+ start_time = Time.now
+ @test_site.home.slow_section(count: 1)
+ expect(Time.now - start_time).to be > 1.5
+end
+
+Then(/^the slow section is not waited for$/) do
+ start_time = Time.now
+ expect { @test_site.home.slow_section(count: 1) }.to raise_error(Capybara::ElementNotFound)
+ expect(Time.now - start_time).to be < 0.5
+end
+
+Then(/^the slow sections are waited for$/) do
+ start_time = Time.now
+ @test_site.home.slow_sections(count: 2)
+ expect(Time.now - start_time).to be > 1.5
+end
+
+Then(/^the slow sections are not waited for$/) do
+ start_time = Time.now
+ expect { @test_site.home.slow_sections(count: 2) }.to raise_error(Capybara::ElementNotFound)
+ expect(Time.now - start_time).to be < 0.5
+end
+
+Then(/^the slow element is waited for only as long as a user set Capybara.using_wait_time$/) do
+ start_time = Time.now
+ Capybara.using_wait_time(1) do
+ expect { @test_site.home.some_slow_element }.to raise_error(Capybara::ElementNotFound)
+ end
+ expect(Time.now - start_time).to be < 2
+ expect(Time.now - start_time).to be > 0.5
+end

MODIFY
test_site/html/home.htm
test_site/html/home.htm
var t3 = setTimeout("document.getElementById('will_become_invisible').style.display='none';", 2000);
var t4 = setTimeout("document.getElementById('will_become_nonexistent').remove();", 2000);
var t5 = setTimeout("document.getElementById('link_container_will_become_nonexistent').remove();", 2000);
+
+ var slow_section = document.createElement("div");
+ slow_section.className = 'slow-section first';
+ var slow_section2 = document.createElement("div");
+ slow_section2.className = 'slow-section second';
+ setTimeout(function() {
+ [slow_section, slow_section2].forEach(function(item) {
+ dumping_ground.appendChild(item);
+ });
+ }, 2000)
}
window.onload = load;
</script>

MODIFY
test_site/pages/home.rb
test_site/pages/home.rb
@@ -9,7 +9,7 @@ class TestHomePage < SitePrism::Page
element :welcome_message, 'body > span'
element :go_button, '[value="Go!"]'
element :link_to_search_page, :xpath, '//p[2]/a'
- # This takes just over 2 seconds to appear
+ # Below element takes just over 2 seconds to appear
element :some_slow_element, :xpath, '//a[@class="slow"]'
element :invisible_element, 'input.invisible'
element :shy_element, 'input#will_become_visible'
@@ -25,7 +25,8 @@ class TestHomePage < SitePrism::Page
elements :welcome_headers, :xpath, '//h3'
elements :welcome_messages, :xpath, '//span'
elements :rows, 'td'
- elements :slow_elements, :xpath, '//a[@class="slow"]' # note - actually only one
+ # note - actually only one of the below
+ elements :slow_elements, :xpath, '//a[@class="slow"]'
# elements that should not exist
element :squirrel, 'squirrel.nutz'
@@ -43,12 +44,16 @@ class TestHomePage < SitePrism::Page
section :removing_section,
NoElementWithinSection,
'input#will_become_nonexistent'
+ # `slow_section` takes ~2s to appear
+ section :slow_section, NoElementWithinSection, 'div.first.slow-section'
# section groups
sections :nonexistent_sections, NoElementWithinSection, 'input#nonexistent'
sections :removing_sections,
NoElementWithinSection,
'#link_container_will_become_nonexistent > a'
+ # `slow_sections` takes ~2s to appear
+ sections :slow_sections, NoElementWithinSection, 'div.slow-section'
# iframes
iframe :my_iframe, MyIframe, '#the_iframe'

use_implicit_waits = false properly supports section and sections

EDIT: Also made some syntax changes and amended some cop failures