// @flow

// Sets a flag on the storybook's window instance telling storybook that it's
// being run in storyshots mode. We use this to stop animations from interfering
// with page snapshotting for Eyebot and the accessibility scanner.

// $FlowFixMe - page is the puppeteer page instance.
export const enableStoryshotsMode = (page: any): Promise<void> =>
  page.evaluateOnNewDocument(`
    Object.defineProperty(window, '__IS_STORYSHOTS__', {
      get() {
        return true;
      }
    })
  `);
