All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.cypress-commands.d.ts Maven / Gradle / Ivy

Go to download

A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.

There is a newer version: 4.12.3
Show newest version
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;
    waitForMultipleRequest(
      alias: string,
      times?: number
    ): Chainable>;

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

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

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

    /**
     * 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;
    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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy