christo8989 christo8989 - 5 months ago 20
Javascript Question

What are all the possible assert functions?

I don't see the possible assert functions in protractor's api. Could someone post the possible functions to use?

I know of:


  • toEqual

  • toBeLessThan



Example

expect(element.getText()).toEqual('Please help me!'); //toEqual being the assertion

Answer

These functions are provided by an expectation/assertion library to determine the 'result' of a testable operation. By itself, protractor merely provides the glue/harness for Angular-Selenium (to run within a testing framework) that exposes testable operations.

In this case that is probably expect. (See the link for standard expectations.)

When you use expect, you write assertions similarly to how you would say them, e.g. "I expect this value to be equal to 3" or "I expect this array to contain 3"..

Comments