mardi 10 septembre 2019

Testcafe - How to get update state value after clicking button

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.

Aucun commentaire:

Enregistrer un commentaire