Closed mman closed 3 weeks ago
Looking at the screenshot above, and opening the URL with web browser console, one could easily see that the web browser downloaded the index.html
file properly, but then requesting all linked files (.css
, .js
, .json
) would return the same index.html
file.
The npm serve
required by cypress command would serve the ./dist/
directory as if it would have been served via /
but the app is configured to be served via /app
prefix.
Because the npm run serve
would use the -s
argument that indicates a single page app, it would fallback to serving index.html
for any non-existent paths. And because the app tries to download the static artefacts via /app
the serve
command would fail and instead of returning 404 it would serve index.html
as a fallback.
That results in the SyntaxError: Unexpected token '<'
because the browser tries to parse downloaded JavaScript file but instead gets an HTML.
Additionally I needed to re-configure cypress to use the browser URL with proper URL arguments host
, port
, and path
to properly connect the app to the Venus Docker simulation. This should be improved in the future by fixing https://github.com/victronenergy/venus-docker/issues/20.
Cloning the repo and trying to run tests fails on multiple fronts. Looking at the workflow file, the failures are probably expected:
https://github.com/victronenergy/venus-html5-app/blob/bea62d00544e92af1b56017bf666228046868d7a/.github/workflows/ci.yml#L32-L33
but that way the tests have limited usefulness.... opening the bug, and will try to see if I can address them.