Integration/Acceptance testing of a ReactJS App

前端 未结 2 705
清酒与你
清酒与你 2021-02-14 13:27

I\'ve read the documentation about Jest. However this seems to imply unit testing of individual components.

How does one test integration of components, or acceptance t

2条回答
  •  萌比男神i
    2021-02-14 13:48

    you can now use protractor-react-selector to identify web elements by react's component, props, and state. This will automatically wait to load REACT in your app and then identify the web elements. It can save you from doing an extra ton of workarounds.

    You can identify your target element by:

    const myElement = element(
        by.react('MyComponent', { someBooleanProp: true }, { someBooleanState: true })
    );
    

    Find out some sample tests here

    Let me know if this helps!

提交回复
热议问题