Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for additional waits: checked(), selected(), disabled() ...etc. #67

Open
simoami opened this issue Dec 8, 2013 · 5 comments
Open

Comments

@simoami
Copy link

simoami commented Dec 8, 2013

While automating an internal application, I found myself having to write workarounds for some basic use cases. It's common that the user would want to check the state of form elements when automating UI or wait for the desired state condition to take place. One such case is the state of checkboxes.

I suggest adding the following waits to avoid the need for workarounds:

  • checked()
  • selected()
  • disabled()
  • containsHtml() (in contrast to .html() this is for partial matching)
  • containsText() (in contrast to .text() this is for partial matching)

Let me know what you think!

@justinbmeyer
Copy link
Member

I believe you can add ":checked" as part of your selector:

F("[name=over21]:checked").exists()

And other similar custom jQuery selector extensions.

@simoami
Copy link
Author

simoami commented Dec 9, 2013

that's what I meant by workaround. There are selectors like :visible and :hidden, yet FuncUnit adds visible() and invisible() which is great.

jasmine-jquery has such wrappers for reference.

My request is for FuncUnit to be as intuitive as possible and to allow for simple actions to be performed without resorting to special selectors. Following the BDD principles, I want to see more stakeholders (less tech-savvy) write functional tests, or at least be able to read them easily.

@alexisabril
Copy link
Contributor

I'm not opposed to having form or other generally used waits. containsHtml() seems a bit overkill though, as this comes a bit into conflict with ordinary selector usage:

F('.parent .child') vs F('.parent').containsHtml('<div class="child">')

I'm in favor of a containsText(), perhaps written as .contains(), as :contains(text) is a commonly used jQuery selector.

@simoami
Copy link
Author

simoami commented Dec 9, 2013

Until someone finds a real use case for it, I'm not too tied to adding containsHtml(). But the others make sense imo.

Thanks for considering.

@simoami
Copy link
Author

simoami commented Dec 10, 2013

similar to disabled() is enabled(), to avoid having to pass a boolean flag to disabled().

Also, here's a separate thought for better language support (similar to expect):

F().enabled();
F().hasClass('classname', false);

why not add a 'not' switch, so one can read:

F().not.enabled();
F().not.hasClass('classname');

not would only have effect on getters.

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

No branches or pull requests

4 participants