# Window property

# Checking if property was set

For question #5419

With custom timeout

<script>
  // application code, start with window.Hash = null
  window.myproperty = {
    Hash: null,
  }
  // and set the value after 10 seconds
  setTimeout(() => {
    window.myproperty.Hash = '1234'
  }, 10000)
</script>

Now our code should retry, until Hash is really 1234. See should(cb).

// increase the command timeout
cy.window({ timeout: 11000 }).should((win) => {
  expect(win.myproperty.Hash).to.equal('1234')
})
// alternative: use cy.its
cy.window({ timeout: 11000 })
  .its('myproperty.Hash')
  .should('equal', '1234')