我开始与Galen合作,我的测试完美无缺:
this.HomePage = $page('Welcome Page', {
aboutButton: 'nav.navbar .about'
});
this.AboutPage = $page('About page', {
modalContent: 'div.modal-content',
supportLink: '.support-link',
dismissButton: '.dismiss'
});
var homePage = new HomePage(driver);
homePage.waitForIt();
homePage.aboutButton.click();
var aboutPage = new AboutPage(driver);
aboutPage.waitForIt();
我理解waitForIt
方法等待页面定义的所有属性,因此框架知道何时执行下一个语句。
现在,我想将此作为一个繁琐的任务运行,我一直在使用grunt-galenframework
,我正确配置,一切正常,但我无法进行上一次测试通过,任务代码如下:
load('../gl.js');
forAll(config.getDevices(), function (device) {
test('simple test on ' + device.deviceName, function () {
gl.openPage(device, config.getProjectPage(), "Welcome Page", {
aboutButton: 'nav.navbar .about'
});
elements.aboutButton.click();
// MISSING WAIT FOR ABOUT_PAGE
gl.runSpecFile(device, './test/responsive/galen/about.gspec');
});
});
如您所见,我进入Welcome Page
,然后我需要点击按钮,等待对话框出现,然后查看about.gspec
规格(他们验证对话框内的元素)。
那么如何添加等待新元素显示在同一网址上?感觉grunt-galenframework
仅在输入新网址时提供wait
, openPage
方法。
答案 0 :(得分:1)