问题标签 [angularjs-e2e]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
api - AngularJS量角器E2E模拟
我有一个 Angular SPA 从节点后端检索其数据。由于节点项目完全覆盖了测试,我想模拟 Angular HTTP 调用。(我不想开始讨论一般的功能/烟雾测试,谢谢)。
我想要的是s.th。像这样
但无论如何我都找不到一个好的解决方案。我发现了几个关于同一问题的帖子。比如这个。
由于量角器经常变化很多,我只想在这里问一下是否有人找到了模拟 HTTP 请求的适当解决方案。
javascript - (量角器)检查单击时是否禁用输入?
我有两个输入字段,用户名和密码以及一个微调按钮。当我单击此微调器按钮时,这两个输入字段被禁用,我被重定向到另一个页面。我正在编写端到端测试来检查这些输入字段是否被禁用。
angularjs - AngularJS:在端到端测试中模拟后端服务器
我正在创建我的第一个 Angular 指令,并想做一些端到端的测试,但我不知道如何模拟对后端的调用。
我正在使用 ng-scenario & karma 进行测试
这是我的模块
如果我注释掉 $http 行,那么我的测试就通过了。那么在端到端测试中模拟 $http 调用的最佳方法是什么?
更新
尝试加载 ngMockE2E
我创建了一个 myAppDev.js 文件来模拟请求
和一个 runner.html 文件来加载 E2E 测试的所有内容
我更改了测试以导航到我的运行程序文件。
由于模拟不起作用,我仍然收到错误消息。
javascript - 量角器下拉列表元素 e2e 测试
我是 Protractor 的新手,我正在执行一些 e2e 测试,当我尝试调用下拉列表并选择其中一个选项时,我在最后一个测试中遇到了问题。
这是我的代码:
referenceError
我每次得到的是:
这个错误怎么可能?
提前感谢您的帮助。
javascript - ngScenario: browser().window() 和 browser().location() 有什么区别
我正在学习使用 AngularJS 进行端到端测试,并且一直在阅读 Angular Scenario Runner (ngScenario),这里描述了它的 API:http: //docs.angularjs.org/guide/e2e-testing
我的问题很简单,就像标题一样。
根据上面链接的文档,这些browser().location()
方法返回服务的相应方法的结果$location
。
因此,例如:
browser().location().path()
返回$location.path()
,而browser().window().path()
返回window.location.pathname
在service的文档中$location
,我们被告知:
$location 服务解析浏览器地址栏中的 URL(基于 window.location)并使 URL 可用于您的应用程序。
因此,它们似乎最终都解决了该window.location
对象。
我错过了什么区别,你什么时候使用一个而不是另一个?
javascript - AngularJS 初始化后端测试
我有 AngularJS + RequireJS 应用程序。我的任务是为 UI 开发目的创建一个后端版本。因此,模拟了部分/所有 HTTP 请求的版本。所需的用户流是:
- 用户去 /debug 初始化一个后端版本。
- 用户可以在模拟 HTTP 请求的情况下使用该应用程序。
我正在尝试使用 ngMockE2E.$httpBackend。但我找不到任何关于如何将其注入已经引导的应用程序的信息。按照大多数谷歌搜索的示例,我正在尝试创建一个新模块并引导该模块:
但这给了我“错误:ng:btstrpd App 已经用这个元素引导”。关于如何开发此任务的任何想法?
javascript - 错误:等待量角器在 11001 毫秒后与页面同步时超时。”当用户 browser.getCurrentUrl()
我正在测试登录和注销功能,下面是我的测试用例
当我在上面运行测试它失败时,下面是错误消息
我尝试使用browser.waitForAngular();
,但没有帮助。当我删除期望"expect(browser.getCurrentUrl()).toMatch(/\/login/);"
时,它就通过了。任何人都遇到过同样的问题,任何帮助都是appricated
angularjs - 如何模拟 get(id) 请求
我正在构建一个应用程序原型并尝试模拟 REST Web 服务。
这是我的代码:
一切正常,我的资源 User.query() 返回所有用户,而 User.get({id:1}) 和 User.get({id:2}) 返回同一个用户(John)。
现在为了改进我的原型,我想返回合适的用户,匹配好的 id。
我在角度文档中阅读了我应该能够用函数替换 RegExp URI。这个想法是从 url 中提取 id 以在响应方法中使用它。然后我尝试了这个:
问题是 url 参数始终未定义。有什么想法可以实现我的目标吗?
angularjs - AngularJS e2e tests hang when changing between two separate angular apps
I have a frustrating problem: I want to write end to end tests for a complex angular app. The problem is that the login screen is a separate app. The initial idea was that it would branch out to separate other angular apps in our ecosystem based on the login credentials. It works like a charm. For the tests it is a nightmare though.
The tests work as expected but as soon as correct credentials are entered and the main angular app is loaded the tests just time out. No error message or debug output whatsoever, its just waiting. I can see the page is loading correctly.
Now I thought I would skip this part and test right on the target app but thats not working either since I need to initialize the server with the right credentials first (= go through the login screen).
I tried this with the karma scenario runner and protractor, both show the exact same behavior. Can I tell them to reinitialize after the target page is loaded?
javascript - 发现 Karma E2E 测试但已跳过并标记为失败
鉴于 e2e 配置:
和场景:
程序找到了 3 个测试,但没有通过或失败,而是跳过它们。运行脚本(使用 Windows 8.1,git bash)返回说:
Karma v0.12.1 服务器启动于HTTP://localhost:9876/ karma /"
启动 Chrome 连接到套接字 Chrome 31.0.1650 执行 0 of 3
(跳过 3)错误
知道为什么可以找到甚至不需要遍历站点或查看 DOM 等的测试但无法运行吗?