Testcafe - 单击按钮后如何获取更新状态值

Testcafe - How to get update state value after clicking button

我是测试世界的新手。我正在使用 testcafe 进行自动化。我正在测试简单的计数器按钮。每当单击按钮时,计数器都会增加。现在我得到的是以前的值而不是更新值。

我通过 "timeout" 作为断言 api

中的选项
import { ReactSelector } from "testcafe-react-selectors";

export default class counterButton {
  constructor() {
    this.counterButton = ReactSelector("CardButton");
    this.button = this.counterButton.find("button");
  }

  async clickButton(t) {
    await t.click(this.button);
  }

  async checkingState(t) {
    const button = this.counterButton;
    const buttonReact = await button.getReact();
    await this.clickButton(t);
    await t.expect(buttonReact.state).eql(1,undefined,{timeout:50000});
  }
}

我不知道状态的先前值我想从状态更新值。

如果没有演示问题的工作示例,很难给出准确的答案。从代码中,我看到您首先获得按钮状态,然后才单击按钮。我想你只需要在点击后获取按钮状态。