fix(core): update

This commit is contained in:
2019-06-03 17:16:47 +02:00
parent 8853eecbb9
commit 54a0ec6c71
9 changed files with 106 additions and 83 deletions

View File

@@ -1,32 +1,30 @@
import { tap, expect } from 'tapbundle';
import * as smartdelay from 'smartdelay';
import { tap, expect } from '@pushrocks/tapbundle';
import * as smartbrowser from '../dist/index';
let testSmartBrowser: smartbrowser.Smartbrowser;
import * as smartbrowser from '../ts/index';
let testSmartBrowser: smartbrowser.SmartBrowser;
tap
.test('should instanstiate a new browser ', async () => {
testSmartBrowser = new smartbrowser.Smartbrowser({
webroot: './test/assets/',
watchFiles: ['./test/assets/']
});
return expect(testSmartBrowser).to.be.instanceof(smartbrowser.Smartbrowser);
testSmartBrowser = new smartbrowser.SmartBrowser();
return expect(testSmartBrowser).to.be.instanceof(smartbrowser.SmartBrowser);
})
.catch(tap.threw);
tap
.test('should start the browser ', async () => {
return await expect(testSmartBrowser.start()).to.eventually.be.fulfilled;
})
.catch(tap.threw);
tap.test('should start the browser ', async () => {
await expect(testSmartBrowser.start()).to.eventually.be.fulfilled;
});
tap.test('should create a PDF from a page', async (tools) => {
const result = await testSmartBrowser.pdfFromPage('https://lossless.com');
expect(result.buffer).to.be.instanceOf(Buffer);
});
tap.test('should produce a valid screenshot', async (tools) => {
const result = await testSmartBrowser.screenshotFromPage('https://lossless.com');
expect(result.buffer).to.be.instanceOf(Buffer);
});
tap.test('should stop the browser ', async () => {
return await smartdelay.delayFor(2000).then(() => {
return expect(testSmartBrowser.stop()).to.eventually.be.fulfilled;
});
});
tap.test('should exit correctly', async () => {
smartdelay.delayFor(2000).then(() => {
process.exit(0);
});
await expect(testSmartBrowser.stop()).to.eventually.be.fulfilled;
});
tap.start();