Anup J
Anup J

Reputation: 1

Passing values into different steps in Cucumber in Protractor

I need to pass value from one step to another step in step definition files in cucumber with Protractor Typescript Generic Example:

When('the user enters the value {string}',    function() {

//code written to enter the value
}) 

Then('the user has entered the value') 
{
// I need the value entered in the previous step to be validated here
}

Upvotes: 0

Views: 778

Answers (1)

yong
yong

Reputation: 13722

let inputText = ''
When('the user enters the value {string}', function(string) {
  inputText = string
  //code written to enter the value
}) 

Then('the user has entered the value', function() {     
  expect().to.xxx(inputText)
  // I need the value entered in the previous step to be validated here
})

Upvotes: 1

Related Questions