ccpu/storybook-addon-playwright

A way to pre-configure playwright and browser setting

Opened this issue · 1 comments

zlk89 commented

Is there a way to pre-configure browser settings like enableJavaScript, showPanel by default

ccpu commented

Hi @zlk89

you should be able to preconfigure browser settings when setting up plugin-in in .storybook/main.js OR .storybook/middleware.js, however this changes wont be reflected in UI section.

here is an example:

  setConfig({
    storybookEndpoint: `http://localhost:6006/`,
    getPage: async (browserType, options) => {
      const page = await browser[browserType].newPage({...options,...YOUR_SETTING}); // <-- 
      return page;
    },
    afterScreenshot: async (page) => {
      await page.close();
    },
  });

I haven't tried my self but it should work.

Thanks,