Files
appium/test/functional/android/apidemos/file-specs.js
T
bootstraponline 6494df98d6 Android mobile push & pull
Ruby examples:

mobile :pushFile, data: Base64.encode64('test ruby'), path: '/data/local/tmp/test.txt'

pull_result = mobile :pullFile, path: '/data/local/tmp/test.txt'
Base64.decode64 pull_result
2014-03-14 15:09:13 -04:00

26 lines
864 B
JavaScript

"use strict";
var setup = require("../../common/setup-base")
, desired = require("./desired")
, fs = require('fs');
describe("apidemos - push & pull file -", function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });
it('should push and pull a file', function (done) {
var stringData = "random string data " + Math.random();
var base64Data = new Buffer(stringData).toString('base64');
var remotePath = '/data/local/tmp/remote.txt';
driver.execute("mobile: pushFile", [{data: base64Data, path: remotePath}])
.then(function () {
return driver.execute("mobile: pullFile", [{path: remotePath}]);
})
.then(function (remoteData64) {
var remoteData = new Buffer(remoteData64, 'base64').toString();
remoteData.should.equal(stringData);
})
.nodeify(done);
});
});