Skip to content
Snippets Groups Projects
Commit 31a8b7f0 authored by efalcy's avatar efalcy
Browse files

dev#12831 : move files to pique project

parent 35008b61
Branches
Tags
3 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!39Dev#12831 Css Tests Tool,!28Dev#12831 Css Tests Tool
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* AFI-OPAC 2.0 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class CssTest {
protected $config = [
'urls' => [['url' => 'index/index',
'title' => 'HomePage'],
['url'=> 'recherche/simple/expressionRecherche/pomme',
'title' => 'SearchPomme']],
'skins' => ['moulins',
'montauban',
'vide'
]
];
public function __construct() {
foreach ($this->config['skins'] as $skin) {
$this->runTestForSkin($skin,$this->config['urls']);
}
}
public function runTestForSkin($skin,$urls) {
foreach ($urls as $url) {
$this->runTestForSkinAndUrl($skin,$url);
}
}
public function runTestForSkinAndUrl($skin,$url) {
echo "Run test for skin: ".$skin."\n\turl:".$url['url']."\n";
echo exec('casperjs test ~/afi/afi-opac3/scripts/css-tests/testsuite-opac.js --url="'.$url['url'].'" --skin='.$skin." --page_title=".$url['title']);
echo "\n";
}
}
new CssTest();
?>
\ No newline at end of file
/*
Require and initialise PhantomCSS module
Paths are relative to CasperJs directory
*/
var phantomcss = require('/usr/local/lib/node_modules/phantomcss/phantomcss.js');
skin=casper.cli.get("skin");
url=casper.cli.get("url");
page_title=casper.cli.get("page_title");
var path_to_phantomcss='/usr/local/lib/node_modules/phantomcss';
var base_url="http://localhost/afi-opac3/";
//var url=casper.cli.get("url");
phantomcss.init({
libraryRoot: path_to_phantomcss,
screenshotRoot: '/tmp/screenshots-'+skin,
/*
If failedComparisonsRoot is not defined failure images can still be found alongside the original and new images
*/
failedComparisonsRoot: '/tmp/failures-'+skin,
/*
Don't add label to generated failure image
*/
addLabelToFailedImage: false,
/*
Mismatch tolerance defaults to 0.05%. Increasing this value will decrease test coverage
*/
mismatchTolerance: 0.05,
/*
Callbacks for your specific integration
onFail: function(test){ console.log(test.filename, test.mismatch); },
onPass: function(){ console.log("OK"); },
onTimeout: function(){ console.log("Time out"); },
onComplete: function(allTests, noOfFails, noOfErrors){
allTests.forEach(function(test){
if(test.fail){
console.log(test.filename, test.mismatch);
}
});
},
*/
/*
Change the output screenshot filenames for your specific integration
*/
fileNameGetter: function(root,filename){
// globally override output filename
// files must exist under root
// and use the .diff convention
var name = root+'/'+filename;
if(fs.isFile(name+'.png')){
return name+'.diff.png';
} else {
return name+'.png';
}
},
/*
Output styles for image failure outputs genrated by Resemble.js
*/
outputSettings: {
errorColor: {
red: 255,
green: 255,
blue: 0
},
errorType: 'movement',
transparency: 0.3
}
});
casper.start(base_url+url+'/skin/'+skin);
casper.viewport(1024, 768);
console.log(base_url+url+'/skin/'+skin);
casper.then(function() {
phantomcss.screenshot('body', page_title);
});
casper.then( function now_check_the_screenshots(){
// compare screenshots
phantomcss.compareAll();
});
casper.then( function end_it(){
casper.test.done();
});
casper.run(function(){
console.log('\nTHE END.');
phantom.exit(phantomcss.getExitStatus());
});
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment