浏览代码

test: fix autofocus issue

Girish Ramakrishnan 8 年之前
父节点
当前提交
ac2eaf3570
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      test/test.js

+ 7 - 5
test/test.js

@@ -55,11 +55,13 @@ describe('Application life cycle test', function () {
     });
 
     function login(done) {
-        browser.get('https://' + app.fqdn + '/wp-login.php');
-        browser.findElement(by.id('user_login')).sendKeys(username);
-        browser.findElement(by.id('user_pass')).sendKeys(password);
-        browser.findElement(by.tagName('form')).submit();
-        browser.wait(until.elementLocated(by.xpath('//h1[text()="Dashboard"]')), TIMEOUT).then(function () { done(); });
+        browser.get('https://' + app.fqdn + '/wp-login.php').then(function () {
+            browser.sleep(2000); // there seems to be some javascript that gives auto-focus to username
+            browser.findElement(by.id('user_login')).sendKeys(username);
+            browser.findElement(by.id('user_pass')).sendKeys(password);
+            browser.findElement(by.tagName('form')).submit();
+            browser.wait(until.elementLocated(by.xpath('//h1[text()="Dashboard"]')), TIMEOUT).then(function () { done(); });
+        });
     }
 
     xit('build app', function () {