2016-11-16 120 views
0

我想使用Nightwatch.js v.0.9.8進行E2E測試。Nightwatch.js導航在驅動程序中的行爲有所不同

page object

module.exports = { 
    url() { 
    return path.join(this.api.launchUrl, 'Home/Index'); 
    } 
}; 

我的測試:

module.exports = { 
    'Sample 1'(client) { 
    client.page.home() 
     .navigate() 
     .expect.element('body').to.be.present; 
    }, 
    'Sample 2'(client) { 
    client.page.home() 
     .navigate() 
     .expect.element('header').to.be.present; 
    client.end(); 
    } 
}; 

這完美的作品在Chrome中。

但是,在Firefox(geckodriver 0.11.1 x64)中,Sample 2結束運行在http://localhost:3535/localhost:3535/Home/Index

IE(IEDriverServer 2.53.1 x64)以對話窗口打開: 找不到路徑'http:\ localhost:3535 \ Home \ Index'。確保路徑或Internet地址是正確的。

我是否缺少明顯的東西?

回答

1

解決了它 - 我的錯誤。問題是path.join(this.api.launchUrl, 'Home/Index')翻轉斜槓。我用簡單的字符串連接替換它,它工作正常。

相關問題