From 755502a28e38638a11b6b5a17bfda3e621c1d1be Mon Sep 17 00:00:00 2001 From: Gunther Brunner Date: Tue, 26 Aug 2014 21:47:41 +0900 Subject: [PATCH] Try to clean up after logging in. --- res/test/e2e/login/index.js | 16 +++++++++++++++- res/test/protractor.conf.js | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/res/test/e2e/login/index.js b/res/test/e2e/login/index.js index e0530018..63016534 100644 --- a/res/test/e2e/login/index.js +++ b/res/test/e2e/login/index.js @@ -4,6 +4,7 @@ module.exports = function LoginPage() { this.get = function () { return browser.get(this.login.url) } + this.username = element(by.model('username')) if (this.login.method === 'ldap') { @@ -12,6 +13,7 @@ module.exports = function LoginPage() { this.email = element(by.model('email')) } + this.setName = function (username) { return this.username.sendKeys(username) } @@ -32,6 +34,18 @@ module.exports = function LoginPage() { } else { this.setEmail(this.login.email) } - return this.submit() + + this.submit() + + return browser.driver.wait(function () { + return browser.driver.getCurrentUrl().then(function (url) { + return /devices/.test(url) + }) + }) + } + this.cleanUp = function () { + this.username = null + this.password = null + this.email = null } } diff --git a/res/test/protractor.conf.js b/res/test/protractor.conf.js index da2eba65..dad2470e 100644 --- a/res/test/protractor.conf.js +++ b/res/test/protractor.conf.js @@ -38,7 +38,7 @@ exports.config = { onPrepare: function () { var loginPage = new LoginPage() loginPage.doLogin() - //browser.driver.wait(loginPage.login) + loginPage.cleanUp() afterEach(function () { BrowserLogs({expectNoLogs: true})