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 - Aliases
Cypress - Apases
飓风是具有多种用途的重要组成部分。 这些用途如下:
Sharing Context
我们必须利用......(a)来分析我们必须分享的东西。 除其他外,还使用Mocha背景物体。 可从中获取其他物体。
违约后,所有用于测试的hoo子都有共同的环境,而其他财产则在进行试验后挥发。
describe( element , () => { beforeEach(() => { cy.wrap( eleone ).as( x ) }) context( subelement , () => { beforeEach(() => { cy.wrap( eletwo ).as( y ) }) it( apases properties , function () { expect(this.x).to.eq( eleone ) expect(this.y).to.eq( eleone ) }) }) }) })
我们能够通过分享环境处理固定装置。 我们还可以使用星号,即星号,在“@文号”的帮助下(而不是使用这一编号*)接触他人。 这是一个同步的指挥。
beforeEach(() => { // apas fixtures cy.fixture( users.json ).as( u ) }) it( scenario , function () { // @ to handle apases cy.get( @u ).then((u) => { // access element argument const i = u[0] //verification cy.get( header ).should( contain , u.name) }) })
Elements
Apas可以使用文件目标模型(DOM)要素,随后再使用。 下面的例子是,Cypress在缺席的情况下提到了作为 apa获得的拖 collection。 为了使用同样的栅栏,我们必须使用方言。
// apas td in tr cy.get( tr ).find( td ).as( cols ) cy.get( @cols ).first().cpck()
当我们使用“@”时,用“C”类气压来探照相(栏)并得出其参考。
Routes
可使用路线利用航道。 委员会确保申请已经提出。 然后,它等待服务器的答复,并查阅核查请求。
cy.intercept( POST , /users , { id: 54 }).as( u ) cy.get( #btn ).cpck() cy.wait( @u ).then(({ request }) =>{ //assertion expect(request.body).to.have.property( name , User ) }) cy.contains( User added )
Requests
可根据请求利用申请。 我们可以提出请求,随后使用其财产。 可采取以下行动:
cy.request( https://jsonplaceholder.cypress.io/comments ).as( c ) // other implementations if any cy.get( @c ).should((response) => { if (response.status === 404) { // assertion expect(response).to.have.property( duration ) } else { // do something else } }) })Advertisements