类型“ TestController”上不存在属性“ openWindow”

问题描述

在测试中,我单击一个元素,然后打开新窗口。但是我需要从前一个窗口检查请求。

我正在尝试这样做:

https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/openwindow.html

import { Selector } from 'testcafe';

fixture `Example page`
    .page `http://www.example.com/`;

test('Open the testcafe website',async t => {
    await t
        .openWindow('http://devexpress.github.io/testcafe')
        .openWindow('./documentation');

    const localWebsite = await t.openWindow('file://path/to/my/website');
});

但我收到此错误

Property 'openWindow' does not exist on type 'TestController'.

解决方法

您的测试用例在引入此API的最新版本的TestCafe 1.9.0中正常工作。

确保您使用的是正确的TestCafe version