im having big problems trying write end2end testing.
this scenario: want count number of options given element.
what dont want use id's, im trying select without polluting html.
lets see html:
<form class="catalogue-sidebar"> ... <ki-multi-select-option> <select> ... <option></option> ... </select> </ki-multi-select-option><!-- ki-multi-select-option --> ... </form><!-- .catalogue-sidebar -->
i have few ki-multi-select-option directives here. need count lets say, number of options on second one.
how can select ?
using id's (this works):
var colorsoptions = browser.findelements( by.css( '#filter-colors select > option' ) ); colorsoptions.then( function( elements ) { // there empty option default, thats why "greater 1" expect( elements.length ).tobegreaterthan( 1 ); });
but said, want avoid including ids testing.
i have tried lot of different combinations without success.
using jquery this:
$( ".catalogue-sidebar ki-multi-select-option:eq(1)" ).find( 'select > option' )
anybody can me here ?
thanks !
using css:
var options = element.all(by.css('.catalogue-sidebar ki-multi-select-option:nth-child(1) select option'));
var kiwrapper = element.all(by.css('.catalogue-sidebar ki-multi-select-option')).get(1); var options = kiwrapper.all(by.css('select option'));
now count function there no need of then
since expect
handles webdriver promises:
expect(options.count()).tobegreaterthan(1);
Comments
Post a Comment