https://cypress.io logo
Is there a reason why a request would continually ...
# e2e-testing
g
Is there a reason why a request would continually be sent even after the test ends? I do have conditional logic in the request being sent contained in a
cy.intercept()
. The full intercept is here:
Copy code
cy.intercept(`${ethProvider}*`, (req) => {
            // conditonal logic to return different responses based on the request url
            console.log(req.body)
            const { method, params, id } = req.body
            if (method === 'eth_chainId') {
                req.reply({
                    body: {
                        id: 1,
                        jsonrpc: '2.0',
                        result: '0x111111',
                    },
                })
            } else if (
                method === 'eth_call' &&
                params[0]?.data === '0x79502c55'
            ) {
                req.reply({
                    body: {
                        id,
                        jsonrpc: '2.0',
                        result:
                            '0x' +
                            Array(10 * 64)
                                .fill(0)
                                .map((_, i) => (i % 64 === 63 ? 1 : 0))
                                .join(''),
                    },
                })
            } else if (method === 'eth_call') {
                // other uint256 retrievals
                req.reply({
                    body: {
                        id,
                        jsonrpc: '2.0',
                        result: '0x0000000000000000000000000000000000000000000000000000000000000001',
                    },
                })
            } else {
                req.reply({
                    body: { test: 'test' },
                })
            }
        }).as('ethProvider')
I did read the docs on Conditional Testing (https://docs.cypress.io/guides/core-concepts/conditional-testing#:~:text=The%20problem%20is,overcome%20these%20problems...) but want to know if this is the reason requests are thrown like this.