mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2026-04-29 00:02:13 +08:00
CB-11073 Appium tests stability improvements
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/*jshint node: true */
|
||||
/* global Q */
|
||||
/*
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
@@ -84,3 +85,21 @@ module.exports.generateSpecs = function (sourceTypes, destinationTypes, encoding
|
||||
}
|
||||
return specs;
|
||||
};
|
||||
|
||||
module.exports.getPicture = function (opts, pid) {
|
||||
navigator._appiumPromises[pid] = Q.defer();
|
||||
navigator.camera.getPicture(function (result) {
|
||||
navigator._appiumPromises[pid].resolve(result);
|
||||
}, function (err) {
|
||||
navigator._appiumPromises[pid].reject(err);
|
||||
}, opts);
|
||||
};
|
||||
|
||||
module.exports.checkPicture = function (pid, cb) {
|
||||
navigator._appiumPromises[pid].promise
|
||||
.then(function (result) {
|
||||
cb(result);
|
||||
}, function (err) {
|
||||
cb('ERROR: ' + err);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user