fix(core): update
This commit is contained in:
parent
157bcff7c4
commit
9b698c6dea
26223
package-lock.json
generated
26223
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -4,9 +4,10 @@
|
|||||||
"description": "simplified puppeteer",
|
"description": "simplified puppeteer",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web)"
|
"build": "(tsbuild --web --allowimplicitany)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -19,15 +20,15 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartbrowser#README",
|
"homepage": "https://gitlab.com/pushrocks/smartbrowser#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^2.0.10",
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartpdf": "^2.0.9",
|
"@pushrocks/smartpdf": "^3.0.0",
|
||||||
"@pushrocks/smartpuppeteer": "^1.0.21",
|
"@pushrocks/smartpuppeteer": "^2.0.0",
|
||||||
"@pushrocks/smartunique": "^3.0.3"
|
"@pushrocks/smartunique": "^3.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.60",
|
||||||
"@gitzone/tstest": "^1.0.52",
|
"@gitzone/tstest": "^1.0.69",
|
||||||
"@pushrocks/tapbundle": "^3.2.14",
|
"@pushrocks/tapbundle": "^5.0.3",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
|
14
test/test.ts
14
test/test.ts
@ -1,25 +1,25 @@
|
|||||||
import { tap, expect } from '@pushrocks/tapbundle';
|
import { tap, expect, expectAsync } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
import * as smartbrowser from '../ts/index';
|
import * as smartbrowser from '../ts/index.js';
|
||||||
let testSmartBrowser: smartbrowser.SmartBrowser;
|
let testSmartBrowser: smartbrowser.SmartBrowser;
|
||||||
|
|
||||||
tap.test('should instanstiate a new browser ', async () => {
|
tap.test('should instanstiate a new browser ', async () => {
|
||||||
testSmartBrowser = new smartbrowser.SmartBrowser();
|
testSmartBrowser = new smartbrowser.SmartBrowser();
|
||||||
return expect(testSmartBrowser).to.be.instanceof(smartbrowser.SmartBrowser);
|
return expect(testSmartBrowser).toBeInstanceOf(smartbrowser.SmartBrowser);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should start the browser ', async () => {
|
tap.test('should start the browser ', async () => {
|
||||||
await expect(testSmartBrowser.start()).to.eventually.be.fulfilled;
|
await testSmartBrowser.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should create a PDF from a page', async (tools) => {
|
tap.test('should create a PDF from a page', async (tools) => {
|
||||||
const result = await testSmartBrowser.pdfFromPage('https://lossless.com');
|
const result = await testSmartBrowser.pdfFromPage('https://lossless.com');
|
||||||
expect(result.buffer).to.be.instanceOf(Buffer);
|
expect(result.buffer).toBeInstanceOf(Buffer);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should produce a valid screenshot', async (tools) => {
|
tap.test('should produce a valid screenshot', async (tools) => {
|
||||||
const result = await testSmartBrowser.screenshotFromPage('https://lossless.com');
|
const result = await testSmartBrowser.screenshotFromPage('https://lossless.com');
|
||||||
expect(result.buffer).to.be.instanceOf(Buffer);
|
expect(result.buffer).toBeInstanceOf(Buffer);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should evalute something in the browser', async () => {
|
tap.test('should evalute something in the browser', async () => {
|
||||||
@ -30,7 +30,7 @@ tap.test('should evalute something in the browser', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should stop the browser ', async () => {
|
tap.test('should stop the browser ', async () => {
|
||||||
await expect(testSmartBrowser.stop()).to.eventually.be.fulfilled;
|
await testSmartBrowser.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as plugins from './smartbrowser.plugins';
|
import * as plugins from './smartbrowser.plugins.js';
|
||||||
|
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SmartBrowser
|
* SmartBrowser
|
||||||
@ -47,7 +47,7 @@ export class SmartBrowser {
|
|||||||
});
|
});
|
||||||
const screenshotBuffer = await page.screenshot({
|
const screenshotBuffer = await page.screenshot({
|
||||||
encoding: 'binary',
|
encoding: 'binary',
|
||||||
});
|
}) as Buffer;
|
||||||
await page.close();
|
await page.close();
|
||||||
return {
|
return {
|
||||||
name: pageId,
|
name: pageId,
|
||||||
|
@ -1 +1 @@
|
|||||||
export * from './interfaces.screenshotresult';
|
export * from './interfaces.screenshotresult.js';
|
||||||
|
Loading…
Reference in New Issue
Block a user