Add retries to scenarios to prevent random networking bug.

This commit is contained in:
David Racero 2021-02-01 19:24:50 +01:00
parent 3f6dd8a0f0
commit f106502c72
2 changed files with 2 additions and 4 deletions

View File

@ -62,11 +62,8 @@ export const advanceTimeAndBlock = async function (forwardTime: number) {
} }
const currentTime = currentBlock.timestamp; const currentTime = currentBlock.timestamp;
const futureTime = currentTime + forwardTime; const futureTime = currentTime + forwardTime;
await new Promise((r) => setTimeout(r, 500));
await DRE.ethers.provider.send('evm_setNextBlockTimestamp', [futureTime]); await DRE.ethers.provider.send('evm_setNextBlockTimestamp', [futureTime]);
await new Promise((r) => setTimeout(r, 500));
await DRE.ethers.provider.send('evm_mine', []); await DRE.ethers.provider.send('evm_mine', []);
await new Promise((r) => setTimeout(r, 500));
}; };
export const waitForTx = async (tx: ContractTransaction) => await tx.wait(1); export const waitForTx = async (tx: ContractTransaction) => await tx.wait(1);

View File

@ -34,7 +34,8 @@ fs.readdirSync(scenarioFolder).forEach((file) => {
}); });
for (const story of scenario.stories) { for (const story of scenario.stories) {
it(story.description, async () => { it(story.description, async function () {
this.retries(4);
await executeStory(story, testEnv); await executeStory(story, testEnv);
}); });
} }