CB-11631 Appium tests: A working fix for a flaky "selection canceled" failure

This commit is contained in:
Alexander Sorokin 2016-08-17 17:35:23 +03:00
parent 62d1b01e81
commit 9f159d757a

View File

@ -400,7 +400,18 @@ describe('Camera tests Android.', function () {
return driver
.deviceKeyEvent(BACK_BUTTON)
// give native app some time to close
.sleep(2000);
.sleep(2000)
// try again! because every ~30th build
// on Sauce Labs this backbutton doesn't work
.elementById('action_bar_title')
.then(function () {
// success means we're still in native app
return driver
.deviceKeyEvent(BACK_BUTTON);
}, function () {
// error means we're already in webview
return driver;
});
}, function () {
// error means we're already in webview
return driver;