Skip to content

Instantly share code, notes, and snippets.

@ruben-h
Created February 9, 2017 11:28
Show Gist options
  • Save ruben-h/dc01bdf0a72508ad83958086df0920f2 to your computer and use it in GitHub Desktop.
Save ruben-h/dc01bdf0a72508ad83958086df0920f2 to your computer and use it in GitHub Desktop.
var env = require('./environment.js');
// This is the configuration file showing how a suite of tests might
// handle log-in using the onPrepare field.
exports.config = {
seleniumAddress: env.seleniumAddress,
framework: 'jasmine',
specs: [
'login/login_spec.js'
],
capabilities: env.capabilities,
baseUrl: env.baseUrl + '/ng1/',
onPrepare: function() {
browser.driver.get(env.baseUrl + '/ng1/login.html');
browser.driver.findElement(by.id('username')).sendKeys('Jane');
browser.driver.findElement(by.id('password')).sendKeys('1234');
browser.driver.findElement(by.id('clickme')).click();
// Login takes some time, so wait until it's done.
// For the test app's login, we know it's done when it redirects to
// index.html.
return browser.driver.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return /index/.test(url);
});
}, 10000);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment