File tree Expand file tree Collapse file tree 11 files changed +50
-35
lines changed Expand file tree Collapse file tree 11 files changed +50
-35
lines changed Original file line number Diff line number Diff line change 8
8
types : [published]
9
9
10
10
jobs :
11
- build :
12
- runs-on : ubuntu-latest
13
- steps :
14
- - uses : actions/checkout@v2
15
- - uses : actions/setup-node@v1
16
- with :
17
- node-version : 12
18
- - run : npm ci
19
- - run : npm test
20
-
21
11
publish-npm :
22
12
needs : build
23
13
runs-on : ubuntu-latest
27
17
with :
28
18
node-version : 12
29
19
registry-url : https://registry.npmjs.org/
30
- - run : npm ci
31
- - run : npm publish
20
+ - run : npm install
21
+ - name : publish
22
+ run : |
23
+ sudo apt-get update
24
+ sudo apt-get install -y libgbm-dev
25
+ npm run lint
26
+ npm publish
32
27
env :
33
28
NODE_AUTH_TOKEN : ${{secrets.npm_token}}
34
29
41
36
with :
42
37
node-version : 12
43
38
registry-url : https://npm.pkg.github.com/
44
- - run : npm ci
45
- - run : npm publish
39
+ - run : npm install
40
+ - name : publish
41
+ run : |
42
+ sudo apt-get update
43
+ sudo apt-get install -y libgbm-dev
44
+ npm run lint
45
+ npm publish
46
46
env :
47
47
NODE_AUTH_TOKEN : ${{secrets.GITHUB_TOKEN}}
Original file line number Diff line number Diff line change
1
+ 2.13.2 / 2020-10-24
2
+ ===================
3
+
4
+ * Minor fix in Dockerfile
5
+ * Puppeteer updated to 5.3.1
6
+ * RegExp parameters checks fixed when using vm
7
+ * Dependencies updated
8
+
1
9
2.13.1 / 2020-08-08
2
10
===================
3
11
Original file line number Diff line number Diff line change @@ -44,5 +44,4 @@ RUN apt-get update && apt-get install -y -q --no-install-recommends\
44
44
&& rm -rf /var/lib/apt/lists/*
45
45
46
46
ENV NO_SANDBOX=true
47
- ENV PUPPETEER_SKIP_DOWNLOAD=true
48
47
RUN npm install wendigo && npm cache clean --force
Original file line number Diff line number Diff line change
1
+ import isRegExp from 'lodash.isregexp' ;
1
2
import BrowserNavigation from './browser_navigation' ;
2
3
import DomElement from '../../models/dom_element' ;
3
4
import { TimeoutError , WendigoError , QueryError } from '../../models/errors' ;
@@ -62,7 +63,7 @@ export default abstract class BrowserWait extends BrowserNavigation {
62
63
timeout = this . _getTimeout ( timeout ) ;
63
64
if ( ! url ) return Promise . reject ( new WendigoError ( "waitForUrl" , `Invalid parameter url.` ) ) ;
64
65
let parsedUrl : string | RegExp | { source : string , flags : string } = url ;
65
- if ( url instanceof RegExp ) {
66
+ if ( isRegExp ( url ) ) {
66
67
parsedUrl = {
67
68
source : url . source ,
68
69
flags : url . flags
Original file line number Diff line number Diff line change
1
+ import isRegExp from 'lodash.isregexp' ;
1
2
import { Request , ResourceType } from '../../puppeteer_wrapper/puppeteer_types' ;
2
3
import { matchText } from '../../utils/utils' ;
3
4
import { ExpectedHeaders } from './types' ;
4
5
5
6
function processBody ( body : string | RegExp | object ) : string | RegExp {
6
- if ( typeof body === 'object' && ! ( body instanceof RegExp ) ) {
7
+ if ( typeof body === 'object' && ! isRegExp ( body ) ) {
7
8
return JSON . stringify ( body ) ;
8
9
} else return body ;
9
10
}
Original file line number Diff line number Diff line change 1
1
import { EventEmitter } from 'events' ;
2
+ import isRegExp from 'lodash.isregexp' ;
2
3
import { URL } from 'url' ;
3
4
import { Request } from '../../puppeteer_wrapper/puppeteer_types' ;
4
5
@@ -178,7 +179,7 @@ export default class RequestMock implements RequestMockInterface {
178
179
}
179
180
180
181
private _parseUrlQueryString ( url : string | RegExp ) : { [ s : string ] : string ; } | undefined {
181
- if ( url instanceof RegExp ) return undefined ;
182
+ if ( isRegExp ( url ) ) return undefined ;
182
183
else {
183
184
const parsedUrl = new URL ( url ) ;
184
185
if ( parsedUrl . search ) {
@@ -188,7 +189,7 @@ export default class RequestMock implements RequestMockInterface {
188
189
}
189
190
190
191
private _parseUrl ( url : string | RegExp ) : string | RegExp {
191
- if ( url instanceof RegExp ) {
192
+ if ( isRegExp ( url ) ) {
192
193
return url ;
193
194
} else {
194
195
const parsedUrl = new URL ( url ) ;
Original file line number Diff line number Diff line change
1
+ import isRegExp from 'lodash.isregexp' ;
1
2
import { URL } from 'url' ;
2
3
import { parseQueryString , compareObjects , matchText } from '../../utils/utils' ;
3
4
import RequestMock from './request_mock' ;
@@ -91,7 +92,7 @@ export default class RequestMocker {
91
92
if ( existsPriority !== null ) return existsPriority ;
92
93
const methodPriority = this . _checkElementPriority ( m1 . method , m2 . method ) ;
93
94
if ( methodPriority !== null ) return methodPriority ;
94
- const urlPriority = this . _checkElementPriority ( ! ( m1 . url instanceof RegExp ) , ! ( m2 . url instanceof RegExp ) ) ;
95
+ const urlPriority = this . _checkElementPriority ( ! isRegExp ( m1 . url ) , ! isRegExp ( m2 . url ) ) ;
95
96
if ( urlPriority !== null ) return urlPriority ;
96
97
return Boolean ( this . _checkElementPriority ( m1 . queryString , m2 . queryString ) ) ;
97
98
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export async function stringifyLogText(log: ConsoleMessage): Promise<string> {
11
11
12
12
function stringifyLogArg ( arg : JSHandle ) : Promise < string > {
13
13
return arg . executionContext ( ) . evaluate ( element => {
14
- if ( typeof element === 'object' && ! ( element instanceof RegExp ) ) {
14
+ if ( typeof element === 'object' && ! ( element instanceof RegExp ) ) { // Executed inside context, lodash not available
15
15
try {
16
16
element = JSON . stringify ( element ) ;
17
17
} catch ( err ) {
Original file line number Diff line number Diff line change
1
+ import isRegExp from 'lodash.isregexp' ;
1
2
import querystring from 'querystring' ;
2
3
import { URL } from 'url' ;
3
4
@@ -19,7 +20,7 @@ export function isXPathQuery(s: string): boolean {
19
20
}
20
21
21
22
export function stringify ( element : any ) : string {
22
- if ( typeof element === 'object' && ! ( element instanceof RegExp ) ) {
23
+ if ( typeof element === 'object' && ! isRegExp ( element ) ) {
23
24
element = JSON . stringify ( element ) ;
24
25
}
25
26
return String ( element ) ;
@@ -46,10 +47,10 @@ export function promiseOr(promises: Array<Promise<any>>): Promise<any> {
46
47
47
48
export function matchText ( text : string | null | undefined , expected : string | RegExp ) : boolean {
48
49
if ( text === undefined || text === null ) return false ;
49
- if ( expected instanceof RegExp ) {
50
+ if ( isRegExp ( expected ) ) {
50
51
return expected . test ( text ) ;
51
52
} else {
52
- return text === expected ;
53
+ return text === expected ;
53
54
}
54
55
}
55
56
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " wendigo" ,
3
- "version" : " 2.13.1 " ,
3
+ "version" : " 2.13.2 " ,
4
4
"description" : " A proper monster for front-end automated testing" ,
5
5
"engines" : {
6
6
"node" : " >=8.0.0"
43
43
"dependencies" : {
44
44
"compositer" : " ^1.3.6" ,
45
45
"is-class" : " 0.0.9" ,
46
- "puppeteer" : " ~5.2.1"
46
+ "lodash.isregexp" : " ^4.0.1" ,
47
+ "puppeteer" : " ~5.4.0"
47
48
},
48
49
"devDependencies" : {
49
- "@types/mocha" : " ^8.0.1" ,
50
- "@types/node" : " ^14.0.27" ,
51
- "@types/puppeteer" : " ~3.0.1" ,
50
+ "@types/lodash.isregexp" : " ^4.0.6" ,
51
+ "@types/mocha" : " ^8.0.3" ,
52
+ "@types/node" : " ^14.14.2" ,
53
+ "@types/puppeteer" : " ~3.0.2" ,
52
54
"basic-auth" : " ^2.0.1" ,
53
- "eslint" : " ^7.6 .0" ,
55
+ "eslint" : " ^7.12 .0" ,
54
56
"express" : " ^4.17.1" ,
55
- "markdownlint-cli" : " ^0.23.2 " ,
56
- "mocha" : " ^8.1.1 " ,
57
- "sinon" : " ^9.0.2 " ,
57
+ "markdownlint-cli" : " ^0.24.0 " ,
58
+ "mocha" : " ^8.2.0 " ,
59
+ "sinon" : " ^9.2.0 " ,
58
60
"tslint" : " ^6.1.3" ,
59
- "typescript" : " ^3.9.7 "
61
+ "typescript" : " ^4.0.3 "
60
62
}
61
63
}
Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
3
+ const isRegExp = require ( 'lodash.isregexp' ) ;
3
4
const Wendigo = require ( '../..' ) ;
4
5
const DomElement = require ( '../../dist/lib/models/dom_element' ) . default ;
5
6
const assert = require ( 'assert' ) ;
@@ -54,7 +55,7 @@ describe("Evaluate", function() {
54
55
const result = await browser . evaluate ( ( ) => {
55
56
return / a b a / g;
56
57
} ) ;
57
- assert . ok ( result instanceof RegExp ) ;
58
+ assert . ok ( isRegExp ( result ) ) ;
58
59
assert . strictEqual ( result . source , "aba" ) ;
59
60
assert . strictEqual ( result . flags , "g" ) ;
60
61
} ) ;
You can’t perform that action at this time.
0 commit comments