简体   繁体   English

是否可以用gulp-jasmine-phantom对纯js类进行e2e测试

[英]is it possible to perform e2e testing of a pure js class with gulp-jasmine-phantom

Specific scenario is that, I have a es6 class can add class to a dom upon scrolling to certain point on the screen. 具体情况是,我有一个es6类可以在滚动到屏幕上的某个点时将类添加到dom。 So to simulate that scrolling I realized I actually need to create page for that. 因此,为了模拟该滚动,我意识到我实际上需要为此创建页面。 I found that use phantomjs is the most comment way. 我发现使用phantomjs是评论最多的方法。 I also found that people use jasmine + phantom for similar e2e . 我还发现人们将茉莉花+幻影用于类似的e2e

Though I wonder when I use gulp-jasmine-phantom from npm , am I able to also do e2s as the above example did? 虽然我不知道何时从npm使用gulp-jasmine-phantom ,但我是否也可以像上面的示例一样执行e2s? How to set it up? 如何设置? Because I did not see similar setup of using phantomjs calling the test file and the .html file for the e2e testing. 因为我没有看到使用phantomjs调用e2e测试的测试文件和.html文件的类似设置。

If this is not the right approach, should I give up running phantomjs based e2e test with gulp? 如果这不是正确的方法,我应该放弃使用gulp运行基于phantomjs的e2e测试吗?

PhantomJS is a great tool and some people use it in combination with other tools for end to end testing, but it alone does not do so, nor do they make any claims. PhantomJS是一个很棒的工具,有些人将它与其他工具结合使用来进行端到端测试,但仅靠它本身并不能做到这一点,他们也没有提出任何主张。

With your setup, you already have great tools at your disposal with gulp and Jasmine. 通过设置,您已经拥有了使用gulp和Jasmine的出色工具。 For true end to end testing you need front end interaction which can be achieved Casper , or one of my personal favorite Selenium which allows for testing in multiple browser. 对于真正的端到端测试,您需要可以实现Casper的前端交互,或者是我个人最喜欢的Selenium之一 ,可以在多个浏览器中进行测试。

If you are using Angular I recommend Protractor which is itself an end to end testing framework. 如果您使用的是Angular ,建议您使用Protractor ,它本身就是端对端测试框架。

Hope that helps 希望能有所帮助

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

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