我目前正在处理针对IE的量角器测试的问题。
我正在使用Protractor + Jasmine + 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
通过观看测试运行,我看到网页的那部分没有显示出来。我试过了:
有没有人遇到同样的问题?可以使它工作,这是非常简单的测试!
答案 0 :(得分:1)
您可以尝试解决多种问题:
在运行测试之前最大化浏览器窗口。将其添加到DECLARE @DATE_AP dateTime
DECLARE @month varchar(max)
SET @DATE_AP= DATEADD(year, 0, GETDATE())
SET @month_AP = DATENAME(Month, @DATE_AP)
SELECT CAST(@month as VARchar(10))
select @periodsetvar = 'select CASE'+ ' '+ @month+'
when ''October'' then
''Update tbltimes set Periodyr = 01''
when ''November'' then
''Update tbltimes set Periodyr = 02''
when ''December'' then
''Update tbltimes set Periodyr = 03''
when ''January'' then
''Update tbltimes set Periodyr = 04''
when ''February'' then
''Update tbltimes set Periodyr = 05''
END'
exec (@periodsetvar)
:
onPrepare()
删除不可靠的browser.driver.manage().window().maximize();
并明确等待visibilityOf
expected condition显示该元素:
browser.sleep()
转到元素:
var EC = protractor.ExpectedConditions;
basePage.techSpecCollapser.click();
browser.wait(EC.visibilityOf(basePage.techSpecContainer), 10000);