问题标签 [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.
angularjs - protractor expect currenturl fails
I'm trying to get an e2e test running against my local server and test that the resulting url (after a navigational button has been clicked) is the correct result. However the resulting url is always false.
My code is shown below:
HTML:
TEST CODE:
The issue is the current url after clicking the button remains #/current_url and does not change to the expected result #/new_page.
Does anyone know where I have gone wrong?
testing - E2E 测试 - repeater().column() 提供不一致的结果
我正在为我的 Angular 应用程序编写一些 E2E 测试。我想做的一件事是确保将一组小部件加载到仪表板视图中,并在应用程序初始化时以正确的顺序放置。
JSON 数组提供了五个模拟小部件。此数组中的每个小部件字典都有一个seq
成员,我正在对我的数据进行排序。
我的模板看起来像:
(模板的特定于小部件的部分由基于指令widget.type
中动态加载的部分定义widgetView
,但对于本测试的范围而言,级别太低了)。
我的 E2E 场景如下所示:
并且基于官方 Angular 教程中的示例。
但是,它与我的预期结果比较的值是一个只有两个成员的数组。如果我更改我正在检查的属性.column()
,我会得到测试运行器报告的不同长度的数组。例如,
.column('widget.seq')
产生:
["3","4"]
.column('widget.type')
产生:
["chart","chart","simpleTable"]
.column('widget.title')
产生:
["Site Overview","Order Alerts","widget1","widget3","widget2"]
等等。
我发现这种变化很奇怪且不可预测。作为记录,那些被报告的成员确实以正确的顺序显示,但结果只是部分的,除非我查看widget.title
...
有谁知道发生了什么?
[编辑]
我能够通过以下方式获得接近我想要的东西:
div.widget
a) 向我的 s添加一个新属性
b) 编写自定义查询
像这样:
data-seq
这可行,但需要在我的应用程序代码( attr)中包含一些额外的垃圾。expect().column()
考虑到应该能够处理这个问题,这似乎有点迂回,对吧?想法?
[/编辑]
testing - Karma + AngularJS Scenario Test Runner 和表单的问题
好的,我的 Test Runner 出现问题,它正在填写表单上的字段,但是当我提交表单时,它会将这些字段称为空白。
如果我使用 element('some_element).val('some_val') 写入该字段,则效果很好。
如果我然后用 expect(element('some_element').val()).toBe('some_val') 检查该字段,它会毫无问题地通过
但
如果我提交此表单,它会返回说所有这些元素都是空的。但是我只能手动更改一个字符,它可以毫无问题地接受它。
谁能解释什么会导致这样的问题?还有关于如何绕过它的任何可能的解决方案?
angularjs - Karma:在多个浏览器上进行测试,每个浏览器都在不同的代理上
我需要每个将在(chrome、safari、firefox)上运行我的 e2e 测试的浏览器来通过不同的代理运行测试套件。
有没有办法在 karma.conf.js 文件中做到这一点?
目前我可以使用以下命令运行测试,指定浏览器和我想使用的代理,但我需要能够一次运行所有浏览器。
angularjs - AngularJS + Grunt + Karma + E2E
我尝试使用 Grunt Karma 运行 E2E 测试,但没有成功。我看了很多解决方案,但没有一个有效!
我的业力-e2e.conf.js:
};
PS:我的应用程序运行在端口 80(Apache 默认)。
我的规格如下:
})
因此,当我运行此规范时,我收到了以下消息:
“类型错误:未定义不是函数(评估 $document.injector())”
此错误发生在“expect(browser().location().path()).toBe("/main");”行
任何想法?
angularjs - 在 angularjs 中进行 e2e 测试以进行页面导航
我正在为我的 Web 应用程序编写 e2e 测试,并在一开始就卡住了。我将不胜感激任何帮助开始我的测试体验。
我对 angularjs 完全陌生。所以请多多包涵。
我想编写一个测试来检查我们是否在应用程序的登录页面上。我正在使用茉莉花和业力。
这是我的配置文件 // Karma 配置
我的 mainscenario.js 文件。
好吧,我不能发布错误的屏幕截图,因为它需要 10 名声望。但这里有一个描述。
提前致谢。
angularjs - Angular e2e / Karma - 在套件块之前?
我知道 Angular 的 e2e 测试对单独的测试有一个 beforeEach ......但我正在寻找整个套件的升级。有人知道在执行整个测试套件之前运行代码块的方法吗?
angularjs - protractor-js 设置表单动作属性
我今天尝试通过表单发送数据,但数据必须放在 post uri 中,有没有办法将参数附加到表单 uri 中,然后我可以提交点击。
我已经尝试了下面的代码。然而,
driver.findElement(protractor.By.name('formelement')).setAttribute('action', attr);
返回 Object 没有方法 setAttribute
javascript - Mocking angularjs http requests
So i have done quite a research already before asking this and none of them is what i want.
I have an app bootstrapped with angular module. The controller inside the module makes some http requests. Now i am unit testing my app for ui and i need to mock the http requests. All the mocking that i have read is done with jasmine, but i don't want to use it.
I want that whenever i open the app, all the requests get mocked. I have already tried angular mock and the backend mocks, none of them workes. And i dont want to prepopulate the scope elements because the code should be deployment ready.
ruby-on-rails - 我应该将 Cucumber 用于 AngularJS 单页应用程序吗?
我对 Cucumber 和 Angular 都很陌生。我有一个 Rails 应用程序,它是一个单页应用程序。我应该打扰 Cucumber 还是应该只使用 AngularJS 的 e2e 测试?
任何见解,比较和过去的经验都值得赞赏!