Skip to content
Snippets Groups Projects
Commit 65eb8b5c authored by Kevin Hill's avatar Kevin Hill
Browse files

Nightmare works!

parent 8d2722e0
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,9 +2,6 @@ vendor/
build/
.idea/
 
javascript/node_modules/
javascript/phantomjs/renders/
composer.phar
 
*.log
Loading
Loading
node_modules/
renders/
Loading
Loading
@@ -154,21 +154,21 @@ gulp.task('render', done => {
phpServer('renderer.php', 5000, () => {
const chart = 'PieChart';
 
const nightmare = Nightmare({
openDevTools: {
mode: 'detach'
},
show: true
})
.viewport(800, 600)
.on('did-finish-load', (type, message, stack) => {
console.log('did-finish-load');
})
.goto('http://localhost:5000/'+chart)
.end(() => "some value")
//prints "some value"
.then(connect.closeServer)
.then((value) => console.log(value));
const nightmare = Nightmare();
nightmare
.viewport(800, 600)
.on('did-finish-load', () => {
console.log('did-finish-load');
})
.goto('http://localhost:5000/'+chart)
.wait(2000)
.screenshot('./renders/'+chart+'.png')
.end(() => "some value")
//prints "some value"
.then(connect.closeServer)
.then((value) => console.log(value));
});
});
 
Loading
Loading
Loading
Loading
@@ -14,14 +14,15 @@ if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) {
$height = floor($width*(6/19));
 
$title = 'My' . ((strpos($chartType, 'To') > 0) ? 'Dashboard' : $chartType);
$id = strtolower($title);
 
if (strpos($chartType, 'Chart') > 0) {
require_once(__DIR__ . '/Charts/' . $chartType . '.php');
$id = $lava->fetch($chartType, $title)->getElementId();
} else {
require_once(__DIR__ . '/Dashboards/' . $chartType . '.php');
$id = $lava->fetch('Dashboard', $title)->getElementId();
}
$lava->get($title)->setElementId($id);
}
}
?>
Loading
Loading
@@ -46,11 +47,7 @@ if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) {
<? } ?>
</div>
<?php
if (strpos($chartType, 'Chart') > 0) {
echo $lava->render($chartType, $title);
} else {
echo $lava->render('Dashboard', $title);
}
echo $lava->renderAll();
?>
<script type="text/javascript">
lava.ready(function() {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment