Closed MaxnzWZ closed 5 years ago
Hi @MaxnzWZ, There are no such functions in this plugin. Enzyme and TestCafe are different tools and they serve different purposes. Enzyme is a tool for unit testing, so it sees React components as isolated units and allows you to manipulate their props and state (i.e. inputs) and then check a render tree (i.e. output). TestCafe, in contrast, is a tool for end-to-end testing. Its main idea is to model the entire process of user-application interaction as near to the real life as possible. A user cannot manipulate a component's props and state directly, so TestCafe is also not supposed to do this. Instead, you can emulate a user action that should lead to intended props/state modification and then check how it affects a page state after re-render. Also, direct modification of React component props in the real environment in the middle of the React lifecycle can cause unexpected side-effects, make a test unstable and lead to hard-to-locate bugs.
We can obtain value of props or state through getReact(). Can we have some function to set the value to props or state, like setProps and setState in Enzyme?