-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from stereobooster/112-timeouts
[#112] List what timed out
- Loading branch information
Showing
6 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Sets up event listeners on the Browser.Page instance to maintain a set | ||
* of URLs that have started but never finished or failed. | ||
* | ||
* @param {Object} page | ||
* @return Object | ||
*/ | ||
|
||
const createTracker = page => { | ||
const requests = new Set(); | ||
const onStarted = request => requests.add(request); | ||
const onFinished = request => requests.delete(request); | ||
page.on('request', onStarted); | ||
page.on('requestfinished', onFinished); | ||
page.on('requestfailed', onFinished); | ||
return { | ||
urls: () => Array.from(requests).map(r => r.url()), | ||
dispose: () => { | ||
page.removeListener('request', onStarted); | ||
page.removeListener('requestfinished', onFinished); | ||
page.removeListener('requestfailed', onFinished); | ||
} | ||
}; | ||
}; | ||
|
||
module.exports = { createTracker }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link href="timeout.css?1" rel="stylesheet"> | ||
<link href="timeout.css?2" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<p>Only a p tag here.</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters