Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Testing CodeMirror with CapybaraWebkit #870

Closed
tansaku opened this issue Jan 5, 2016 · 2 comments
Closed

Testing CodeMirror with CapybaraWebkit #870

tansaku opened this issue Jan 5, 2016 · 2 comments

Comments

@tansaku
Copy link

tansaku commented Jan 5, 2016

We're writing some tests to check the operation of a site using codemirror. We're using capybara webkit, but it's not clear how to simulate entering text into the editor.

I've found some mention of a solution online that involves making an editor variable global which feels like a bit of a hack:

http://stackoverflow.com/questions/30376526/fill-in-editor-textarea-using-capybara-webkit

Does anyone know of a good way we can use to enter code into codemirror using Capybara Webkit or similar that's a bit less hacky?

@jferris
Copy link
Contributor

jferris commented Jan 5, 2016

I think the most standard way would be to use send_keys from Capybara:

page.find('#codemirror-element').send_keys("hello")

Unfortunately, we haven't implemented send_keys in capybara-webkit yet. It should be possible using QtWebkit, but we haven't gotten around to it. You could use the selenium driver for those tests for now.

@tansaku
Copy link
Author

tansaku commented Jan 12, 2016

thanks @jferris - great suggestion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants