Skip to content
Snippets Groups Projects
Commit 90f5eb12 authored by Kegan Dougal's avatar Kegan Dougal
Browse files

Set required environment variables for e2e testing.

Added an 'id' to the login button so it can be automatically triggered.
Also, added an onPrepare section to protractor.conf to do the login.
parent 7dfcba16
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@
<br/>
<input id="password" size="32" type="password" ng-model="account.password" placeholder="Password"/>
<br/><br/>
<button ng-click="login()" ng-disabled="!account.user_id || !account.password || !account.homeserver">Login</button>
<button id="login" ng-click="login()" ng-disabled="!account.user_id || !account.password || !account.homeserver">Login</button>
<br/><br/>
</div>
......
......@@ -16,8 +16,12 @@ on. If you do, edit the config to point to that url):
webdriver-manager start
Create a file "environment-protractor.js" in this directory and type:
var seleniumAddress = 'http://localhost:4444/wd/hub';
module.exports = {
seleniumAddress: 'http://localhost:4444/wd/hub',
loginUrl: "http://localhost:8008/_matrix/client/#/login",
username: "YOUR_TEST_USERNAME",
password: "YOUR_TEST_PASSWORD"
}
Running e2e tests:
protractor protractor.conf.js
......
var env = require("./environment-protractor.js");
exports.config = {
seleniumAddress: env.seleniumAddress,
specs: ['e2e/*.spec.js']
seleniumAddress: env.seleniumAddress,
specs: ['e2e/*.spec.js'],
onPrepare: function() {
browser.driver.get(env.loginUrl);
browser.driver.findElement(by.id("user_id")).sendKeys(env.username);
browser.driver.findElement(by.id("password")).sendKeys(env.password);
browser.driver.findElement(by.id("login")).click();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment