rewright
    Preparing search index...

    Function state

    • A class decorator for changing a class instance based on a state value. This decorator can be useful for applications with lots of feature flags. Using the @state decorator allows you to define POMs whose definitions react to changed based on whether a flag is on or off.

      Parameters

      • name: string

        the name of the stateful object to check.

      • value: any

        the value of the stateful object to check.

      • classOverrides: ClassOverride

        the properties and methods you want to override into this class if the stateful object check passes.

      Returns <T extends new (...args: any[]) => {}>(
          constructor: T,
      ) => { prototype: __type<any>; new (...args: any[]): __type<T> } & T

      @state("ff-NewHomePg", true, (page: Page) => {
      return {
      loginButton: page.locator("#new-login-btn")
      }
      })
      class HomePage {
      readonly loginButton: Locator;
      constructor(page: Page) {
      this.loginButton = page.locator("#old-login-btn");
      }
      }