module.exports.bustAlert = function()

in lib/appium/helpers/wdHelper.js [265:293]


module.exports.bustAlert = function (driver, platform) {
    let previousContext;

    return driver
        .currentContext()
        .then(function (context) {
            if (context !== 'NATIVE_APP') {
                previousContext = context;
            }
            return driver;
        })
        .context('NATIVE_APP')
        .then(function () {
        // iOS
            if (platform === 'ios') {
                return driver.acceptAlert()
                    .then(function alertDismissed () { }, function noAlert () { });
            }

            // Android
            return driver
                .elementByXPath('//android.widget.Button[translate(@text, "alow", "ALOW")="ALLOW"]')
                .click()
                .fail(function noAlert () { });
        })
        .then(function () {
            return previousContext ? driver.context(previousContext) : driver;
        });
};