Complete the code to check that the list has exactly 5 items.
cy.get('ul#items > li').should('have.length', [1]);
The assertion have.length checks the number of matched elements. Here, we want exactly 5 items.
Complete the code to assert that the input field has no characters (length 0).
cy.get('input#username').invoke('val').should('have.length', [1]);
invoke('val') to get the input value.The invoke('val') gets the input's value. Checking have.length 0 means the input is empty.
Fix the error in the assertion to check the number of buttons is 4.
cy.get('button').should('have.[1]', 4);
The correct assertion is have.length. Other options are invalid and cause errors.
Fill both blanks to check that the paragraph text length is greater than 10 characters.
cy.get('p.description').invoke('text').should('have.length[1]', [2]);
The assertion checks if the text length is greater than 10 using should('have.length.gt', 10).
Fill both blanks to assert that the list items count is at least 3.
cy.get('ul#tasks > li').should('have.length[1]', [2]);
The assertion uses should('have.length.gte', 3) to check the list has at least 3 items.