fix: isolate assertions into single tests (#7209)

This commit is contained in:
Jordan Frankfurt 2023-08-22 16:34:29 -05:00 committed by GitHub
parent 4bc778ff3e
commit 290083b414
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,17 +13,30 @@ describe('Mini Portfolio account drawer', () => {
// Balances should have been fetched once after hover // Balances should have been fetched once after hover
cy.get(getTestSelector('web3-status-connected')).trigger('mouseover') cy.get(getTestSelector('web3-status-connected')).trigger('mouseover')
cy.get('@gqlSpy').should('have.been.calledOnce') cy.get('@gqlSpy').should('have.been.calledOnce')
})
it('should not re-fetch balances on second hover', () => {
// The balances should not be fetched before the account button is hovered
cy.get('@gqlSpy').should('not.have.been.called')
// Balances should have been fetched once after hover
cy.get(getTestSelector('web3-status-connected')).trigger('mouseover')
cy.get('@gqlSpy').should('have.been.calledOnce')
// Balances should not be refetched upon second hover // Balances should not be refetched upon second hover
cy.get(getTestSelector('web3-status-connected')).trigger('mouseover') cy.get(getTestSelector('web3-status-connected')).trigger('mouseover')
cy.get('@gqlSpy').should('have.been.calledOnce') cy.get('@gqlSpy').should('have.been.calledOnce')
})
// Balances should not be refetched upon opening drawer it('should not re-fetch balances when the account drawer is opened', () => {
cy.get(getTestSelector('web3-status-connected')).click() // The balances should not be fetched before the account button is hovered
cy.get('@gqlSpy').should('not.have.been.called')
// Balances should have been fetched once after hover
cy.get(getTestSelector('web3-status-connected')).trigger('mouseover')
cy.get('@gqlSpy').should('have.been.calledOnce') cy.get('@gqlSpy').should('have.been.calledOnce')
// Balances should not be refetched upon closing & reopening drawer // Balances should not be refetched upon opening drawer
cy.get(getTestSelector('close-account-drawer')).click()
cy.get(getTestSelector('web3-status-connected')).click() cy.get(getTestSelector('web3-status-connected')).click()
cy.get('@gqlSpy').should('have.been.calledOnce') cy.get('@gqlSpy').should('have.been.calledOnce')
}) })