Slide 13
Slide 13 text
casper.addListener('page.initialized', function(){!
! phantomxhr.fake({!
! ! url: "/api/coffee/list",!
! ! responseBody: {!
! ! ! types: [!
! ! ! ! {name: 'Espresso'},!
! ! ! ! {name: 'Latte'},!
! ! ! ! {name: 'Cappuccino'}!
! ! ! ]!
! ! }!
! });!
!
! casper.removeListener('page.initialized');!
});!
!
casper.!
! start( “http://my.coffee.local” ).!
! then(function(){!
! ! casper.click('#coffee-machine-button');!
! ! !
! ! casper.waitForSelector('#myModal:not([style*="display: none"])',!
! ! ! function success(){!
! ! ! ! phantomcss.screenshot('#myModal', 'coffee machine dialog');!
! ! ! },!
! ! ! function timeout(){!
! ! ! ! casper.test.fail('Should see coffee machine');!
! ! ! }!
! ! );!
! });
casper.addListener('page.initialized', function(){!
! phantomxhr.fake({!
! ! url: "/api/coffee/list",!
! ! responseBody: {!
! ! ! types: [!
! ! ! ! {name: 'Espresso'},!
! ! ! ! {name: 'Latte'},!
! ! ! ! {name: 'Cappuccino'}!
! ! ! ]!
! ! }!
! });!
!
! casper.removeListener('page.initialized');!
});!
!
casper.!
! start( “http://my.coffee.local” ).!
! then(function(){!
! ! casper.click('#coffee-machine-button');!
! ! !
! ! casper.waitForSelector('#myModal:not([style*="display: none"])',!
! ! ! function success(){!
! ! ! ! phantomcss.screenshot('#myModal', 'coffee machine dialog');!
! ! ! },!
! ! ! function timeout(){!
! ! ! ! casper.test.fail('Should see coffee machine');!
! ! ! }!
! ! );!
! });
Create an API
stub to feed fake
data to the UI
Generate a screenshot
and compare to existing