可以将宁静js用作Knockout js的测试工具吗?(can serenity js used as a testing tool for Knockout js?)

编程入门 行业动态 更新时间:2024-10-26 19:34:52
可以将宁静js用作Knockout js的测试工具吗?(can serenity js used as a testing tool for Knockout js?)

我想知道serenity / js是否可以用于其他JavaScript框架,还是仅适用于Angular / js?

I want to know whether the serenity/js can be used for other JavaScript frameworks or it just only for Angular/js?

最满意答案

量角器是Selenium WebDriver的一个包装,这意味着它可以测试任何WebDriver可以测试的东西。

要测试任何非Angular项目,虽然您需要禁用特定于Angular的测试同步,您可以使用以下两种方法之一:

量角器配置文件

如果您的测试只执行非Angular项目,您可以通过在protractor.conf.js文件的onPrepare块中添加browser.ignoreSynchronization = true来禁用所有测试的Angular专用同步:

exports.config = { // ... other config onPrepare: function() { browser.ignoreSynchronization = true; // <-- disables synchronisation } };

宁静/ JS任务

如果您的测试需要同时支持Angular和非Angular项目,则可以使用UseAngular.disableSynchronisation()和UseAngular.enableSynchronisation()任务来切换同步:

actor.attemptsTo( UseAngular.disableSynchronisation(), // ... interact with a non-Angular app UseAngular.enableSynchronisation(), // ... interact with an Angular app )

您可以在我的关于“ 跨应用程序测试 ”的文章中了解关于第二种方法的更多信息

如果此答案有帮助,请将其标记为已接受 ,谢谢!

Protractor is a wrapper around Selenium WebDriver, which means that it can test anything WebDriver could.

To test any non-Angular project though you'll need to disable Angular-specific test synchronisation, which you can do using either:

Protractor configuration file

If your tests are only ever going to execute non-Angular projects, you can disable Angular-specific synchronisation for all the tests by adding browser.ignoreSynchronization = true to the onPrepare block in your protractor.conf.js file:

exports.config = { // ... other config onPrepare: function() { browser.ignoreSynchronization = true; // <-- disables synchronisation } };

Serenity/JS task

If your tests need to support both Angular and non-Angular projects, you can toggle the synchronisation using the UseAngular.disableSynchronisation() and UseAngular.enableSynchronisation() tasks like this:

actor.attemptsTo( UseAngular.disableSynchronisation(), // ... interact with a non-Angular app UseAngular.enableSynchronisation(), // ... interact with an Angular app )

You can learn more about the second approach in my article on "Cross-application testing"

If this answer helps, please mark it as accepted, thank you!

更多推荐

本文发布于:2023-07-26 10:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1274359.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试工具   宁静   js   tool   Knockout

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!