From 5b3a99a6dbd821f5699c42afe2e38f235aaaa93f Mon Sep 17 00:00:00 2001 From: Alexander Sorokin Date: Thu, 6 Jul 2017 08:29:15 +0300 Subject: [PATCH] CB-12990 (iOS) Optimized Appium tests --- appium-tests/ios/ios.spec.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/appium-tests/ios/ios.spec.js b/appium-tests/ios/ios.spec.js index 255a179..9e7c3e1 100644 --- a/appium-tests/ios/ios.spec.js +++ b/appium-tests/ios/ios.spec.js @@ -81,18 +81,18 @@ describe('Camera tests iOS.', function () { return cameraHelper.generateSpecs(sourceTypes, destinationTypes, encodingTypes, allowEditOptions, correctOrientationOptions); } - function usePicture() { + function usePicture(allowEdit) { return driver - .elementByXPath('//*[@label="Use"]') - .click() - .fail(function () { + .sleep(10) + .then(function () { if (isXCUI) { - return driver - .waitForElementByAccessibilityId('Choose', MINUTE / 3) - .click(); + return driver.waitForElementByAccessibilityId('Choose', MINUTE / 3).click(); + } else { + if (allowEdit) { + return wdHelper.tapElementByXPath('//UIAButton[@label="Choose"]', driver); + } + return driver.elementByXPath('//*[@label="Use"]').click(); } - // For some reason "Choose" element is not clickable by standard Appium methods on iOS <= 9 - return wdHelper.tapElementByXPath('//UIAButton[@label="Choose"]', driver); }); } @@ -148,7 +148,7 @@ describe('Camera tests iOS.', function () { if (!options.allowEdit) { return driver; } - return usePicture(); + return usePicture(options.allowEdit); }); } if (options.hasOwnProperty('sourceType') && options.sourceType === cameraConstants.PictureSourceType.SAVEDPHOTOALBUM) { @@ -157,7 +157,7 @@ describe('Camera tests iOS.', function () { if (!options.allowEdit) { return driver; } - return usePicture(); + return usePicture(options.allowEdit); }); } if (cancelCamera) { @@ -288,7 +288,7 @@ describe('Camera tests iOS.', function () { describe('Specs.', function () { afterEach(function (done) { - if (specsRun >= 15) { + if (specsRun >= 19) { specsRun = 0; // we need to restart the session regularly because for some reason // when running against iOS 10 simulator on SauceLabs,