Skip to content
brianmhunt edited this page Dec 21, 2012 · 2 revisions

Overview

This is a design document, a sort of TODO, proposing to list the nature of a set of tests for casper-chai when moving from version 0.1 to 0.2. This document is really my inner-dialog on the design -- and suggestions are most welcome.

Enumerated To-do:

  1. Change the subject to accept casper (and perhaps casper.page) i.e. expect(casper)...

  2. 'title' => eg expect(casper).to.have.title("abc-def") and expect(casper).to.have.title.match(/Google/)

    a. 'title' - chainingmethod b. 'title' - method

  3. 'url' => same as title

  4. 'loaded' => expect(casper).to.have.loaded('styles.css')

  5. 'status' => expect(casper).to.have.httpStatus(200)

  6. trueOnRemote and matchOnRemote => expect(casper).eval(STMT).to.be.true and expect(casper).eval(STMT).to.equal(xyz)

  7. 'textInDom' => expect(casper).to.have.text('xyz')

  8. 'fieldValue' => expect(casper).fieldValueByName('name').to.equal('abc')

  9. Selectors & 'tagName', 'attr', etc.

  • tagName expect(casper).selector("#xyz").to.always.have.tagName('h1')
  • attr expect(casper).any.selector("xyz .div").to.have.attr('href')
  • class expect(casper).selector("#xyz").to.always.have.class('menu')
  • length expect(casper).selector("#xyx .selected").to.have.length(1)
  • exist expect(casper).selector("#xyx .div").to.exist
  • visible expect(casper).selector("#xyz").to.be.visible

Chai Plugin guidelines

Clone this wiki locally