简体   繁体   English

将Protractor与SystemJS一起使用的正确方法是什么?

[英]What is the proper way to use Protractor with SystemJS?

This problem should apply to requirejs as well. 这个问题也应适用于requirejs。

The specifics: 具体内容:

  • Protractor 量角器
  • SystemJS loading ES6 BabelJS transpiled system modules SystemJS加载ES6 BabelJS转译的系统模块
  • Cucumber.js Cucumber.js
  • Chai, chai-as-promised 柴如许

The reason I'm asking is because I have just a couple very basic cucumber tests and sometimes I get errors (inconsistently) involving timeouts or waiting to sync with the page etc. Other times my tests pass and no timeout errors are given. 我要问的原因是因为我只有几个非常基本的黄瓜测试,有时我收到涉及超时或等待与页面同步等错误(不一致)。其他时候我的测试通过了,并且没有给出超时错误。 There is not a ton of authoritative information on these problems. 关于这些问题,没有大量的权威信息。 Mainly just a bunch of SO and github issues. 主要只是一堆SO和github问题。

What is the proper way to use Protractor with SystemJS? 将Protractor与SystemJS一起使用的正确方法是什么?

These don't sound like issues specific to SystemJS. 这些听起来不像SystemJS特有的问题。

Rather, in my experience, they are pretty much the joys of working with Protractor. 而是,根据我的经验,与Protractor合作非常有趣。

Things the you can do to mitigate the issues however include: 您可以采取的缓解问题的措施包括:

  • Add browser.manage().timeouts().implicitlyWait(5000); 添加browser.manage().timeouts().implicitlyWait(5000); before any tests run. 在运行任何测试之前。 Perhaps in your protractor onPrepare config method 也许在您的量角器onPrepare配置方法中
  • Try browser.waitForAngular(); 试试browser.waitForAngular();
    • Theoretically its called internally in Protractor, but somethings it seems to be needed..? 从理论上讲,它在量角器内部被调用,但是似乎有些需要。
  • Wait for elements to be clickable, before clicking them: browser.wait(protractor.ExpectedConditions.elementToBeClickable(elm), 2000); 等待元素可单击,然后再单击它们: browser.wait(protractor.ExpectedConditions.elementToBeClickable(elm), 2000); elm.click();

You may also be interested to see that there is a new project that hopes to avoid all the pitfalls with selenium based test frameworks.. by not using selenium at all. 您可能还希望看到有一个新项目希望通过根本不使用硒来避免使用基于硒的测试框架带来的所有陷阱。 It claims to be much simpler, faster and less error-prone: https://www.cypress.io/ 它声称更加简单,快捷且不易出错: https//www.cypress.io/

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

相关问题 为滑块输入设置值的正确方法是什么? (量角器自动化) - What is the proper way to set values to a Slider Input? (Protractor Automation) 什么是使用输入范围侦听器的正确方法 - What is a Proper way to use Input range listener 在 ReactJS 中使用多个布局的正确方法是什么 - What is the proper way to use multiple layouts in ReactJS 使用异步存储的正确/正确方法是什么? - What is the proper/right way to use Async Storage? 将jQuery与“ use strict”结合使用的正确方法是什么? - What's the proper way to use jQuery in conjunction with 'use strict'? 使用Promise.reject和javascript的正确方法是什么 - What is the proper way to use Promise.reject with javascript 在 Bootstrap Datepicker 中使用 Months 视图的正确方法是什么? - What is the proper way to use the Months view in Bootstrap Datepicker? 使用node.js postgresql模块的正确方法是什么? - What is the proper way to use the node.js postgresql module? 在 Node JS 中仅使用包含数据的变量的正确方法是什么? - What is the proper way to use only variables that contain data in Node JS? Javascript / jQuery变量,使用var的正确方法是什么? - Javascript/jQuery variable, what is the proper way to use a var?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM