简体   繁体   中英

Protractor E2E Angular- Possible to test?

I am new to testing and recently just started using Protractor. I am kind of confused on how to approach this testing case. Lets say there are a bunch of buttons that when clicked will return an object with a set of properties unique depending button was clicked. The properties are then displayed somewhere. What I want to do is access this object that was returned and expect it's to match with what is displayed. Is it even possible to access this object? Or should I be testing this somewhere else in a unit/integrated test? In an integrated test I would be able to access the component and the object returned.

Protractor is for UI/System testing: testing the behavior of your user interface and functionality of your system as a whole (thus end-to-end). What exactly happens behind the scenes is out of scope conceptually, even though it would be technically possible (using browser.executeAsyncScript ). You should be testing your API responses with separate tests directly against your API and using unit tests (Mocha or similar) within your UI to ensure your UI logic parses expected API responses correctly.

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