2012-11-16 40 views
2

我有一个需要验证的AngularJS应用程序。它是Express提供的一个更大项目的一部分,它的基本路径为:<base href="/path/to/app/">,而不是/。现有的应用程序已经有一个往返登录。用户需要先登录才能访问Angular应用程序。这工作正常,除了e2e用测试测试。在AngularJS基本路径之外导航时Testacular冻结

在禁用服务器上进行验证,端到端的测试运行没有问题。例如:

describe 'protected app', -> 

    it 'should display the index', -> 
    browser().navigateTo '/path/to/app' 
    expect(browser().location().url()).toBe '/' 

    it 'etc...' 

显然,服务器端验证,这将失败。我们需要先登录。我们得到以下错误:

Sandbox Error: Application document not accessible. 

当我们试图对我们的场景中登录的问题就来了。

describe 'protected app', -> 

    it 'should authenticate', -> 
    browser().navigateTo '../login' 
    #input('#email').enter('[email protected]') 
    #input('#password').enter('secret') 
    #element('button').click()  

    it 'should display the index', -> 
    browser().navigateTo '/path/to/app' 
    expect(browser().location().url()).toBe '/' 

    it 'etc...' 

运行此操作(无论是否填写表单并单击)都会导致登录页面加载并冻结。口哨决不会完成它的运行,它只是挂在登录页面上。

有没有在我的角/ Testacular /端对端测试或者一个错误的认识存在缺陷?

回答

1

Vojta说这不是一个口号问题。问题在于Angular的场景运行器不支持整个页面重新加载。