1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-31 16:51:47 +02:00

Working testing using PhantomJS, previous ones wasn't good enough

This commit is contained in:
Luis
2017-04-23 17:24:39 +02:00
parent 129fc0064c
commit d04d53a1ec
3 changed files with 41 additions and 41 deletions

37
test/utils/webslides.js Normal file
View File

@@ -0,0 +1,37 @@
let phantom = require("phantom");
import test from 'ava';
let ph_, page_, status_;
const load = async () => {
await phantom.create().then(async ph => {
ph_ = ph;
return await ph_.createPage();
}).then(page => {
page_ = page;
return page_.open('https://stackoverflow.com/');
}).then(status => {
status_ = status;
return true;
}).catch(e => console.log(e));
}
test.serial("Page loaded", async t => {
await load();
t.is(status_, 'success');
});
test.serial('#webslides exits', async t => {
await page_
.evaluate( () => document.querySelector('#webslides') )
.then( ws => { t.not(ws, null); } );
});
/**
* Last test
*/
test.serial('Closing', async t => {
await page_.close();
ph_.exit();
t.true(true);
});