-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Tests executed in NodeJS env and not browser? #14469
Comments
If I understand correctly, there is a difference. Your tests are executed inside a node environment, but actions of your tests are executed inside a real browser. Probably, this will help you understand what's going on and how you can access |
@Bessonov Ok, that's truly unfortunate and makes me question the whole point of using Playwright. I'm currently trying to test code that has a dependency which checks |
Like I sad, you can access it. But not like |
Looks like this can be closed. If you are looking for an in-browser test runner, you can refer to Karma. |
I think playwright should allow the ability to do this as well, Since most people prefer not to do Playwright should have a simple toggle in its configuration like I'd leave it to you guys to figure out the API but I think this would be a huge addition I would also reference jestjs/jest#139 (comment) jestjs/jest#139 (comment) jestjs/jest#848 I tried jest I also tried puppeteer, it does same thing like I want playwright to just work out of the box, The tests should be performed, Logs from chrome browser console should be captured, maybe another toggle |
I require this issue to be reopened, as a feature request, rename title to "Execute all tests in the browser by default" or should I create a new one |
I'm trying to use playwright test for unit tests, but I'm having trouble getting it to run the tests in the browser context.
For example, if I do a simple
expect(window).toBeTruthy()
, I getwindow is not defined
error. However,global
does exist, so I'm guessing for some reason tests are executed in NodeJS environment.I've tried
--browser chromium
, but doesn't seem to work.Any ideas how can I get the browser env to work?
The text was updated successfully, but these errors were encountered: