使用 TestCafe 从 HTML5 日期输入中删除值?

Remove value from HTML5 date input using TestCafe?

我似乎无法使用 TestCafe 删除 HTML5 date input 中的值。到目前为止,我已经尝试了 typeTextpressKeytypeText 可用于设置新日期但不能输入空字符串,而将删除和退格键与 pressKey 结合使用不会像手动执行相同操作时那样删除值。我也不能't/don不知道如何单击字段本身的 x。

我有什么地方 missing/doing 错了,还是这不可能?

类型文本

test('typeText', async t => {
    await t
        .typeText('#dateField', '', { replace: true });

    await t
        .expect(Selector('#dateField').value).eql('');
});

1) The "text" argument is expected to be a non-empty string, but it was "".

按键

test('pressKey', async t => {
    await t
        .click('#dateField')
        .pressKey('delete'); // 'backspace' also does not work

    await t
        .expect(Selector('#dateField').value).eql('');
});

1) AssertionError: expected '2019-05-02' to deeply equal ''

根据 TestCafe's typing formats 对于 HTML5 输入,您可以按以下方式使用 typeText 操作:

test('test', async t => {
    await t
        .typeText('#start', '2017-12-23')
        .expect(Selector('#start').value).eql('2017-12-23')
 
        .typeText('#start', '    -  -  ')
        .expect(Selector('#start').value).eql('');
});