Cypress End To End Testing | How To Use The Session Command | cy.session()

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ต.ค. 2023
  • The cy.session () command is a new feature in Cypress 8.2.0 that allows you to cache and restore cookies, localStorage, and sessionStorage (i.e. session data) in order to recreate a consistent browser context between tests1. This can help you speed up your tests by avoiding unnecessary login steps and UI interactions. You can use the cy.session () command with a unique id, a setup function, and an optional validate function to create and restore a session for a given user or scenario.
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 3

  • @VikrantChauhan-xi4wn
    @VikrantChauhan-xi4wn หลายเดือนก่อน +1

    Hi Tech Bro,
    Good video , ....! I have some another error in my cypress code could you please help me . I am getting an error when i am trying to execute Test case "Process is not defined "

    • @Techbrothers99
      @Techbrothers99  หลายเดือนก่อน

      please share your code snip or git repo, will have a look, thanks

    • @VikrantChauhan-xi4wn
      @VikrantChauhan-xi4wn หลายเดือนก่อน

      @@Techbrothers99
      ReferenceError
      The following error originated from your test code, not from Cypress.
      > process is not defined
      When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
      Cypress could not associate this error to any specific test.
      We dynamically generated a new test to display this failure.
      node_modules/ci-info/index.js:5:1
      3 | const vendors = require('./vendors.json')
      4 |
      > 5 | const env = process.env
      | ^
      6 |
      7 | // Used for testing only
      8 | Object.defineProperty(exports, '_vendors', {
      View stack trace
      Test Case /************Create Test case for Login with the help of Page object**********************
      import LoginpageC from "../../PageobjectOrangeWeblocator/LoginpageC"
      const Loginobj = new LoginpageC
      describe('Login Pageobject ',()=>{
      it('Verify functionality to Login page ',()=>{

      Loginobj.OpenURL()

      cy.fixture('Logindata').then((LDet)=>{

      Loginobj.UserName(LDet.UserNAME)
      Loginobj.PassWord(LDet.PassWORD)
      Loginobj.ClickLoginBtn()
      })

      Loginobj.VerifyAssertion()
      })