cypress


1. Verifying Page Title:

cy.title().should('contain', 'Cypress.io');

2. Checking Element Visibility:

cy.get('#my-element').should('be.visible');

3. Interacting with Forms:

cy.get('input[name="username"]').type('admin');
cy.get('input[name="password"]').type('secret');
cy.get('button[type="submit"]').click();

4. Handling Alerts:

cy.on('window:alert', (alertText) => {
  // Do something with the alert text
});

5. Navigating to a URL:

cy.visit('https://example.com');

6. Waiting for an Element:

cy.get('#my-element').should('be.visible').and('have.text', 'Hello World!');

7. Custom Commands:

Cypress.Commands.add('login', (username, password) => {
  // Login logic
});
cy.login('admin', 'secret');

8. Checking Element State:

9. Mocking Server Responses:

10. Debugging Tests:

11. Using XHR Requests:

12. Traversing the DOM:

13. Using Assertions:

14. Taking Screenshots:

15. Downloading Files:

16. Using Data Tables:

17. Working with iframes:

18. Checking Cookie Values:

19. Using Fixtures:

20. Interacting with Modals:

21. Checking Local Storage:

22. Custom Assertions:

23. Using Network Interception:

24. Working with Selectors:

25. Using Fixtures for Data Parameterization: