How do I do Automating Ember testing with Dalek (setup/teardown of specific Ember components)

自作多情 提交于 2019-12-13 04:34:34

问题


My TLDR; version of my question is "Is there a way I can integrate with qunit such that Dalek can get the correct context when it needs it, or conversely, can I get Dalek to run setup/teardown asset-pipeline-compiled Ember javascript to build a context for it to run tests on?"

Firstup Dalek look awesome! All my tests are currently written in qunit. I'm having some problems automating tests around a component I'm building in Ember. The component is a kind of WYSIWYG textarea.

(BTW, my qunit tests are being driven from a route within a rails application.)

To automate testing, my qunit scripts have a setup and tearDown that create a pristine textarea each time. Each test creates some content in the textarea, then interacts with it somehow doing some assertions on it.

That's all well and good, except that I require much better browser simulation than qunit can provide me with (and I'm really running out of patience for writing my own range-related browser-response simulation code).

The things I need to do mostly are: 1. Move the caret around using arrow keys, and type characters. 2. Click at specific points in the textarea (not x,y co-ords, but rather a specific points in the text).

It struck me that Dalek could totally help with this, but the way I'm doing this workflow, I think I'd either need Dalek to be remote controllable via my qunit tests, or else somehow rewrite my tests in Dalek, but to do that, I'd need to be able to get Dalek to use jQuery and Ember to create the component and data context for the setup/teardown, which I'm not even sure Dalek supports.

What I really need is part-integration, part-unit testing, and there doesn't seem to be a great answer in the JS/Rails/Ember testing space that will handle this set of conditions.


回答1:


I fear DalekJS is not the tool you need right now, even if it is "my little tool" I suggest to use Karma (former called Testacular) - which was originally developed to test AngularJS applications: http://karma-runner.github.io/0.12/index.html

You could use it together with Protractor https://github.com/angular/protractor It depends on selenium, but is fairly easy (compared to some other tools) to set up.

There is also a manual on how to use it in combination with Ember: http://karma-runner.github.io/0.10/plus/emberjs.html



来源:https://stackoverflow.com/questions/22446547/how-do-i-do-automating-ember-testing-with-dalek-setup-teardown-of-specific-embe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!