Skip to main content

Posts

How to interact with CkEditor(V4) in Cypress?

Interaction with CkEitor (V4) in Cypress:  CkEditor is a Third Party tool which is commonly used in websites. Open your ` commands.js ` file. Paste this code in it. Cypress . Commands . add ( 'iframe' , {  prevSubject :   'element'  }, ( $iframe )  =>  {      const   $iframeDoc  =  $iframe . contents ()      const   findBody  = ()  =>   $iframeDoc . find ( 'body' )      if  ( $iframeDoc . prop ( 'readyState' ) ===  'complete' )  return   findBody ()      return   Cypress . Promise (( resolve )  =>   $iframe . on ( 'load' , ()  =>   resolve ( findBody ()))) }); Cypress . Commands . add (      'iframeLoaded' , {  prevSubject :   'element'  },     ( $iframe )  =>  {          const   contentWindow  =  $iframe . prop ( 'contentWindow' )          return   new   Promise ( resolve   =>  {              if  (                  contentWindow  &&                  contentWindow . document . readyState  

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