- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为我的 e2e 测试生成一些随机数据。似乎我找到的唯一库是 chance.js 。但无法使其发挥作用。这是我到目前为止所尝试过的:
describe('In the login page', function () {
var chance = new Chance(); // ReferenceError: Chance is not defined
}
然后添加
beforeEach(function(){
browser.executeScript(
function() {
return chance;
}).then(function(_chance){
chance = _chance; //It returns an object, but can't use any of the methods.
});
});
但是如果我尝试
beforeEach(function(){
browser.executeScript(
function() {
return chance.email(); //Note this line here
}).then(function(_chance){
chance = _chance; //It returns an email
});
});
这就是我到目前为止所拥有的一切......有什么线索/想法吗?
最佳答案
首先,在您的项目中安装 opportunity.js:
npm install chance --save-dev
这会将 opportunity.js 作为节点模块安装在您的项目中。然后将其包含在您的规范中并实例化:
var chance = require('../node_modules/chance').Chance();
然后调用您的规范。例如:
it('should add a new friend', function() {
var friendName = chance.string()
friendPage.addFriend(friendName);
expect(friendPage.inResults(friendName)).toBeTruthy();
});
希望有帮助...
关于angularjs - 在 AngularJS 端到端测试中使用 opportunity.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27571292/
我正在使用 xcode 12。 我写了扩展 UI View 如下: @IBInspectable public var shadowRadius: CGFloat { get {
我正在尝试将模板与泛型结合起来,重点是尽可能快地(合理地)访问原始/值类型的属性,最好将其保留在 C++/CLR 中。考虑这个简单的模板: template class value_wrapper {
我正在尝试为我的 e2e 测试生成一些随机数据。似乎我找到的唯一库是 chance.js 。但无法使其发挥作用。这是我到目前为止所尝试过的: describe('In the login page',
SalesForce 机会示例位于 http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_opportu
我正在 Salesforce 中创建 DocuSign 自定义按钮。在运行 DocuSign 按钮逻辑之前尝试在某些字段值不满足时添加错误。 我想要的条件是,如果机会阶段的选择列表值不等于“已关闭”,
如何在 Dynamics CRM 中通过 C# 代码重新打开已结束(赢得或失去)的机会? SetStateRequest 已弃用(请参阅 documentation ),当我尝试通过 Update 执
我试图在阅读 Excel 文件时显示进度。我共享一个包含最大行号和最后读取的行号的对象。每 150 行,我将值保存在对象中,然后将其等待,然后停止读取,直到对象解锁。 在我的对话框窗口中,我尝试使用带
我是一名优秀的程序员,十分优秀!