CB-12990 (iOS) Optimized Appium tests

This commit is contained in:
Alexander Sorokin 2017-07-06 08:29:15 +03:00
parent 3b8f64e330
commit 5b3a99a6db

View File

@ -81,18 +81,18 @@ describe('Camera tests iOS.', function () {
return cameraHelper.generateSpecs(sourceTypes, destinationTypes, encodingTypes, allowEditOptions, correctOrientationOptions); return cameraHelper.generateSpecs(sourceTypes, destinationTypes, encodingTypes, allowEditOptions, correctOrientationOptions);
} }
function usePicture() { function usePicture(allowEdit) {
return driver return driver
.elementByXPath('//*[@label="Use"]') .sleep(10)
.click() .then(function () {
.fail(function () {
if (isXCUI) { if (isXCUI) {
return driver return driver.waitForElementByAccessibilityId('Choose', MINUTE / 3).click();
.waitForElementByAccessibilityId('Choose', MINUTE / 3) } else {
.click(); if (allowEdit) {
}
// For some reason "Choose" element is not clickable by standard Appium methods on iOS <= 9
return wdHelper.tapElementByXPath('//UIAButton[@label="Choose"]', driver); return wdHelper.tapElementByXPath('//UIAButton[@label="Choose"]', driver);
}
return driver.elementByXPath('//*[@label="Use"]').click();
}
}); });
} }
@ -148,7 +148,7 @@ describe('Camera tests iOS.', function () {
if (!options.allowEdit) { if (!options.allowEdit) {
return driver; return driver;
} }
return usePicture(); return usePicture(options.allowEdit);
}); });
} }
if (options.hasOwnProperty('sourceType') && options.sourceType === cameraConstants.PictureSourceType.SAVEDPHOTOALBUM) { if (options.hasOwnProperty('sourceType') && options.sourceType === cameraConstants.PictureSourceType.SAVEDPHOTOALBUM) {
@ -157,7 +157,7 @@ describe('Camera tests iOS.', function () {
if (!options.allowEdit) { if (!options.allowEdit) {
return driver; return driver;
} }
return usePicture(); return usePicture(options.allowEdit);
}); });
} }
if (cancelCamera) { if (cancelCamera) {
@ -288,7 +288,7 @@ describe('Camera tests iOS.', function () {
describe('Specs.', function () { describe('Specs.', function () {
afterEach(function (done) { afterEach(function (done) {
if (specsRun >= 15) { if (specsRun >= 19) {
specsRun = 0; specsRun = 0;
// we need to restart the session regularly because for some reason // we need to restart the session regularly because for some reason
// when running against iOS 10 simulator on SauceLabs, // when running against iOS 10 simulator on SauceLabs,