Using Protractor with PhantomJS

亡梦爱人 提交于 2019-11-28 12:57:01
alecxe

Is this still the case and Protractor still having issues with PhantomJS?

This is very true.

If so how bad is it and is there any better option?

It's difficult to answer how bad is it, but there are multiple issues about hanging phantomjs, dying phantomjs, performing slow phantomjs e.g.:

According to the question, the main reason for you to use protractor is end-to-end testing. You should try to imitate real-world use cases, imitate a real user working in your application. What browser would a real user use? PhantomJS? The answer is probably "no". Use the browsers which your application is designed to work in, and the browsers your real users use.

How would I do E2E testing when my app is being deployed to server?

The most "natural" approach is to use a remote selenium server that provides different capabilities - browsers and platforms. You can start up and configure your own selenium server, or you can use BrowserStack or Sauce Labs which are doing a great job providing you a way to test your application among a wide variety of different browsers and systems.

You can also run protractor in a headless "environment" with no real, but virtual display (xvfb), see more here.

You may use chrome itself in headless mode in 59 version onwards without any external tools.

capabilities: { 
   browserName: 'chrome', 
   chromeOptions: 
  { 
   args: [ "--headless", "--window size=800,600" ] 
  } 
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!