Cypress Tutorial
Selected Reading
- Cypress - Discussion
- Cypress - Useful Resources
- Cypress - Quick Guide
- Cypress - GitHub
- Cypress - Plugins
- Cypress - Reports
- Cypress - Configuration of JSON File
- Cypress - Hooks
- Cypress - Environment Variables
- Cypress - Fixtures
- Cypress - Custom Commands
- Cypress - Debugging
- Cypress - Screenshots and Videos
- Cypress - Dashboards
- Cypress - Prompt Pop-up Window
- Cypress - Data Driven Testing
- Cypress - File Upload
- Cypress - Get and Post
- Cypress - Cookies
- Cypress - Mouse Actions
- Cypress - Web Tables
- Cypress - Frames
- Cypress - Hidden Elements
- Cypress - Child Windows
- Cypress - Alerts
- Cypress - Dropdown
- Cypress - Tabs
- Cypress - Checkbox
- Cypress - jQuery
- Cypress - Working with XHR
- Cypress - Asynchronous Behavior
- Cypress - Text Verification
- Cypress - Assertions
- Cypress - Locators
- Cypress - Aliases
- Cypress - Variables
- Cypress - Basic Commands
- Cypress - Supported Browsers
- Cypress - Build First Test
- Cypress - Test Runner
- Cypress - Architecture and Environment Setup
- Cypress - Introduction
- Cypress - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Cypress - Get and Post
Cypress - Get and Post
“Get”和“邮政”方法是“应用规划接口”测试的一部分,可由“Cypress”进行。
Get Method
为了开展“公平行动”,我们将以cy.request()提出“吉大港”申请,并将“Get”和“URL”作为这种方法的参数。
如果请求得到接受和正确处理,地位法就反映了这一点。 法典第200(means ok)和201(means 创建)。
Implementation of Get
The implementation of Get methods in Cypress is below -
describe("Get Method", function(){ it("Scenario 2", function(){ cy.request("GET", "https://jsonplaceholder.cypress.io/comments", { }).then((r) => { expect(r.status).to.eq(200) expect(r).to.have.property( headers ) expect(r).to.have.property( duration ) }); }) })
产出如下:
![Get Method](/cypress/images/get_method.jpg)
Post Method
While using the Post method, we are actually sending information. If we have a group of entities, we can append new ones at the end, with the help of Post.
To perform a Post operation, we shall make a HTTP request with the cy.request() and pass the method Post and URL as parameters to that method.
Implementation of Post
下面是“旋风”中采用邮政方法。
describe("Post Method", function(){ it("Scenario 3", function(){ cy.request( https://jsonplaceholder.cypress.io/users?_pmit=1 ) .its( body.0 ) // yields the first element of the returned pst // make a new post on behalf of the user cy.request( POST , https://jsonplaceholder.cypress.io/posts , { title: Cypress , body: Automation Tool , }) }) });
产出如下:
![Post Method](/cypress/images/post_method.jpg)