Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 2x 1x 1x 1x 1x 1x 1x 1x | /** * * Appium only. Save a video started by startRecordingScreen command to file. * See [Appium docs](http://appium.io/docs/en/commands/device/recording-screen/start-recording-screen/) * * <example> :saveRecordingScreen.js it('should save a video', () => { browser.startRecordingScreen(); $('~BUTTON').click(); browser.saveRecordingScreen('./some/path/video.mp4'); }); * </example> * * @alias browser.saveRecordingScreen * @param {String} filepath full or relative to the execution directory path to the generated video * @return {Buffer} video buffer * @type utility * */ import fs from 'fs' import { Buffer } from 'safe-buffer' import { getAbsoluteFilepath, assertDirectoryExists } from '../../utils' export default async function saveRecordingScreen (filepath) { /** * type check */ if (typeof filepath !== 'string') { throw new Error('saveRecordingScreen expects a filepath') } const absoluteFilepath = getAbsoluteFilepath(filepath) assertDirectoryExists(absoluteFilepath) const videoBuffer = await this.stopRecordingScreen() const video = Buffer.from(videoBuffer, 'base64') fs.writeFileSync(absoluteFilepath, video) return video } |