Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
' <span>one</span>\n' +
' <span>two</span>\n' +
' <span>three</span>\n' +
' \n' +
'\n';
it('wd.addElementPromisedMethod (no-chain)', function() {
_(extraElementPromiseNoChainMethods).each(function(method, name) {
wd.addElementPromiseMethod(name, method);
});
return browser
.elementById('div1')
.textTwice()
.should.become('one twoone two');
});
partials['wd.addAsyncMethod'] =
'<div id="theDiv">Hello World!</div>';
it('wd.addAsyncMethod', function() {
_(extraAsyncMethods).each(function(method, name) {
wd.addAsyncMethod(name, method);
});
return browser
// .sleepAndElementById('theDiv')
// .should.be.fulfilled
// .sleepAndText()
// .should.be.fulfilled
// .sleepAndElementById('theDiv')
// .sleepAndText().should.eventually.include("Hello World!")
.elementByCssWhenReady('#theDiv', 500).text()
.should.become("Hello World!");
});
should.not.exist(wd.Webdriver.prototype[name]);
});
};
beforeEach(function() {
noExtraMethodCheck();
});
afterEach(function() {
_(allExtraMethodNames).each(function(name) {
wd.removeMethod(name);
});
noExtraMethodCheck();
});
partials['wd.addAsyncMethod'] =
'<div id="theDiv">Hello World!</div>';
it('wd.addAsyncMethod', function(done) {
_(extraAsyncMethods).each(function(method, name) {
wd.addAsyncMethod(name, method);
});
browser.sleepAndElementById('theDiv', function(err, el) {
if(err) { return done(err); }
el.should.exist;
browser.sleepAndText(el, function(err,text) {
if(err) { return done(err); }
text.should.equal('Hello World!');
done();
});
});
});
' <span>three</span>\n' +
' \n' +
'\n';
it('wd.addElementPromisedMethod', function() {
_(extraElementPromiseNoChainMethods).each(function(method, name) {
wd.addElementPromiseMethod(name, method);
});
return browser
.elementById('div1')
.then(function(el) { return el.textTwice(); })
.then(function(result ) {
result.should.equal('one twoone two');
});
});
partials['wd.addAsyncMethod'] =
'<div id="theDiv">Hello World!</div>';
it('wd.addAsyncMethod', function() {
_(extraAsyncMethods).each(function(method, name) {
wd.addAsyncMethod(name, method);
});
return browser
.sleepAndElementById('theDiv').should.be.fulfilled
.then(function() {
return browser.sleepAndText().should.be.fulfilled;
}).then(function() {
return browser.sleepAndElementById('theDiv');
}).then(function(el){
return browser.sleepAndText(el).should.become("Hello World!");
});
});