Skip to main content
Version: 9.0.0

Expect

Method allowing to assert a value.

ParameterTypeDescription
actualany
optionsAssertOptionsMethod options.

AssertOptions

ParameterTypeDescription
intervalnumberTime interval between retries in milliseconds.
timeoutnumberTimeout of the method.
retriesnumberNumber of retries.
backoffFIXED / EXPONENTIAL / LINEARValue used to determine the wait time between successive retries.
maxBackOffnumberMaximum value of the backoff.
errorMessagestringError message.
overrideErrorMessagestringOverride the Test Maker error message.
retryMessagestringRetry message.
softbooleanAssertion is soft assertion (does not stop test execution).

How to use the expect method to assert:

const inputValue = `hello world`;

await I.expect(inputValue).toEqual(`hello world`);

The above is really a simple form of assertion, and it should pass, because the input value equals the value with expect in the toEqual Assertion.

Now what would happen if we pass a wrong value?

const inputValue = `hella mold`;

await I.expect(inputValue).toEqual(`hello world`);

​ The test will fail, because obviously, hella mold does not equal hello world. You should see something similar to the image below as the Error Details:

Assert fail Example

Test Maker have a powerful reporting system, and if you look carefully at the image above you would see that Test Maker is giving you lots of information on why that Assertion failed.

On top of that Test Maker Assertion API has a Diffing system, which gives the difference between the received and expected value.