"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigateBackExecutor = void 0;
const execution_1 = require("@mablhq-internal/runtime/execution");
const execution_2 = require("@mablhq-internal/runtime/execution");
class NavigateBackExecutor {
    run(step, executionContext) {
        return (0, execution_1.runActionWithElementReadyRetriesForMobile)(() => this.navigateBack(step, executionContext), executionContext);
    }
    async navigateBack(_step, executionContext) {
        const driver = executionContext.mobileTestEnvironment.getDriver();
        try {
            await executionContext.observeDeferredFunction();
            await driver.back();
        }
        catch (error) {
            executionContext.log.error(error);
            return {
                status: execution_2.StepStatus.Failed,
                logInfo: 'Unable to navigate back',
            };
        }
        return { status: execution_2.StepStatus.Passed };
    }
}
exports.NavigateBackExecutor = NavigateBackExecutor;
