forked from DevExpress/testcafe
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add to 'TestRunInfo' object information about recorded videos (closes D…
- Loading branch information
1 parent
a242700
commit 4e122cf
Showing
7 changed files
with
377 additions
and
73 deletions.
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
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,42 @@ | ||
import VideoRecorder from './index'; | ||
|
||
export default class Videos { | ||
constructor (browserJobs, { videoPath, videoOptions, videoEncodingOptions }, warningLog, timeStamp) { | ||
const options = { timeStamp: timeStamp, ...videoOptions }; | ||
|
||
this.recordings = {}; | ||
|
||
browserJobs.forEach(browserJob => { | ||
const recorder = this._createVideoRecorder(browserJob, videoPath, options, videoEncodingOptions, warningLog); | ||
|
||
recorder.on('test-run-video-saved', args => this._addTestRunVideoInfo(args)); | ||
}); | ||
} | ||
|
||
getTestVideos (test) { | ||
const rec = this.recordings[test.id]; | ||
|
||
return rec ? rec.runs : []; | ||
} | ||
|
||
_createVideoRecorder (browserJob, videoPath, options, videoEncodingOptions, warningLog) { | ||
return new VideoRecorder(browserJob, videoPath, options, videoEncodingOptions, warningLog); | ||
} | ||
|
||
_addTestRunVideoInfo ({ testRun, videoPath, singleFile }) { | ||
const testId = testRun.test.id; | ||
let rec = this.recordings[testId]; | ||
|
||
if (!rec) { | ||
rec = { runs: [] }; | ||
|
||
this.recordings[testId] = rec; | ||
} | ||
|
||
rec.runs.push({ | ||
testRunId: testRun.id, | ||
videoPath, | ||
singleFile | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.