我想知道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!
更多推荐
发布评论