///
import React from 'react'
import { mount } from '@cypress/react'
export class Component extends React.Component {
constructor (props) {
super(props)
console.log(
'set window.counter to this component in window',
window.location.pathname,
)
window.component = this
}
render () {
return
component
}
}
it('has the same window from the component as from test', () => {
cy.window()
.its('location')
.should('have.property', 'pathname')
.and('not.equal', 'blank')
mount()
cy.contains('component')
cy.window()
.its('location.pathname')
// this filename
.should('match', /window-spec\.js$/)
// the window should have property set by the component
cy.window().should('have.property', 'component')
})