Reputation: 97
I am new to testing world . i am using testcafe for automation . i am testing simple counter button. whenever button is clicked counter is incremented . now i am getting previous value not update value.
i passed "timeout" as options in assertion 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});
}
}
i don't previous value of state i want updated value from state.
Upvotes: 0
Views: 278
Reputation: 6318
It is difficult to give a precise answer without a working example which demonstrates the issue. From the code, I see that you get the button state firstly, and only then you click on the button. I suppose that you need to get the button state only after the click.
Upvotes: 2