stocky-insurance-27750
03/09/2023, 8:31 AM--headed test and turn on developer tools, go to console and enter dataLayer - I get an error that dataLayer is not defined. This isn't the case in Chrome with the app running. I've entered window.dataLayer = window.dataLayer || [] and then clicked buttons (that should be firing events into the dataLayer) but it remains blank.
I previously had a test that was asserting the dataLayer fine, so this is really puzzling why the dataLayer is now disappeared. Have I done something daft in a config or something?
cy.window()
.its('dataLayer')
.then(dataLayer => {
const size = Cypress.$(dataLayer).length - 1
const event = dataLayer[size]
expect(event.event).to.equal(expectedEvents.event)
expect(event.action).to.equal(expectedEvents.action)
})