2
public clickOnElementWithSelectionMethod(elementKey, selectionMethod, selectionValue) {

let elementToClick = this.getWebElement(elementKey, selectionMethod, selectionValue);

    return assert.eventually.equal(
      elementToClick.click().then(() => {
        return true;
      }, (error: any) => {
        throw new Error(error.message);
      }), true, 'Element "' + elementKey + '" click failed'
    );
}

I'm passing protractor's Click() API call as the promise, here.

Even when im passing a wrong selectionValue, it shows as the test is passed, but fails the next test.

enter image description here

Ali Azam
  • 2,047
  • 1
  • 16
  • 25
Niveditha Karmegam
  • 742
  • 11
  • 28
  • 1
    Please show the *actual Mocha test* in which you are using the code you show in your question. – Louis Dec 27 '17 at 12:05
  • You must return the promise of `elementToClick.click()` because the error is thrown when it is rejected – Troopers Jan 02 '18 at 08:01

0 Answers0