Skip to content

Commit

Permalink
chore: test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AVVS committed Jan 3, 2019
1 parent db475ec commit 25dbbba
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .mdeprc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"node": "10.15.0"
"node": "10.15.0",
"sleep": 10
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
"mkdirp": "^0.5.1",
"mocha": "^5.2.0",
"nyc": "^13.1.0",
"puppeteer": "=1.9.0",
"rimraf": "^2.6.1",
"puppeteer": "=1.4.0",
"rimraf": "^2.6.3",
"sinon": "^7.1.0"
},
"engine": {
Expand Down
16 changes: 12 additions & 4 deletions test/helpers/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ const idle = async (type = '2') => {
await page.waitForNavigation({ waitUntil: `networkidle${type}`, timeout: 10000 });
};

const isIgnorableError = (e) => {
if (e.message.includes('Protocol error (Runtime.callFunctionOn)')
|| e.message.includes('Protocol error (Target.activateTarget)')
|| e.message.includes('Node is detached from document')) {
return true;
}

return false;
};

// create retry function
const confirmRetry = (retrySelectror, confirmSelector, breaker) => {
let retryCount = 5;
Expand All @@ -79,14 +89,12 @@ const confirmRetry = (retrySelectror, confirmSelector, breaker) => {
Promise.some([idle('0', { timeout: 20000 }), Promise.delay(15000)], 1),
]);
} catch (e) {
// means we moved on to another page
if (e.message.startsWith('Protocol error (Runtime.callFunctionOn)')
|| e.message.startsWith('Protocol error (Target.activateTarget)')
|| e.message.startsWith('Node is detached from document')) {
if (isIgnorableError(e)) {
return null;
}

console.info('failed to confirm/retry', e);
console.info('message:', e.message);
await page.screenshot({ fullPage: false, path: `./ss/crash-${Date.now()}.png` });
await fs.writeFile(`./ss/crash-${Date.now()}.html`, await page.content(), 'utf-8');
}
Expand Down
34 changes: 17 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2548,7 +2548,7 @@ extglob@^2.0.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"

extract-zip@^1.6.6:
extract-zip@^1.6.5:
version "1.6.7"
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9"
integrity sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=
Expand Down Expand Up @@ -3192,7 +3192,7 @@ http-signature@~1.2.0:
jsprim "^1.2.2"
sshpk "^1.7.0"

https-proxy-agent@^2.2.0, https-proxy-agent@^2.2.1:
https-proxy-agent@^2.1.0, https-proxy-agent@^2.2.0, https-proxy-agent@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0"
integrity sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==
Expand Down Expand Up @@ -5788,19 +5788,19 @@ punycode@^1.4.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=

puppeteer@=1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.9.0.tgz#56dba79e7ea4faac807877bee3b23d63291fc59e"
integrity sha512-GH4PmhJf9wBRAPvtJkEJLAvdNNOofZortmBZSj8cGWYni98GUFqsf66blOEfJbo5B8l0KG5HR2d/W2MejnUrzg==
puppeteer@=1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.4.0.tgz#437f0f3450d76e437185c0bf06f446e80f184692"
integrity sha512-WDnC1FSHTedvRSS8BZB73tPAx2svUCWFdcxVjrybw8pbKOAB1v5S/pW0EamkqQoL1mXiBc+v8lyYjhhzMHIk1Q==
dependencies:
debug "^3.1.0"
extract-zip "^1.6.6"
https-proxy-agent "^2.2.1"
extract-zip "^1.6.5"
https-proxy-agent "^2.1.0"
mime "^2.0.3"
progress "^2.0.0"
proxy-from-env "^1.0.0"
rimraf "^2.6.1"
ws "^5.1.1"
ws "^3.0.0"

q@^1.5.1:
version "1.5.1"
Expand Down Expand Up @@ -6243,6 +6243,13 @@ rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@~2.
dependencies:
glob "^7.0.5"

rimraf@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
dependencies:
glob "^7.1.3"

rimraf@~2.4.0:
version "2.4.5"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.4.5.tgz#ee710ce5d93a8fdb856fb5ea8ff0e2d75934b2da"
Expand Down Expand Up @@ -7361,7 +7368,7 @@ write@^0.2.1:
dependencies:
mkdirp "^0.5.1"

ws@^3.3.3:
ws@^3.0.0, ws@^3.3.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2"
integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==
Expand All @@ -7370,13 +7377,6 @@ ws@^3.3.3:
safe-buffer "~5.1.0"
ultron "~1.1.0"

ws@^5.1.1:
version "5.2.2"
resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f"
integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==
dependencies:
async-limiter "~1.0.0"

xdg-basedir@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"
Expand Down

0 comments on commit 25dbbba

Please sign in to comment.