UNPKG

appium-mac2-driver

Version:

XCTest-based Appium driver for macOS apps automation

28 lines 1.19 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.uploadRecordedMedia = uploadRecordedMedia; const lodash_1 = __importDefault(require("lodash")); const support_1 = require("appium/support"); async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) { if (lodash_1.default.isEmpty(remotePath) || lodash_1.default.isNil(remotePath)) { const { size } = await support_1.fs.stat(localFile); this.log.debug(`The size of the resulting screen recording is ${support_1.util.toReadableSizeString(size)}`); return (await support_1.util.toInMemoryBase64(localFile)).toString(); } const { user, pass, method, headers, fileFieldName, formFields } = uploadOptions; const options = { method: method || 'PUT', headers, fileFieldName, formFields, }; if (user && pass) { options.auth = { user, pass }; } await support_1.net.uploadFile(localFile, remotePath, options); return ''; } //# sourceMappingURL=helpers.js.map