mirror of
https://github.com/appium/appium.git
synced 2026-05-04 09:20:30 -05:00
6494df98d6
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
26 lines
864 B
JavaScript
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);
|
|
});
|
|
}); |