javascript - Understanding Protractor and WebDriverJS control flow -
can me understand how webdriverjs/protractor works in case?
function mypageobject(buttonelementfinder) { this.getbuttonbyindex = function(index) { return { mybutton: buttonelementfinder.get(index) } } } 1. describe('my button', function() { 2. 3. it('should contain text foo', function() { 4. var myelementfinder = element.all(by.css('.foo')); 5. var pageobject = new mypageobject(myelementfinder); 6. var button = pageobject.getbuttonbyindex(0); 7. expect(button.text()).tobe('foo'); 8. }); 9. 10. });
does webdriverjs control flow have action added on line 6 because of .get
method of elementfinder
s?
i presume expect
adds item control flow on line 7?
edit: have update code use element.all
.
var myelementfinder = element.all(by.css('.foo'));
myelementfinder elementarrayfinder , object. nothing async happening here.
var pageobject = new mypageobject(myelementfinder);
obvious.
var button = pageobject.getbuttonbyindex(0);
this return elementfinder buttonelementfinder.get. nothing async happening here.
expect(button.text()).tobe('foo');
button.text()
returns promise webdriver.schedule
, in turn using control flow retrieved using webdriver.promise.controlflow()
, exposes execute function.
Comments
Post a Comment