2015-05-28 67 views
1

我目前正在处理与我的量角器测试对IE浏览器的问题。量角器测试不适用于IE,但它与FF/Chrome/Safari

我用量角器+茉莉+ Node.js的

我是测试页面的部分如下:

<h2 collapser="" class="title text-center text-uppercase active">Tech Specs <i class="plus-icon"></i></h2> 

我有如下测试:

it('User should be able to see module 11 Tech Specs collapsing and uncolapsing', function() { 
    basePage.techSpecCollapser.click(); 
    browser.sleep(1000); 
    expect(basePage.techSpecContainer.isDisplayed()).toBeTruthy(); 

}); 

这是控制台输出:

Landing page module verification --> 
    User should be able to see module 11 Tech Specs collapsing and uncollapsing - fail 


    1) New Landing page module verification --> User should be able to see module 11 Tech Specs collapsing and uncolapsing 
    at 15.446s [Thu, 28 May 2015 14:23:08 GMT] 
    Message: 
    Expected false to be truthy. 
    Stacktrace: 
    Error: Failed expectation 
    at [object Object].<anonymous> (/Users/test/Documents/Dev/test/sandBox/specs/landing_page_spec.js:44:58) 

Finished in 15.448 seconds 
1 test, 1 assertion, 1 failure 

通过观看测试运行,我看到网页的一部分没有显示。我试过了:

  • 强制滚动页面的那一部分:没有用。
  • 聚焦页面的这一部分:没有工作。

有没有人遇到同样的问题?可以使其工作,这是非常简单的测试!

回答

1

有许多东西可以尝试解决这个问题:

  • 运行测试之前,浏览器窗口最大化。这种加入onPrepare()

    browser.driver.manage().window().maximize(); 
    
  • 去除不可靠browser.sleep()并明确等待元素与visibilityOf expected condition变得可见:

    var EC = protractor.ExpectedConditions; 
    basePage.techSpecCollapser.click(); 
    browser.wait(EC.visibilityOf(basePage.techSpecContainer), 10000); 
    
  • 移动的元素:

    browser.executeScript("arguments[0].scrollIntoView();", basePage.techSpecContainer.getWebElement()); 
    
+0

感谢@alecxe,但我仍然一样为此输出。我已经添加了所有你所建议的内容,一个接一个地提出你的建议!但仍似乎没有显示该页面的一部分,我想可能是没有正确点击上一个元素。还有什么其他建议? –

+0

@BrunoSoko很好,很难说没有能够调试的问题。在黑暗中的另一个镜头,尝试按以下方式执行单击:'browser.executeScript(“arguments [0] .click();”,basePage.techSpecCollapser.getWebElement());'。 – alecxe

+0

你说得对。你在这里被蒙上眼睛,我带着不同的错误,但是通过添加这个'browser.manage()。timeouts()。隐式地等待(100000);'con config.js文件并且在我的测试中这样做: ''' ();(函数()){function.(){browser.wait(EC.visibilityOf(thxPage.thankYou),90000); expect(thxPage.thankYou.isPresent())。toBeTruthy(); } ); ''' –

相关问题