Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.51 KB

File metadata and controls

52 lines (37 loc) · 1.51 KB
layout title permalink
docs
t.expect.typeOf Method
/documentation/reference/test-api/testcontroller/expect/typeof.html

t.expect.typeOf Method

Asserts that the actual type is typeName.

await t.expect( actual ).typeOf( typeName, message, options );
Parameter Type Description
actual Any type A comparison value. See actual parameter value.
typeName String The expected type of an actual value.
message (optional) String An assertion message displayed in the report if the test fails.
options (optional) Object See Options.

Examples:

await t
    .expect({ a: 'bar' }).typeOf('object', 'it\'s an object')
    .expect(/bar/).typeOf('regexp', 'it\'s a regular expression')
    .expect(null).typeOf('null', 'it\'s a null');
import { Selector } from 'testcafe';

fixture `My fixture`;

test('My test', async t => {
    await t.expect(Selector('#element').getAttribute('attr')).typeOf('string');
});

actual Parameter Value

{% include assertions/actual-parameter-value.md %}

Options

options.timeout

{% include assertions/timeout.md %}

options.allowUnawaitedPromise

{% include assertions/allowunawaitedpromise.md %}