Skip to main content

Posts

Showing posts from November, 2020

How to use Xpath in Cypress?

  Install with npm:  Open your Terminal and write this command: npm install -D cypress-xpath Install with Yarn: Open Terminal and write this Command: yarn add cypress-xpath --dev Now Open project's index.js file   cypress/support/index.js just Paste this in index.js file. require ( ' cypress-xpath ' ) Use of xpath: After installation your  cy  object will have  xpath  command. it ( ' finds input filed ' ,   ( )   =>   {    cy . xpath ( '/html[1]/body[1]/input[1] ' )      . type ('Hello ' ) } ) You can also chain  xpath  off of another command. it ( ' finds list items ' ,   ( )   =>   {    cy . xpath ( ' /html[1]/body[1]/input[1] ' )      . xpath ( ' ./li ' )      . should ( ' have.length ' ,   2 ) } ) As with other cy commands, it is scoped by  cy.within() . it ( ' finds list items ' ,   ( )   =>   {    cy . xpath ( ' /html[1]/body[1]/input[1] ' ) . within ( ( )   =>   {      cy . xpath ( &#

Cypress Dashboard

  The   Cypress Dashboard   is a service that gives you access to recorded tests - typically when running Cypress tests from your   CI provider . The Dashboard provides you insight into what happened when your tests ran.  Real World Example  New The Cypress  Real World App (RWA)  leverages the  Cypress Dashboard in CI  to test over 300 test cases in parallel across 25 machines, multiple browsers, multiple device sizes, and multiple operating systems. Check out the    Real World App Dashboard . Features Organize projects From the Dashboard you can: Set up a project to record in the Dashboard Reset or add more record keys Change who can access your Cypress project Transfer ownership of projects Delete projects See test run results From the Dashboard you can: See the number of failed, passing, pending and skipped tests. Get the entire stack trace of failed tests. View screenshots taken when tests fail or when using  cy.screenshot() . Watch a video of your entire test run or a video clip a

Test Retries in Cypress

   What you’ll learn What are test retries? Why are test retries important? How to configure test retries Introduction:- End-to-end (E2E) tests excel at testing complex systems. However, there are still behaviors that are hard to verify and make tests flaky (i.e., unreliable) and fail sometimes due to unpredictable conditions (eg., temporary outages in external dependencies, random network errors, etc.). Some other common race conditions that could result in unreliable tests include: Animations API calls Test server / database availability Resource dependencies availability Network issues With test retries, Cypress is able to retry failed tests to help reduce test flakiness and continuous integration (CI) build failures. By doing so, this will save your team valuable time and resources so you can focus on what matters most to you. How It Works By default, tests will not retry when they fail. You will need to  enable test retries in your configuration  to use this feature. Once test ret