Skip to content

Conversation

@Zer0-
Copy link
Contributor

@Zer0- Zer0- commented Feb 7, 2026

This PR adds two tests:
- TestApp: generates a random html page with a link, clicks the link and
makes sure the app reacts to it (which implies hydration was successful)
- TestBindingsApp: Creates a variable-length chain of components with
variables bound to one another. The expectation is a change to
the value of the first component will propagate all the way down each component
and come back up to change a second value in the first component.

In order to test end-to-end playwright.ts was changed to be an http endpoint, that
way our haskell test server can control playwrite, which in turn points a browser at
the test server.
- Note: The changes to playwright.ts were almost entirely vibe-coded and then
tested by hand. It could definitely be slimmed down but I lack the motivation
atm.

There is also the server module TestServer that uses environment variables
to determine whether to link to the ghcjs or wasm payloads in the html, as well
as serving the initial html for each test. The tests rely on quickcheck's ioProperty,
for each iteration the actual http server is started in the background and the
test makes an http request to the playwright server to hit the server.

TODO:

  • add asserts to bindings test
  • possibly rename the new binaries to something other than integration-* if that's more appropriate
  • comment out or delete serveFailed in TestServer (though it's useful)

I definitely expect a good amount of comments but I do think this way of testing is necessary.

Zer0- added 25 commits December 30, 2025 21:11
- Lower the test to mount 10k components to 10 so it won't take forever
- so far only js version
- add executable integration-tests-server section to
  tests/miso-tests.cabal
- remove tests/CHANGELOG.md and it's mention in the cabal file because
  it was making the build fail
- vibe code a generator
    - missing some sections
- see how we can generate an explicit seed in QuickCheck
- compiles
- adds missing sections
- might throw this out
- quickcheck, even when using the exact same seed (which had to be
  generated as an Int32 because haskell's Int range is a lot larger than
  javascript's Number), does not generate the same view.
- have an intermediate html representation we can ship to the client
- this time it's hand written and cleaner
- no errors according to w3c validator
    - except for the defer attribute on the script tag for loading the
      app, but that can't be the issue otherwise the app wouldn't even
      boot (defer should be present or not present, it shouldn't have a
      value)
- even the simplified html generation causes hydration issues (need to
  investigate this)
- javascript backend only, wasm is TODO
- tests pass
- There's a change to nix/haskell/packages/ghc/default.nix where I added
  the -fssr flag to miso, this fixes my test but i'm not sure if it
  breaks something else.
- also commit a js file to load the wasm script
- need to make client work with new test, which means being able to
  hydrate different kinds of data.
- should this work? This may be a failing test case
- missing assertions that should run clientside
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.

1 participant