angular官方tutorial的一个e2e测试fail
发布于 1天前 作者 DevinXian 69 次浏览 来自 问答

tutorial走的,到第6步的e2e test失败了,问题代码如下:

  it('should render phone specific links', function() {
    var query = element(by.model('query'));
    query.sendKeys('nexus');
    element.all(by.css('.phones li a')).first().click();//这一行不行了
    //element(by.css('.phones li a')).first().click()同样
    browser.getLocationAbsUrl().then(function(url) {
      expect(url).toBe('/phones/nexus-s');
    });
  });

堆栈信息如下:

Session ID: 2e76c2cc5af498175f67b8f8670da6d8 Stacktrace: ElementNotVisibleError: element not visible (Session info: chrome=45.0.2454.85) (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Linux 3.19.0-28-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 26 milliseconds Build info: version: '2.45.0’, revision: '5017cb8’, time: ‘2015-02-26 23:59:50’ System info: host: 'wind’, ip: '127.0.1.1’, os.name: 'Linux’, os.arch: 'amd64’, os.version: '3.19.0-28-generic’, java.version: ‘1.8.0_60’ Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/tmp/.com.google.Chrome.agwfKC}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=45.0.2454.85, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 2e76c2cc5af498175f67b8f8670da6d8 at Array.forEach (native) Error at [object Object].<anonymous> (/home/wind/projects/angular-test/test/e2e/scenarios.js:50:36) From: Task: Asynchronous test function: it() Error at [object Object].<anonymous> (/home/wind/projects/angular-test/test/e2e/scenarios.js:46:3) at [object Object].<anonymous> (/home/wind/projects/angular-test/test/e2e/scenarios.js:2:2) at Object.<anonymous> (/home/wind/projects/angular-test/test/e2e/scenarios.js:1:63)

Finished in 2.939 seconds 3 tests, 6 assertions, 1 failure

求助大伙,stackoverflow翻了翻,没解决- -||菜鸟代码在这里github

回到顶部