forked from Laverna/laverna
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first green test with phantomcss. Laverna#1
- Loading branch information
filtercake
committed
Apr 16, 2014
1 parent
dcbf665
commit 4bb2cfc
Showing
5 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$ ./node_modules/casperjs/bin/casperjs test test/visual/testsuite.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
Notes: | ||
- phantomjs and caspar via homebrew | ||
- npm install phantomcss | ||
- bower install phantomcss | ||
[note i installed these locally via npm. @filtercake] | ||
*/ | ||
|
||
|
||
/* | ||
Require and initialise PhantomCSS module | ||
Paths are relative to CasperJs directory | ||
*/ | ||
var phantomcss = require('./../../phantomcss/phantomcss.js'); | ||
|
||
phantomcss.init({ | ||
/* | ||
screenshotRoot: '/screenshots', | ||
failedComparisonsRoot: '/failures' | ||
casper: specific_instance_of_casper, | ||
*/ | ||
// libraryRoot: './../../phantomcss' | ||
libraryRoot: './node_modules/phantomcss' | ||
/* | ||
fileNameGetter: function overide_file_naming(){}, | ||
onPass: function passCallback(){}, | ||
onFail: function failCallback(){}, | ||
onTimeout: function timeoutCallback(){}, | ||
onComplete: function completeCallback(){}, | ||
hideElements: '#thing.selector', | ||
addLabelToFailedImage: true, | ||
outputSettings: { | ||
errorColor: { | ||
red: 255, | ||
green: 255, | ||
blue: 0 | ||
}, | ||
errorType: 'movement', | ||
transparency: 0.3 | ||
} | ||
*/ | ||
}); | ||
|
||
|
||
/* | ||
The test scenario | ||
*/ | ||
// casper.start( './demo/coffeemachine.html' ); | ||
casper.start( 'http://localhost:9000/#notes' ); | ||
|
||
casper.viewport(1024, 768); | ||
|
||
casper.then(function(){ | ||
phantomcss.screenshot('#header-title', '001-header-title'); | ||
}); | ||
|
||
// casper.then(function(){ | ||
// phantomcss.screenshot('#coffee-machine-button', '001.1 coffee machine button, button only'); | ||
// }); | ||
|
||
// casper.then(function(){ | ||
// casper.click('#coffee-machine-button'); | ||
|
||
// // wait for modal to fade-in | ||
// casper.waitForSelector('#myModal:not([style*="display: none"])', | ||
// function success(){ | ||
// phantomcss.screenshot('#myModal', '002 coffee machine dialog'); | ||
// }, | ||
// function timeout(){ | ||
// casper.test.fail('Should see coffee machine'); | ||
// } | ||
// ); | ||
// }); | ||
|
||
// casper.then(function(){ | ||
// casper.click('#cappuccino-button'); | ||
// phantomcss.screenshot('#myModal', '003 cappuccino success'); | ||
// }); | ||
|
||
// casper.then(function(){ | ||
// casper.click('#close'); | ||
|
||
// // wait for modal to fade-out | ||
// casper.waitForSelector('#myModal[style*="display: none"]', | ||
// function success(){ | ||
// phantomcss.screenshot('#coffee-machine-wrapper', '004 coffee machine close success'); | ||
// }, | ||
// function timeout(){ | ||
// casper.test.fail('Should be able to walk away from the coffee machine'); | ||
// } | ||
// ); | ||
// }); | ||
|
||
casper.then( function now_check_the_screenshots(){ | ||
// compare screenshots | ||
phantomcss.compareAll(); | ||
}); | ||
|
||
casper.then( function end_it(){ | ||
casper.test.done(); | ||
}); | ||
|
||
/* | ||
Casper runs tests | ||
*/ | ||
casper.run(function(){ | ||
console.log('\nTHE END.'); | ||
phantom.exit(phantomcss.getExitStatus()); | ||
}); | ||
|