Created
September 9, 2015 16:17
-
-
Save sbmaxx/0fece972759b068d4562 to your computer and use it in GitHub Desktop.
webriver.mocha.chai.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chai = require('chai'), | |
assert = chai.assert, | |
webdriverio = require('../../index'); | |
describe('firefox', function(){ | |
this.timeout(99999999); | |
var client = {}; | |
before(function(done){ | |
client = webdriverio.remote({ desiredCapabilities: {browserName: 'firefox'} }); | |
client.init(done); | |
}); | |
it('should fill input', function() { | |
return testInput(client); | |
}); | |
after(function(done) { | |
client.end(done); | |
}); | |
}); | |
describe('chrome', function(){ | |
this.timeout(99999999); | |
var client = {}; | |
before(function(done){ | |
client = webdriverio.remote({ desiredCapabilities: {browserName: 'chrome'} }); | |
client.init(done); | |
}); | |
it('should fill input', function() { | |
return testInput(client); | |
}); | |
after(function(done) { | |
client.end(done); | |
}); | |
}); | |
function testInput(client) { | |
var input = 'input[name=q]'; | |
return client | |
.url('https://google.com') | |
.waitForVisible(input, 5000).then(function(isVisible) { | |
assert(isVisible, 'input not visible'); | |
}) | |
.click(input) | |
.keys('ololo') | |
.getValue(input).then(function(value) { | |
assert.equal('ololo', value); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment