happybara-plugin-timers

1.0.1 • Public • Published

happybara-timers

Clean up zombie timers in your Happybara Session.

This plugin will make sure the following timers are properly cleaned up so that the tests won't bleed:

  • window.setTimeout
  • window.setInterval
  • window.requestAnimationFrame

Example

import { assert } from 'chai';

feature('Application', function(page) {
  scenario('I do not have to worry about deferred timers', async function() {
    // in reality, your application logic is expected to trigger the timer
    // but for this example's purposes, we'll do it manually:
    setTimeout(function() {
      console.log('boo')
    }, 500);

    assert.ok(true);
  });

  // 500ms later, "boo" will never be logged
})

API

clearTimers() -> void

Readme

Keywords

none

Package Sidebar

Install

npm i happybara-plugin-timers

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • amireh