如何使用testcafe来模拟day.js来单击日历

问题描述 投票:-1回答:1

[我正在尝试使用带有今天日期的测试咖啡馆单击日历,我尝试使用时刻获取日期格式,但无法单击日历,我正在使用选择器(withText),它始终未找到选择器。

testing automation automated-tests e2e-testing testcafe
1个回答
0
投票

https://www.phila.gov/the-latest/archives/#/?templates=featured的示例

import { Selector } from 'testcafe';

fixture `Select date`
    .page `https://www.phila.gov/the-latest/archives/#/?templates=featured`

test('Select date', async t => {
    const dateInput = Selector('input[name="start"]');

    await t
        .click(dateInput)
        .click(dateInput.parent('.vdp-datepicker').find('.cell.day').withText('2'))
        .expect(dateInput.value).eql('May. 02, 2020');
});
© www.soinside.com 2019 - 2024. All rights reserved.