From 27ae985ca557374ff49ba4f8e2a6cc8938a56fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bergstr=C3=B6m?= Date: Mon, 16 Apr 2018 11:08:45 +0200 Subject: [PATCH] Ability to use fs.chmodSync on the recorded file for more flexibility with access permission rights --- lib/VideoReporter.js | 8 +++++++- readme.md | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/VideoReporter.js b/lib/VideoReporter.js index b68e9a3..4f2cb0b 100644 --- a/lib/VideoReporter.js +++ b/lib/VideoReporter.js @@ -27,6 +27,7 @@ function VideoReporter(options) { singleVideo: true, singleVideoPath: 'uuid', createSubtitles: true, + chmod: 'none', ffmpegCmd: 'ffmpeg', ffmpegArgs: [ '-y', @@ -53,7 +54,8 @@ function VideoReporter(options) { ), createSubtitles: Joi.boolean() .description('If true and singleVideo is also true, will create a SRT subtitles file with the name details of the currently running spec.'), - + chmod: Joi.string() + .description('Chmod to set after each saved video, e.g. "755"'), ffmpegCmd: Joi.string() .description('The command used to execute ffmpeg, e.g. /usr/bin/ffmpeg.'), ffmpegArgs: Joi.array().items(Joi.string(), Joi.number()) @@ -120,6 +122,10 @@ VideoReporter.prototype._stopScreencast = function(removeVideo) { case 'no': debug('Keeping the video'); console.log('Spec video is in: ' + self._videoPath); + if (self.options.chmod !== 'none') { + debug('Setting chmod settings for file'); + Fs.chmodSync(self._videoPath, self.options.chmod); + } break; } diff --git a/readme.md b/readme.md index 88809fb..2642635 100644 --- a/readme.md +++ b/readme.md @@ -59,6 +59,13 @@ For example, you can do: * `createSubtitles` (bool): If `true` and singleVideo is also true, will create a SRT subtitles file with the name details of the currently running spec. Defaults to `true`. The file will be saves to `baseDirectory/protractor-specs.srt`. +* `chmod` (string): Will attempt so set the given chmod on saved video. Defaults to `none` which will use the default permission settings for the file. For example: + + ``` + chmod: '755' or chmod: '0755' + ``` + + * `saveSuccessVideos` (bool): If `true`, will save the videos of the succussfull specs, as well as the failed specs. This has no effect if `singleVideo` is `true` - we'll always capture all the specs then. Defaults to `false`. * `ffmpegCmd` (string): The command used to execute ffmpeg, e.g. `'/usr/bin/ffmpeg'`. Defaults to `'ffmpeg'`.