• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

trotzig / diffux / 369
99%

Build:
DEFAULT BRANCH: master
Ran 13 Apr 2014 05:52AM UTC
Jobs 2
Files 32
Run time 16s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
369

push

travis-ci

trotzig
Wait until page is ready before taking snapshot

Before this commit, we used to wait five seconds before taking the
snapshot. We did this to make sure that asynchronously loaded
elements had time to render on the page. This solved most of the
problems, but we always wanted something more robust. This commit
attempts to replace the timeout-based solution with one that listens
events fired when resources are fetched, and trigger the snapshot as
soon as we're no longer waiting for anything.

PhantomJS has two methods that you can implement to solve things like
this: `onResourceRequested` and `onResourceReceived`. We implement these
and keep a list of active resources. As soon as a (potentially) last
resource is received, we start a short timer which will trigger the
snapshot to be taken. If another resource is needed within the timeframe
of that running timer, we cancel the snapshot-taking and start waiting
for the response for the (potentially) last resource once more.

If this strategy for some reason fails, there's a 20 second fallback
timer that will trigger the snapshot. And in case no resources are
requested from the page at all, there is a 1 second initial timer that
will trigger the snapshot.

All in all, a fairly complicated structure. My initial testing shows a
significant improvement though. Fast pages are snapshotted way faster
(down to 2.5 seconds) and I haven't noticed any issues with more
complicated pages.

608 of 616 relevant lines covered (98.7%)

91.99 hits per line

Jobs
ID Job ID Ran Files Coverage
1 369.1 (2.0.0) 13 Apr 2014 05:52AM UTC 0
98.7
Travis Job 369.1
2 369.2 (2.1.0) 13 Apr 2014 05:52AM UTC 0
98.7
Travis Job 369.2
Source Files on build 369
  • Tree
  • List 0
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Travis Build #369
  • 391c4d9b on github
  • Prev Build on master (#368)
  • Next Build on master (#370)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc