2016-11-16 121 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')翻转斜杠。我用简单的字符串连接替换它,它工作正常。

相关问题