Forked from ruben-h/protractor tests with login example.conf.js
Created
January 3, 2018 21:33
-
-
Save benjaminapetersen/cdba904eb1e3de18b5371ca3ba07d1ff to your computer and use it in GitHub Desktop.
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 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