Pulling data from fixture error : Cannot read property 'key' of undefined

When I tried to pull data from fictures into my test case I got an Cannot read property ‘key’ of undefined
error message.

Code:
describe(‘My First Test’, () => {

beforeEach(function() {
    cy.fixture("DataFile").then((data) => {
      this.key = data
      
    })
  })

it('Does not do much!', () => {
    cy.visit('https://rahulshettyacademy.com/angularpractice/')
    cy.get("form input[name='name']").type(this.key.Name)
    cy.get("form input[name='email']").type(this.key.Email)
   cy.get("#exampleInputPassword1").type(this.login.key.Password)
   cy.get('select').select(this.key.Gender)

})

Error:
Cannot read property ‘key’ of undefined

enter image description here

218 thoughts on “Pulling data from fixture error : Cannot read property 'key' of undefined”

  1. I’m not sure exactly why but this site is loading incredibly
    slow for me. Is anyone else having this problem or is it a
    problem on my end? I’ll check back later and see if the problem still exists.

    Reply
  2. obviously like your website however you have to check the spelling on several of
    your posts. Many of them are rife with spelling issues and I
    in finding it very troublesome to inform the reality on the other hand I will definitely come again again.

    Reply
  3. I’m extremely impressed along with your writing
    abilities and also with the structure for your weblog.
    Is this a paid topic or did you customize it your self?
    Either way keep up the nice high quality writing, it’s uncommon to
    look a great weblog like this one nowadays..

    Reply
  4. Hi there this is somewhat of off topic but I was wanting to know if blogs
    use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding
    skills so I wanted to get advice from someone with experience.
    Any help would be greatly appreciated! scoliosis surgery https://0401mm.tumblr.com/ scoliosis surgery

    Reply
  5. Pingback: cost of propecia
  6. Pingback: buy ivermectin