Closed blassaut closed 1 month ago
Hi 👋
You could try to move the resetMocks
and mock
into the Given
, just to see if cy.window is available then.
Hey @0xNe0x1 , also tried this without success.
This does not work:
import { Given, When, Then, Before } from '@badeball/cypress-cucumber-preprocessor';
import { mock, resetMocks } from '@depay/web3-mock';
const blockchain = 'ethereum';
const accounts = ['0xd8da6bf26964af9d7eed9e03e53415d37aa96045'];
Given('I visit the dapp', () => {
resetMocks();
mock({
blockchain,
accounts: {
delay: 10000, // ms
return: accounts
}
});
cy.visit('https://metamask.github.io/test-dapp/');
});
This works (but no mocks):
import { Given, When, Then, Before } from '@badeball/cypress-cucumber-preprocessor';
import { mock, resetMocks } from '@depay/web3-mock';
const blockchain = 'ethereum';
const accounts = ['0xd8da6bf26964af9d7eed9e03e53415d37aa96045'];
Given('I visit the dapp', () => {
// resetMocks();
// mock({
// blockchain,
// accounts: {
// delay: 10000, // ms
// return: accounts
// }
// });
cy.visit('https://metamask.github.io/test-dapp/');
});
I also tried with a classic describe/it FYI by putting the resetMocks
and mock
in the it
, without success as well.
Hello guys,
I am getting this
Cannot call cy.window() outside a running test.
error with cypress 13.14.2 when I want to test web3-mock.Here is the simple code:
Would you have any idea why I am getting this? I'm sure I'm forgetting some configuration somewhere (I'm using typescript with Cucumber). FYI, I also tried without Cucumber in a single typescript/javascript file with describe/it as well, without success.