-
Notifications
You must be signed in to change notification settings - Fork 6
Design proposal
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:
-
Change the subject to accept casper (and perhaps casper.page) i.e.
expect(casper)...
-
'title' => eg
expect(casper).to.have.title("abc-def")
andexpect(casper).to.have.title.match(/Google/)
a. 'title' - chainingmethod b. 'title' - method
-
'url' => same as title
-
'loaded' =>
expect(casper).to.have.loaded('styles.css')
-
'status' =>
expect(casper).to.have.httpStatus(200)
-
trueOnRemote
andmatchOnRemote
=>expect(casper).eval(STMT).to.be.true
andexpect(casper).eval(STMT).to.equal(xyz)
-
'textInDom' =>
expect(casper).to.have.text('xyz')
-
'fieldValue' =>
expect(casper).fieldValueByName('name').to.equal('abc')
-
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