【发布时间】:2017-07-01 01:09:01
【问题描述】:
我有一个在 iFrame 中运行的 Angular 应用程序。我必须启动父应用程序 URL,因为它提供了一些标志,使 Angular 应用程序按预期工作。现在我需要在 iFrame 中为 Angular 应用程序编写量角器测试。
这里是代码。
describe('French page', function() {
var IFRAME = "iframe",
TITLE_FR = 'Découverte automatique',
PAGE_URL = '/SAAS/admin/app/page',
pagePaths = browser.params.paths;;
beforeEach(function (done) {
LOGIN_PAGE.goToPageAndLogin().then(function (){
browser.driver.ignoreSynchronization = true;
browser.get(PAGE_URL); // application has angular app in iFrame
browser.sleep(5000);
browser.waitForAngular();
done();
});
});
afterEach(function (done) {
demoPause();
LOGIN_PAGE.logout().then(done);
});
it('should be able to launch with fr-FR locale', function (done) {
browser.driver.switchTo().frame(IFRAME); //Switch to angular app in iFrame
// Check if element text is in french
browser.driver.findElement(by.css('.app-menu li:nth-child(1) p')).then(function (elem) {
elem.getText().then(function (text) {
expect(text).toBe(TITLE_FR); // I can see that both texts are same here while debugging
browser.driver.ignoreSynchronization = true;
done();
});
});
});
});
测试条件通过但退出并出现以下错误。 留言:
失败:在页面上找不到 Angular https://host/abcd/admin/app/page
重试寻找角度超出范围
【问题讨论】:
标签: protractor