简体   繁体   English

mendix 应用程序的 cypress 测试 - 找不到 mxui.js、theme.compiled.css 文件

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

I am trying to test a mendix app with cypress.我正在尝试使用 cypress 测试 mendix 应用程序。

On trying to load the index file, I get the following in both the mendix and cypress logs.在尝试加载索引文件时,我在 mendix 和 cypress 日志中都得到了以下信息。 404 - file not found for file: index.html/theme.compiled.css 404 - file not found for file: index.html/mxclientsystem/mxui/mxui.js 404 - 找不到文件的文件:index.html/theme.compiled.css 404 - 找不到文件的文件: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.这是有道理的,因为目录结构中的 html 文件下不太可能有文件。

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?为什么 cypress 会在 index.html 下搜索 mxui.js?

Is this a problem with mendix?这是mendix的问题吗? With cypress?用柏树?

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.不确定 mendix 应用程序是如何工作的,但如果我想测试一个包含要加载的脚本和 css 资源的index.html ,我会在索引上使用 VSCode“使用实时服务器打开”选项。

This will give me a URL usually localhost:5500 to visit in the app.这会给我一个 URL 通常是 localhost:5500 在应用程序中访问。

If there's any transforms required (eg is CSS is in SASS format), you would need something more sophisticated involving Webpack and Babel.如果需要任何转换(例如 CSS 是 SASS 格式),您将需要一些更复杂的东西,包括 Webpack 和 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标签中看到

Mendix is a app platform-as-a-service (aPaaS) for Rapid Application Development. Mendix 是用于快速应用程序开发的应用程序平台即服务 (aPaaS)。 The rapid aPaaS offering prioritizes speed and agility and utilizes a “no code” principle快速的 aPaaS 产品优先考虑速度和敏捷性,并利用“无代码”原则

So, there's no code to serve.因此,没有可服务的代码。 Just use the cy.visit(url) command using the same URL a user would access.只需使用用户将访问的相同 URL 使用cy.visit(url)命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM