Compare commits

...

22 Commits

Author SHA1 Message Date
243beb2c75 1.0.33 2021-11-07 18:50:23 +01:00
c6fd1bea7a fix(core): update 2021-11-07 18:50:22 +01:00
4f94fa31ac 1.0.32 2021-11-07 18:38:16 +01:00
ac61d8ff4d fix(core): update 2021-11-07 18:38:15 +01:00
107178e9e7 1.0.31 2021-11-07 18:33:26 +01:00
0b5c030d5d fix(core): update 2021-11-07 18:33:25 +01:00
94f145c3dc 1.0.30 2021-11-07 18:30:09 +01:00
ebd60756ea fix(core): update 2021-11-07 18:30:08 +01:00
8305dd105c 1.0.29 2021-11-07 15:58:45 +01:00
797cac672b fix(core): update 2021-11-07 15:58:45 +01:00
4b1f058a21 1.0.28 2021-11-07 15:46:31 +01:00
c38f338f8e 1.0.27 2021-08-17 17:51:50 +02:00
103c7eb11e fix(core): update 2021-08-17 17:51:50 +02:00
0190f1bb77 1.0.26 2021-08-17 15:22:10 +02:00
87d7460183 fix(core): update 2021-08-17 15:22:10 +02:00
ed1522062e 1.0.25 2021-08-17 12:20:54 +02:00
116f700d5c fix(core): update 2021-08-17 12:20:54 +02:00
366a033904 1.0.24 2021-08-17 02:53:34 +02:00
5f1f4b3c53 fix(core): update 2021-08-17 02:53:34 +02:00
255bd7046e 1.0.23 2021-08-17 02:51:24 +02:00
bb82845f27 1.0.22 2021-08-17 02:50:49 +02:00
8ec23ba414 fix(core): update 2021-08-17 02:50:49 +02:00
8 changed files with 19072 additions and 3593 deletions

View File

@@ -7,54 +7,10 @@ cache:
key: '$CI_BUILD_STAGE' key: '$CI_BUILD_STAGE'
stages: stages:
- security - only
- test
- release
- metadata
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
# ====================
# test stage
# ====================
testStable: testStable:
stage: test stage: only
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install stable - npmci node install stable
@@ -64,74 +20,3 @@ testStable:
tags: tags:
- docker - docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

24
.vscode/launch.json vendored
View File

@@ -2,28 +2,10 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "current file", "command": "npm test",
"type": "node", "name": "Run npm test",
"request": "launch", "request": "launch",
"args": [ "type": "node-terminal"
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
} }
] ]
} }

22468
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartpuppeteer", "name": "@pushrocks/smartpuppeteer",
"version": "1.0.21", "version": "1.0.33",
"private": false, "private": false,
"description": "simplified access to puppeteer", "description": "simplified access to puppeteer",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@@ -13,18 +13,18 @@
"format": "(gitzone format)" "format": "(gitzone format)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.28",
"@gitzone/tstest": "^1.0.52", "@gitzone/tstest": "^1.0.59",
"@pushrocks/tapbundle": "^3.2.9", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^14.14.20", "@types/node": "^16.11.6",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16", "@pushrocks/smartenv": "^4.0.16",
"@types/puppeteer": "^5.4.2", "puppeteer": "^11.0.0",
"puppeteer": "^5.5.0" "tree-kill": "^1.2.2"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

View File

@@ -5,7 +5,15 @@ tap.test('first test', async (tools) => {
const headlessBrowser = await smartpuppeteer.getEnvAwareBrowserInstance({ const headlessBrowser = await smartpuppeteer.getEnvAwareBrowserInstance({
forceNoSandbox: true, forceNoSandbox: true,
}); });
const page = await headlessBrowser.newPage();
await headlessBrowser.close(); await headlessBrowser.close();
}); });
tap.test('should get and stop an Incognito browser', async () => {
const incognitoInstance = new smartpuppeteer.IncognitoBrowser();
await incognitoInstance.start();
const page = await incognitoInstance.browser.newPage();
await incognitoInstance.stop();
});
tap.start(); tap.start();

View File

@@ -13,7 +13,7 @@ export class IncognitoBrowser {
public async start() { public async start() {
this.status = 'started'; this.status = 'started';
this.browser = await getEnvAwareBrowserInstance(); this.browser = await getEnvAwareBrowserInstance();
this.browser.addListener('disconnected', async (eventArg) => { this.browser.on('disconnected', async (eventArg) => {
try { try {
this.browser.removeAllListeners(); this.browser.removeAllListeners();
} catch (err) {} } catch (err) {}
@@ -28,13 +28,14 @@ export class IncognitoBrowser {
*/ */
public async stop() { public async stop() {
this.status = 'stopped'; this.status = 'stopped';
plugins.treeKill(this.browser.process().pid, 'SIGKILL');
await this.browser.close(); await this.browser.close();
} }
/** /**
* rotate * rotate
*/ */
public async rotateBrowser () { public async rotateBrowser() {
this.browser.close().catch(); this.browser.close().catch();
this.browser = await getEnvAwareBrowserInstance(); this.browser = await getEnvAwareBrowserInstance();
} }

View File

@@ -25,7 +25,9 @@ export const getEnvAwareBrowserInstance = async (
console.log(chromeArgs); console.log(chromeArgs);
headlessBrowser = await plugins.puppeteer.launch({ headlessBrowser = await plugins.puppeteer.launch({
args: chromeArgs, args: chromeArgs,
pipe: true pipe: true,
headless: true,
// executablePath: '/usr/bin/google-chrome'
}); });
return headlessBrowser; return headlessBrowser;

View File

@@ -11,5 +11,6 @@ export { smartdelay, smartenv };
// third party scope // third party scope
import puppeteer from 'puppeteer'; import puppeteer from 'puppeteer';
import treeKill from 'tree-kill';
export { puppeteer }; export { puppeteer, treeKill };