美文网首页
Cypress的重试机制

Cypress的重试机制

作者: 沸腾Shark | 来源:发表于2021-07-21 23:23 被阅读0次

    Cypress辅助测试动态网络应用的核心特性即是retry-ability。就像坐在通畅的交通工具上行动一样,我们很难感知到它(retry-ability)。但是了解retry-ability如何工作有利于我们写出更快的测试。

    Commands和Assertions

    Cypress测试中主要有两种方法:Commands和Assertions,举例:

    it('creates 2 items', () => {
      cy.visit('/')                       // command
      cy.focused()                        // command
        .should('have.class', 'new-todo') // assertion
    
      cy.get('.new-todo')                 // command
        .type('todo A{enter}')            // command
        .type('todo B{enter}')            // command
    
      cy.get('.todo-list li')             // command
        .should('have.length', 2)         // assertion
    })
    

    相关文章

      网友评论

          本文标题:Cypress的重试机制

          本文链接:https://www.haomeiwen.com/subject/twmxahtx.html