Closed XiaoW9596 closed 2 years ago
Hi, this error occurs when setConfig
is not set correctly or playwright
has not been installed correctly. Make sure only to install supported playwright@1.17.x
,storybook@6.4.x
and @storybook/addon-knobs@6.4.x
. Alternatively, an error may have been thrown inside setConfig
; for example, if playwright is not installed properly, it may throw an error when unable to get
new page. Additionally, be sure to place the setConfig
inside the .storybook/main.js
file. You need to place consol.log
at a different stage of the .storybook/main.js
&setConfig
file to debug and figure out why setConfig
fails.
Hi there, thanks for the quick reply! I installed corresponding package version for playwright, storybook and storybook/addon-knobs and placed setConfig
inside main.js
. With different console.log(), I think the error originate from UnhandledPromiseRejectionWarning: browserType.launch: Browser closed.
Despite this, I am unable to help you much when it comes to the playwright
environment. Are you able to launch the playwright browser without this plugin? You can check playwright functionality by running the following code in NodeJS. (try to run this code with all browser Chromium, Firefox, Webkit)
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch()
const page = await browser.newPage()
await page.setViewportSize({ width: 1280, height: 800 })
await page.goto('https://playwright.dev/')
await page.screenshot({ path: 'my_screenshot.png' })
await browser.close()
})()
Hi there, I fixed the error!!! I upgrade the node version to 14.15.0, and then install playwright. Everything works fine right now!
I also runned
npm i -D @playwright/test
# install supported browsers
npx playwright install
Nice one, now that you have solved the problem, I am closing the issue.
Hi there, thanks for this amazing addon!
I followed your guide and went through all documentation and issues, but I got
Configuration has not been set.
status code 500 error with api call/screenshot/get
andgetTheme
. I also tried your example repo, same api error also appeared.I know that this error message indicates
setConfig()
is empty or not properly read, but I did put requiredsetConfig()
as documentation, and I couldn't figure out the way to fix this.This is a screenshot of error when I run your example repo:
This is a screenshot of error when I run my own repo:
Also, even after I delete
setConfig()
script in main.js, the screenshot/get api still calls for all browsers:I'm not sure if I missed anything as configuration / setup. Thanks in advance for your help!