Skip to content
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

Testing with chrome using scala-js-env-playwright with esmodules and … #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gmkumar2005
Copy link

scala-js-env-playwright is an independent project that offers a JSEnv that uses Playwright for JavaScript execution.
This PR enables testing with chrome browser.
Laminar is most likely to be used with fastLinkJS and ESModule hence testing with these setting enabled will help identify errors in real browsers.
In the latest edition allows you to verify the actual version of the browser being used. debug = true to the PWEnv

 jsEnv := new jsenv.playwright.PWEnv(
      browserName = "chromium",
      headless = true,
      debug = true
    ),

@gmkumar2005 gmkumar2005 requested a review from raquo as a code owner January 24, 2024 15:03
@raquo
Copy link
Owner

raquo commented Jan 25, 2024

Hi, thanks for the PR. The playwright js env is a useful project for end-user applications where you could test e.g. page transitions and such, but Laminar tests don't have such needs. It's true that testing in a real browser environment is more faithful than in jsdom, but in 7 years of using jsdom for Laminar tests, I don't recall encountering any such issues with it.

I try to minimize dependencies, so without a pressing need, I would rather avoid any changes. I will keep the PR open for now to serve as a reference for anyone wanting to use playwright in their own project.

@gmkumar2005
Copy link
Author

@raquo Thanks for the feedback. Would it be helpful if this PR includes both options in the build? I propose having tests based on NodeJS+JSDom as the primary testing and release process, with testing on multiple browsers as a secondary option. The net effect is that the proven process remains unchanged, and whenever there is a need for quick validation, one can run browser-based tests.

@raquo
Copy link
Owner

raquo commented Jan 25, 2024

@gmkumar2005 I don't know, Laminar's repo seems like the wrong place for this. Laminar shouldn't have dependencies that it doesn't need, even test / optional ones. Some other projects include all kinds of integrations into their repos (e.g. with cats, or various test frameworks / json libs / whatever), but my approach is to have such integration in separate repos, maintained by whoever wants to maintain them, which is usually not me. I link to all such things that I know of on the https://laminar.dev/resources page (I'll add your project there too, it's just too hard to update that page while Laminar 17.x is not final).

There's nothing Laminar-specific about the js env playwright configuration, so you may want to add playwright tests as a submodule to your own repo, for example my own test utils have tests that verify their own setup: https://github.com/raquo/scala-dom-testutils; and my https://github.com/raquo/scala-dom-types generator has tests that use that generator in the canonical way, without relying on the Laminar repo to test it.

@gmkumar2005
Copy link
Author

Agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants