"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var footer_testkit_exports = {};
__export(footer_testkit_exports, {
  createFooterToolbarTestkit: () => createFooterToolbarTestkit
});
module.exports = __toCommonJS(footer_testkit_exports);
var import_wix_rich_content_common = require("./../../../../wix-rich-content-common/index.js");
var import_Toolbar = require("../../../components/Toolbar/index.js");
var import_covert_to_specific_add_button_toolbar = require("../../testkit/covert-to-specific-add-button-toolbar.js");
var import__ = require("../index.js");
const createFooterToolbarTestkit = (getBase, createAddButtonToolbarPluginTestkits) => {
  const getFooter = () => getBase().$(`${(0, import_wix_rich_content_common.dataHook)(import__.FOOTER_TOOLBAR)} ${(0, import_wix_rich_content_common.dataHook)(import_Toolbar.TOOLBAR_VISIBLE)}`);
  const createFooterToolbarPluginTestkits = (0, import_covert_to_specific_add_button_toolbar.convertToSpecificAddButtonToolbar)(
    createAddButtonToolbarPluginTestkits
  );
  return {
    exists: async () => {
      return getFooter().exists();
    },
    waitForElement: async () => {
      const footer = getFooter();
      await footer.wait();
      return footer;
    },
    getButtonsAmount: async () => {
      const buttons = getFooter().$$("button");
      return await buttons.count();
    },
    scrollToElementByIndex: async (index) => {
      const button = getFooter().$$("button").get(index);
      if (!button) {
        throw new Error(`Footer toolbar doesn't have a button at index ${index}`);
      }
      await button.scrollIntoView?.();
    },
    getButtonAtIndex: async (index) => {
      const button = getFooter().$$("button").get(index);
      if (!button) {
        throw new Error(`Footer toolbar doesn't have a button at index ${index}`);
      }
      return button;
    },
    clickMoreButton: async () => {
      const footer = await getFooter();
      const moreButton = footer.$((0, import_wix_rich_content_common.dataHook)("more-button"));
      await moreButton.click();
    },
    waitForOverflownButtonsToolbar: async () => {
      const overflownButtonsToolbar = getBase().$((0, import_wix_rich_content_common.dataHook)("overflown-buttons-toolbar"));
      await overflownButtonsToolbar.wait();
    },
    plugins: createFooterToolbarPluginTestkits(getFooter)
  };
};
//# sourceMappingURL=footer.testkit.js.map
