Skip to content

Instantly share code, notes, and snippets.

@DaveMBush
Last active August 6, 2016 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaveMBush/c46ea12bca44949d5320653ed5b69caa to your computer and use it in GitHub Desktop.
Save DaveMBush/c46ea12bca44949d5320653ed5b69caa to your computer and use it in GitHub Desktop.
WebDriverIO-Samples
"use strict";
describe('First test',()=>{
beforeEach(()=>{
browser.url('https://www.google.com');
});
it('should display "Google" in the title',()=>{
expect(browser.getTitle()).toBe('Google');
});
});
"use strict";
var GooglePage = require('../pages/GooglePage');
describe('First test',()=>{
beforeEach(()=>{
GooglePage.load();
});
it('should display "Google" in the title',()=>{
expect(GooglePage.title).toBe('Google');
});
describe('and I search for "Node.JS"',()=>{
beforeEach(()=>{
GooglePage.search('Node.JS');
});
it('should display "Node.JS" in the title',()=>{
expect(GooglePage.title).toBe('node.js - Google Search');
});
})
});
class GooglePage{
static load(){
browser.url('https://www.google.com');
}
static get title(){
return browser.getTitle();
}
static get searchInput(){
return browser.element('input[name="q"]');
}
static get searchButton(){
return browser.element('input[name="btnK"]');
}
static search(value){
GooglePage.searchInput.setValue('Node.js');
browser.pause(1000);
}
};
module.exports = GooglePage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment