0
 this.step = data => {
    var returnValue = {};
    let fieldElement = element(by.id(data))
    if (fieldElement.isPresent()){
       fieldElement.sendKeys("test").then(() => {
             returnValue['result'] = true
        })
    } else {
        returnValue[ 'result'] = false
        returnValue[ 'reason'] =  "field element : " + data+ "+ missing"
    }
    console.log("ret", returnValue)
    return returnValue
  }

When I print "returnValue", I get only {}. I expected an object with either result or result and reason to be printed. What did I miss?'

I tried something like this

   "if(expect (fieldElement.isPresent().then(() => { " 

to resolve the promise, but not sure if this is the right way for I have to return a value in case expect fails. So should it be inside a try-catch instead?

user3920295
  • 889
  • 2
  • 13
  • 31

0 Answers0