declare namespace Cypress {
  interface Chainable {
    clearAndType(selector: string, text: string): Void;
    clearAndTypeFast(selector: string, text: string): Void;
    clearByClickAndTypeFast(selector: string, text: string): Void;
    typeFast(selector: string, text: string): Void;
    typeAndEnter(selector: string, text: string): Void;
    verifyToastMessage(message: string): Void;

    /**
     * @param closeToastr Default value is true
     */
    verifyToastIcon(closeToastr: boolean): Void;
    continueOnAlert(
      alias:
        | string
        | {
            title: string;
            description: string;
            alias: string;
            requestCount: number;
            toastMessage: string;
            verifyToastIcon: boolean;
          }
    ): Void;
    interceptApi(
      alias: string,
      times?: number
    ): Cypress.Chainable<Cypress.InterceptionOptions>;
    waitForMultipleRequest(
      alias: string,
      times?: number
    ): Chainable<JQuery<HTMLElement>>;

    /**
     * Make an HTTP request with specific method.
     * @see https://on.cypress.io/request
     */
    apiRequest(
      options: Cypress.RequestBody
    ): Cypress.Chainable<Cypress.Response>;

    reloadAndWait(requestCount?: number): Void;
    selectOption(containerSelector: string, optionText: string): Void;
    clickDropdownOption(optionText: string, dropdownSelector: string): Void;
    getText(selector: string): Chainable<JQuery<HTMLElement>>;
    getValue(selector: string): Chainable<JQuery<HTMLElement>>;

    /**
     * @deprecated Use `withinIframe` instead.
     */
    getIframe(iframeSelector: string): Chainable<JQuery<HTMLElement>>;

    /**
     * Selects and performs commands within an iframe element based on the given selector.
     * @param iframeSelector The selector to locate the iframe element.
     * @param callbackFn The callback function containing the commands to execute within the iframe.
     */
    withinIframe(iframeSelector: string, callbackFn: void): Void;

    /**
     * Command to open the url in the same window after clicking on a button that opens the url in a new tab
     */
    openInSameTabOnClick(props: {
      url: string;
      alias: string;
      selector: string;
    });
    globalState(key: string): Void;
    ifExist(selector: string, callback: Function): Void;
    ifNotExist(selector: string, callback: Function): Void;
    dragAndDrop(props: {
      subject: string;
      target: string;
      dragIndex: number;
      dropIndex: number;
    });
    verifyPlaceholder(textInputSelector: string, value: string): Void;
    enableOrDisableSwitch(switchButton: string, value: string): Void;
    interceptNonVersionedApi(props: {
      url: string;
      alias: string;
      times?: number; // maximum number of times to match
    }): Cypress.Chainable<Cypress.InterceptionOptions>;
    typeOnSearchField(props: {
      delay?: number;
      selector: string;
      value: string;
      skipSearchRequest?: boolean; // default true
    });
    clickByRemoveTargetAttr(selector: string): Void;
    navigateToPreviewPage(selector: string, requestCount: number): Void;
    saveChanges(aliasName: string, requestCount: number): Void;
    verifyAttribute(props: {
      selector: string;
      attr: string;
      value: string;
    }): Void;
    verifyUnsavedAlertModal(cancelButton: string): Void;
    verifyTooltip(selector: string, text: string): Void;
    /**
     * Command to get email content using Mailosaur API.
     * @param props Mailosaur API request body.
     * @see https://mailosaur.com/docs/frameworks-and-tools/cypress/#library-reference
     * @param options Used to specify additional criteria for the email retrieval
     * @see https://mailosaur.com/docs/email-testing/cypress#2-options
     */
    getEmailContent(props, options): Void;
  }
}
