量角器:让测试用例等到身份验证完成 [英] Protractor : Make test case wait till authentication is done

查看:75
本文介绍了量角器:让测试用例等到身份验证完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,其中我使用browser.get('app url')加载页面,然后它重新路由到其他不同的URL进行身份验证,提示输入凭据,然后转到首页(app url),而该页面完成身份验证测试用例后开始运行.问题是,某些初始测试用例因此错误'而失败,并在等待量角器与页面同步时出错:"angularJS可测试性和角度可测试性均未定义.这可能是因为这是一个非角度页面,还是因为您的测试涉及客户端导航,这可能会干扰量角器的引导程序.'

I am working on an app where I load a page using browser.get('app url') then it re-routes to some different URL for authentication, prompts for credentials then goes to home page(app url), while the page completes authentication test cases starts running. The problem is that some initial test cases fail with this error 'Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.'

我一直在git/stackoverflow/etc周围找很多东西,但是可以找到解决此问题的任何帮助.

I have been looking a lot around git/stackoverflow/etc but could find any help that has resolved this issue.

推荐答案

对我来说,丢失的东西是在beforeEach内的page.navigateTo(),添加它消除了问题-

For me, missing thing was page.navigateTo() inside beforeEach, adding it removed the issue-

import { AppPage } from './app.po';
beforeEach(async () => {
    page = new AppPage();
    page.navigateTo();
});

这篇关于量角器:让测试用例等到身份验证完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆