Cypress.io: How to mock API response
Вставка
- Опубліковано 7 лис 2024
- This lesson is a part of my Udemy class: Cypress from Zero to Hero.
Link to the class: www.udemy.com/...
In this lesson, you will learn how to create a mock or stub of your back-end server in Cypress to automate web applications. Mocks are very useful when you need to automate edge case scenarios and it speeds up the test execution process a lot. Cypress has a really great built-in mocking tools
i bought the course on Udemy . Its verrry well done . highly recommend it
Literally you saved my a**. Excellent contents.
This is going to help me do my current ticket this sprint at work 🤣
hi i have a question, Can i use dynamic data in json reponse, for example few paramters are not fixed for me,.
Yes, you can update your mock object with the data you need and set it as a route response again
very useful. thanks artem
How do you created your local server from scratch?, Ive seen many examples with locals, but none with comercials, can you do 1?
That's an Angular application. Any angular app can be running on localhost
Will there be a course on just API automation with cypress? Courses I've seen have just a small section on API testing with all the focus on UI automation. I really want to learn more on how to develop and maintain an API framework using cypress, advanced tests, real world examples, integrating excel or some form of dynamic data for requests, cucumber, CI tool etc. I have seen many people and companies are now moving towards API automation using cypress
Cypress is not a framework for API automation so I don't recommend to do it. Cypress is great for UI functional automation and API capability is a useful feature that helps to manipulate data or set up test data for your test. If you need API testing, check the frameworks that are designed for it like Karate DSL or RestAssured.
excellent, thank you very much, I have a question, is it possible to mockup a websocket?
I am not sure. Cypress capability of mocking is limited or XHR calls
@@artembondar6577 They've just releases route2, which is experimental, which allows you to mock Fetch and other request types now.
Hello Artem, may I ask you inside your course you have Mocking API response , but may be you can to show us this process with Cypress BDD Mocking API response, I think your source looks good, but need more information with Cypress BDD mocking
@Artjem Bondar
I've cloned the github repo ngx-cypress-test that's used in your udemy code and confirmed node js, npm and git are installed correctly. When I try to run npm install on the root folder I keep getting several errors such as:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ngx-admin@4.0.1
npm ERR! Found: @angular/common@8.2.14
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"^8.0.0" from the root project
Any ideas what I could be doing wrong? Have been struggling with this, keeping me from working through some exercises.
thanks u realy make it simple for understanding
Привет Артем. Подскажите пожалуйста как можно получить полный курс что на платформе Юдеми на русском языке.
Никак. Курс доступен только на английском
Артём подскажите,можно ли создать тесты вне папки integration?
Нельзя
Thank you so much!
How to set up this conduit application in my local machine
Thanks bro, this content is excellent
My pleasure
why did he have to change from fixtures:tags.json into fixture:tag.json? the folder was called fixtures as far as I can see.
The folder name is fixtures only, its the keyword within the intercept command that should read fixture.
Amazing. Thank you
Thanks for the excellent video. Can you make one for bypassing login UI?
you can find this video in my Udemy class
спассссибо!
outdated