简体   繁体   中英

How to test and write test cases for ReactJS app with Protractor?

I have been trying to test my own React app with Protractor but I don't know the correct syntax of test cases. I searched few things like:

await browser.waitForAngularEnabled(false);

The command is useful but still I don't know how to write test cases for React app. The tutorials are available for Angular only, like for example how to click on a certain button, how to write in input box, how to verify test result, how to match values, how to get title, etc.
Kindly guide me in this because I need Protractor for it. Thank you in advance.

The nice thing about protractor is it isn't really language specific. You can test react pages just like any other page. Make sure to set ignoreSynchronization before you visit a non angular page and all those tutorials should work.

// if true, ignore synchornization for testing non-angular pages.
browser.ignoreSynchronization = true;

You may have to replace the angular waits with your own.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM