首页 > 解决方案 > 将值传递到量角器中黄瓜的不同步骤

问题描述

我需要使用量角器 Typescript 通用示例在黄瓜的步骤定义文件中将值从一个步骤传递到另一个步骤:

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
}

标签: typescriptprotractorcucumber

解决方案


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
})

推荐阅读