cypress testing of mendix app - unable to find mxui.js, theme.compiled.css files

226 Views Asked by At

I am trying to test a mendix app with cypress.

On trying to load the index file, I get the following in both the mendix and cypress logs. 404 - file not found for file: index.html/theme.compiled.css 404 - file not found for file: index.html/mxclientsystem/mxui/mxui.js

Which makes sense as it would be very unlikely that there are files under an html file in a directory structure.

Looking at the source code in the browser

 <script src="mxclientsystem/mxui/mxui.js?637896725776724820"></script>

Why would cypress be searching for mxui.js under index.html?

Is this a problem with mendix? With cypress?

1

There are 1 best solutions below

4
On BEST ANSWER

Cypress works with a served web page.

Not sure how a mendix app works, but if I want to test an index.html that has scripts and css resources to load, I would use VSCode "Open with live server" option on the index.

This will give me a URL usually localhost:5500 to visit in the app.

If there's any transforms required (e.g is CSS is in SASS format), you would need something more sophisticated involving Webpack and Babel.

Bottom line, serve your app in dev mode and use

cy.visit('url-as-used-in-browser')

to give Cypress access to the compiled page.


I see from the mendix tag

Mendix is a app platform-as-a-service (aPaaS) for Rapid Application Development. The rapid aPaaS offering prioritizes speed and agility and utilizes a “no code” principle

So, there's no code to serve. Just use the cy.visit(url) command using the same URL a user would access.