Note that there are some explanatory texts on larger screens.

plurals
  1. POCapybara does not seem to be waiting (as it should do!?) (Async ajax event)
    primarykey
    data
    text
    <p>We have a background process that we poll and reload a chart when the processing (from another server, UNIX process) is completed.</p> <p>I cannot get Capybrara to properly wait (despite the general consensus that it should)</p> <p>Its an AJAX event that polls the DB and then refreshes the page content when its completed. The timing, even for testing, is varied - a <code>sleep n.seconds</code> sometimes works, but not always.</p> <ul> <li>I have tried <code>expect(page.has_content)</code>, <code>assert page.has_text</code>, <code>find</code>, and <code>has_content</code>. None seem to actually wait.</li> <li>I have timeout set to 90 seconds. Generally the background process is more than 20 seconds.</li> <li>I have tried different <code>default_wait_time</code></li> </ul> <p>I have found lots of articles claiming that it should wait within its default polling / time-out. Is there something we should be checking? Note we are headless via Poltergeist.</p> <p>There is no CSS object that changes on the display, its just a string (this is taken from a <code>puts page.html</code> to debug the tests)</p> <p>From this</p> <pre><code> &lt;div class="bill-summary-strap-line"&gt; Calculating your bill costs &lt;br/&gt; &lt;/div&gt; </code></pre> <p>To this</p> <pre><code>&lt;div class="bill-summary-strap-line"&gt; Calculating finished &lt;br/&gt; &lt;/div&gt; </code></pre> <p>What are we missing?</p> <p>RSpec code below, really hope someone has some guidance having solved this type of problem. Cheers Ben</p> <pre><code> puts page.html # test #assert page.has_text?('Calculating your bill costs') expect(page).to have_content 'Calculating your bill costs' page.driver.render("#{LOGDIR}/output1.png", :full =&gt; true) sleep 30.seconds # would like to remove this puts page.html # test output #page.should have_content("Calculating finished") #expect(page.has_content? "Calculating finished").to be_true assert page.has_text?("Calculating finished") page.driver.render("#{LOGDIR}/output2.png", :full =&gt; true) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload