Having trouble accessing values from a feature file in Typescript while using the Cucumber Framework tool Protractor. How do I retrieve these Example values in my typescript method within the When block?
Here is the code for the Feature file:
Feature: Navigate to calculator site and add two numbers
Scenario: Add two numbers using calculator site
Given I navigate to the calculator site URL "cal"
When I provide two numbers to add
Then I click on the add button on the calculator site
Scenario Outline: Provide parameters
Examples: | key1 | key2 | | 2 | 3 | | 2 | 60 |
Code snippet for the When block:
When('I provide two numbers to add', async (key1:string, key2:string) => {
// Code to input values
await cal.firstEditBox.sendKeys(key1);
await cal.secondEditBox.sendKeys(key2);
});
Upon execution, an error is encountered:
Scenario: Add two numbers using calculator site # features\demo.feature:3
√ Given I navigate to the calculator site URL "cal" # stepDefinations\steps.ts:10
× When I provide two numbers to add # stepDefinations\steps.ts:16
function has 2 arguments, should have 0 (if synchronous or returning a promise) or 1 (if accepting a callback)
- Then I click on the add button on the calculator site # stepDefinations\steps.ts:24
√ After # node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:27