"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cucumber_1 = require("@cucumber/cucumber");
const locator_1 = require("../runtime/locator");
const ui_controls_1 = require("../runtime/ui-controls");
(0, cucumber_1.When)('I click {string}', async function (target) {
    await (0, locator_1.locatorByAny)(this.page, target, this.config.selectors).first().click();
});
(0, cucumber_1.When)('I click {string} at index {int}', async function (target, index) {
    await (0, locator_1.atIndex)((0, locator_1.locatorByAny)(this.page, target, this.config.selectors), index).click();
});
(0, cucumber_1.When)('I click the {string} button', async function (name) {
    await (0, locator_1.buttonByName)(this.page, name, this.config.selectors).first().click();
});
(0, cucumber_1.When)('I click the {string} button at index {int}', async function (name, index) {
    await (0, locator_1.atIndex)((0, locator_1.buttonByName)(this.page, name, this.config.selectors), index).click();
});
(0, cucumber_1.When)('I click text {string}', async function (text) {
    await this.page.getByText(text, { exact: true }).click();
});
(0, cucumber_1.When)('I click text {string} at index {int}', async function (text, index) {
    await this.page.getByText(text, { exact: true }).nth(index).click();
});
(0, cucumber_1.When)('I check {string}', async function (label) {
    await (0, locator_1.locatorByLabelOrText)(this.page, label, this.config.selectors).check();
});
(0, cucumber_1.When)('I check {string} at index {int}', async function (label, index) {
    await (0, locator_1.atIndex)((0, locator_1.locatorByLabelOrText)(this.page, label, this.config.selectors), index).check();
});
(0, cucumber_1.When)('I uncheck {string}', async function (label) {
    await (0, locator_1.locatorByLabelOrText)(this.page, label, this.config.selectors).uncheck();
});
(0, cucumber_1.When)('I uncheck {string} at index {int}', async function (label, index) {
    await (0, locator_1.atIndex)((0, locator_1.locatorByLabelOrText)(this.page, label, this.config.selectors), index).uncheck();
});
(0, cucumber_1.When)('I choose {string} from {string}', async function (option, field) {
    await (0, ui_controls_1.chooseFieldOption)(this.page, field, option, 0, this.config.selectors);
});
(0, cucumber_1.When)('I choose {string} from {string} at index {int}', async function (option, field, index) {
    await (0, ui_controls_1.chooseFieldOption)(this.page, field, option, index, this.config.selectors);
});
(0, cucumber_1.When)('I scroll to element {string}', async function (target) {
    await (0, ui_controls_1.scrollToElement)(this.page, target, this.config.selectors);
});
(0, cucumber_1.When)('I scroll to element {string} at index {int}', async function (target, index) {
    await (0, ui_controls_1.scrollToElement)(this.page, target, this.config.selectors, index);
});
(0, cucumber_1.When)('I open the {string} tab', async function (name) {
    await (0, ui_controls_1.openTab)(this.page, name, this.config.selectors);
});
(0, cucumber_1.When)('I open the {string} tab at index {int}', async function (name, index) {
    await (0, ui_controls_1.openTab)(this.page, name, this.config.selectors, index);
});
(0, cucumber_1.When)('I open the {string} tab in {string}', async function (name, scopeTarget) {
    await (0, ui_controls_1.openTab)(this.page, name, this.config.selectors, 0, scopeTarget);
});
(0, cucumber_1.When)('I open the {string} tab in {string} at index {int}', async function (name, scopeTarget, index) {
    await (0, ui_controls_1.openTab)(this.page, name, this.config.selectors, index, scopeTarget);
});
