【问题标题】:each key must be a number of string; got function每个键必须是多个字符串;得到功能
【发布时间】:2018-06-25 16:45:33
【问题描述】:

我在 Cucumber 中有这个场景:

Scenario Outline: Protractor and Cucumber Test InValid

    Given I have already......
    When I fill the <number>
    ....


    Examples:
| number|...
| 3 |...
|4  |...

我在 .js 文件中有这个步骤定义:

 When('I fill the {int}',{timeout: 90 * 1000},  function(callback, number) {

        element(by.css("*[id='field_identificador']")).click();
        element(by.css("*[id='field_identificador']")).sendKeys(number).then(callback);

    });

我收到此错误:每个键必须是一个数字字符串;得到函数

当我通过自己放置一个没有场景大纲的值来执行测试时,例如:.sendKeys('4') 它可以工作。

我是不是做错了什么?

【问题讨论】:

    标签: javascript html angular cucumberjs


    【解决方案1】:

    您的论点顺序错误。 callback 始终是参数列表中的最后一个元素。

    修复:

    When('I fill the {int}',{timeout: 90 * 1000},  function(number, callback) {
    
            element(by.css("*[id='field_identificador']")).click();
            element(by.css("*[id='field_identificador']")).sendKeys(number).then(callback);
    
        });
    

    【讨论】:

      猜你喜欢
      • 2023-02-11
      • 1970-01-01
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 2015-04-05
      • 2017-02-10
      • 2018-11-18
      • 2013-08-22
      相关资源
      最近更新 更多