fresh-doctor-14925
08/16/2022, 8:02 AMloginHandler
use cy.type
?early-computer-34425
08/16/2022, 8:15 AMbrash-tiger-52405
08/16/2022, 10:32 AMstale-energy-2535
08/16/2022, 10:38 AMmicroscopic-easter-76359
08/16/2022, 12:22 PMplain-pencil-72796
08/16/2022, 1:26 PMplain-pencil-72796
08/16/2022, 1:34 PMpowerful-orange-86819
08/16/2022, 3:14 PMacceptable-hamburger-48790
08/16/2022, 3:17 PMmicroscopic-easter-76359
08/16/2022, 3:24 PMacceptable-hamburger-48790
08/16/2022, 3:25 PMmicroscopic-easter-76359
08/16/2022, 3:26 PMfreezing-hydrogen-55479
08/16/2022, 4:23 PMjs
it('Tshirt should support onClick', () => {
cy.mount(<ProductBox/>)
const handleClickSpy = cy.spy().as('handleClickSpy')
cy.mount(<img data-test='grey-tshirt-image' alt="" onClick={handleClickSpy}/>)
cy.get("[data-test='grey-tshirt-image']").click();
cy.get('@handleClickSpy').should('have.been.called')
})
but this is the error I getfresh-doctor-14925
08/16/2022, 4:26 PM{force: true}
?freezing-hydrogen-55479
08/16/2022, 4:30 PMfreezing-hydrogen-55479
08/16/2022, 4:31 PMgray-kilobyte-89541
08/16/2022, 4:55 PMfreezing-hydrogen-55479
08/16/2022, 4:58 PMuser
08/16/2022, 5:02 PMgray-kilobyte-89541
08/16/2022, 5:31 PMimg
from what I see, so it renders nothingfreezing-hydrogen-55479
08/16/2022, 5:42 PMsrc
attribute in my cy.mount(<img data-test='grey-tshirt-image' alt="" onClick={handleClickSpy}/>)
.
But I do have the attribute data-test which I added to my image when I imported it to my react component.
Please excuse me if I'm missing something elementary here. I'm pretty new to TDD.
Are you saying that I should not use mount here?gray-kilobyte-89541
08/16/2022, 5:44 PMclever-father-23857
08/16/2022, 6:43 PMancient-whale-60628
08/16/2022, 7:09 PMincalculable-pager-85339
08/16/2022, 7:37 PMstrong-energy-6158
08/17/2022, 5:06 AMelegant-river-87347
08/17/2022, 7:52 AMfaint-tiger-98881
08/17/2022, 7:58 AMfaint-tiger-98881
08/17/2022, 7:59 AMjs
recurse(
() => cy.get('@foo').its('status'),
(status) => status === 200, {
log: true,
limit: 10,
timeout: 30000,
delay: 1000,
},
)
flaky-airport-12178
08/17/2022, 8:10 AM