Protractor checkbox check

3,449 views
Skip to first unread message

Anton Trapp

unread,
Oct 21, 2014, 12:49:00 PM10/21/14
to ang...@googlegroups.com
Short questions:

To clear a checkbox I must first check, if it is checked and if click it (same nonsense in every testing framework...) - correct?

To check it I have to use the "element.isSelected()" function, correct? Problem: It is always true as it is returning an parentElementArrayFinder object... - why? Am I to tired, to stupid or what?

Tnx in advance!

Kind regards,
Anton

Anton Trapp

unread,
Oct 24, 2014, 8:38:45 AM10/24/14
to ang...@googlegroups.com
Nobody writing e2e tests for AngularJS projects? Or nobody using protractor? Any good testing frameworks that support input elements like checkboxes for AngularJS e2e tests?

Adrian Lynch

unread,
Oct 24, 2014, 8:46:13 AM10/24/14
to ang...@googlegroups.com
Throw up some code. It's likely your logic is wrong rather than isSelected().

Adrian

On 24 October 2014 13:38, Anton Trapp <anton...@gmail.com> wrote:
Nobody writing e2e tests for AngularJS projects? Or nobody using protractor? Any good testing frameworks that support input elements like checkboxes for AngularJS e2e tests?

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

ravi kumar

unread,
Oct 24, 2014, 8:52:41 AM10/24/14
to ang...@googlegroups.com
Hi Anton,

I used protractor,but need to look on script so that we can check whats going on..

Thanks
Ravi
 

Anton Trapp

unread,
Oct 24, 2014, 8:55:57 AM10/24/14
to ang...@googlegroups.com
What I do:

RegistrationPage = ->
 
@email = element(`by`.model('user.email'))
 
@tosAgreement = element(`by`.model('user.tosAgreement'))



later:
  @email.sendKeys('whatever')
 
... working great, everything else too (clear, ...)
 
@tosAgreement.isSelected()



isSelected is returning a parentElementArrayFinder object, so isSelected() seems to be just returning "this"...??? Very confused ;)

Anton Trapp

unread,
Oct 25, 2014, 2:19:33 AM10/25/14
to ang...@googlegroups.com
Forget the question. I just figured out (after hours of googling) that I have to write half a page of code for simple stuff like $('elem.class:visible).count().should_be gt(0) - AngularJS integration is nice, but if I have to spend hours of time to figure out how to filter/reduce results and spent most of my time writing tests code and helpers so that the test code stays DRY... nothing for me, I rather use something efficient.

Ramesh Kumar

unread,
Oct 27, 2014, 12:32:27 AM10/27/14
to ang...@googlegroups.com
 expect(sleepPage.selection.get(2).getAttribute('checked')).toBeTruthy();  if it's  checked then it's returns true else false .
sleepPage.selection.get(2).getAttribute('checked').then(function( checked){

if (checked = true)
//your logic
})_


On Sat, Oct 25, 2014 at 11:49 AM, Anton Trapp <anton...@gmail.com> wrote:
Forget the question. I just figured out (after hours of googling) that I have to write half a page of code for simple stuff like $('elem.class:visible).count().should_be gt(0) - AngularJS integration is nice, but if I have to spend hours of time to figure out how to filter/reduce results and spent most of my time writing tests code and helpers so that the test code stays DRY... nothing for me, I rather use something efficient.

--
Reply all
Reply to author
Forward
0 new messages