I want to test a button with a state that keeps changing. The button code is
import React, { Component } from "react";
export class click extends Component {
constructor(props) {
super(props)
this.state = {
count : 0
};
}
UpdateClick= () => {
this.setState({ count: this.state.count + 1 });
};
render() {
const { count } = this.state;
return (
<div>
<button onClick={this.UpdateClick}>click {count} times</button>
</div>
);
}
}
export default click;
and this is the command I want to use in protractor
const but = element(by.react('click', {}, { count: 0 }));
but.click();
but this is not working. I'm receiving the error
can not read the property "resq$$" undefined
I'm using react-selector package in protractor to test the react app. please guide me how to test elements when their states are unknown or keep changing.
Aucun commentaire:
Enregistrer un commentaire