问题标签 [end-to-end]

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.

0 投票
1 回答
1231 浏览

angularjs - 使用 Protractor 检查 POST 请求有效负载数据

假设我有一个带有几个输入元素和保存按钮的角度页面。单击保存按钮后,将发送 POST 请求。我正在为此页面编写 Protractor e2e 测试。

问题:

如何在发送应用程序后或发送前检查量角器 POST 请求有效负载数据?我想确保我的应用程序将在 POST 请求中发送正确的数据。

0 投票
2 回答
19941 浏览

javascript - 量角器给出“无法启动 WebDriver 会话”错误

我已经使用 启动了服务器webdriver-manager start,但是当我尝试运行量角器时出现此错误:

我的配置文件如下所示:

我还尝试指向功能对象中的二进制文件以及添加 chromeDriver 和 seleniumServerJar 键无济于事。有任何想法吗?

0 投票
1 回答
4022 浏览

javascript - 目的 # has no method 'getInstance' when trying to run Protractor tests

When I am attempting to run my Protractor tests from the command line all of my tests fail because whenever I try to access the protractor object i

When I am attempting to run my Protractor tests from the command line all of my tests fail because whenever I try to access the protractor object it does not have the methods I need. The exact error is:

TypeError: Object # has no method 'getInstance'

So this seems to have been a reported and fixed issue, yet I cannot seem to resolve my particular situation. It also seems to be semi-related to this question, but because it arose for me after updating my node_modules I feel like my underlying issue is different. Up until updating my Protractor everything worked just fine.

I installed it globally and used npm link protractor to link my local instance to my global instance (located at /usr/local/lib/node_modules/protractor), but I still for the life of me cannot figure out what is wrong.

The exact code where I'm calling protractor is a page object file that looks like:

The code instantiating the page object is as follows:


Bash Script to Comment/uncomment lines in file

I have a standard text configuration file in Linux (Fedora 20). Most lines should apply all the time, but a few lines need to be "turned on" (uncommented) and "turned off" depending on the machine the file is on. So the file looks like this:

What I would like to do is run a script that would change the file (or copy the file) altering commenting of the lines based on command line parameters. e.g.

This would cause all lines with %%machine-2%% in the end comment to be uncommented (of course, leaving the end comments in tact), and all lines with %%machine-1%% in the end comment to be commented.

Any suggestions on how to do this? Thank you.

0 投票
4 回答
11956 浏览

javascript - 使用量角器获取所有元素属性

根据文档,要按名称获取单个属性,您可以.getAttribute()在 a 上使用WebElement

但是我怎样才能得到一个元素的所有属性呢?

Protractor API中没有关于此用例/功能的信息。

0 投票
4 回答
491 浏览

html - 如何判断是否禁用

0 投票
3 回答
5898 浏览

angularjs - 重新运行量角器超时或测试失败

我没有找到任何关于重新运行失败测试(使用量角器)的可能性的参考。你知道怎么做吗?太好了,因为我有很多测试,我不想再次运行所有测试来验证之前失败的测试是否通过。

有没有人有这方面的经验?它会这样:

  • 运行所有测试
  • 收集失败的测试并再次运行它们(也许我可以以某种方式设置重试限制,如 2 或 3 次)
  • 显示结果
0 投票
1 回答
3649 浏览

angularjs - 量角器:测试视野焦点

如何测试输入字段是否与量角器不聚焦?我正在这样做:

这似乎适用于 chrome,但该测试在 Firefox 中失败。有任何想法吗?

这是失败消息:

这是我的测试脚本:

0 投票
3 回答
3717 浏览

javascript - 量角器:检查数据按日期排序

我需要检查返回的数据是否按日期排序。我是这样写的:

这将返回:

我究竟做错了什么?currentUser 和 lastUser 似乎是对象而不是文本......但我不知道为什么。

0 投票
1 回答
1928 浏览

javascript - 量角器 + 角度误差 - 元素在点处不可点击

尝试使用量角器和角度测试模态窗口上的可见按钮时,我收到以下错误:

UnknownError:未知错误:元素在点 (400, 234) 处不可点击。其他元素将收到点击:<div class="modal-footer">...</div>'。

我尝试在每个语句之前将窗口大小调整为更大的大小,并在单击之前尝试滚动到页面顶部。有什么建议么?

代码:

大多数HTML:

0 投票
1 回答
244 浏览

testing - 我们可以在量角器中将测试用例名称作为屏幕截图的标题吗?

来自protractorConfig.js

有一个选项 docTitle,但不确定如何在此处获取测试用例名称作为标题....