Last active
August 6, 2016 17:43
-
-
Save DaveMBush/c46ea12bca44949d5320653ed5b69caa to your computer and use it in GitHub Desktop.
WebDriverIO-Samples
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
"use strict"; | |
describe('First test',()=>{ | |
beforeEach(()=>{ | |
browser.url('https://www.google.com'); | |
}); | |
it('should display "Google" in the title',()=>{ | |
expect(browser.getTitle()).toBe('Google'); | |
}); | |
}); |
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
"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'); | |
}); | |
}) | |
}); |
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
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