Skip to content

Commit

Permalink
try fix cypress test with firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad-Altabba committed Sep 4, 2023
1 parent 856058c commit 444255d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ describe('rpc with block', () => {
from: acc.address,
value: '0x1',
times: count,
waitAfterEachSend: 200,
});
const receiptAfter = res[res.length - 1];
const dataAfter = {
Expand All @@ -138,7 +139,6 @@ describe('rpc with block', () => {
const countAfter = await web3Eth.getTransactionCount(acc.address, dataAfter[block], {
number: format as FMT_NUMBER,
bytes: FMT_BYTES.HEX,
timeout: 100,
});
// eslint-disable-next-line jest/no-standalone-expect
expect(Number(countAfter) - Number(countBefore)).toBe(
Expand Down
8 changes: 4 additions & 4 deletions packages/web3-eth/test/integration/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type SendFewTxParams = {
times?: number;
waitReceipt?: boolean;
gas?: string | number;
timeout?: number;
waitAfterEachSend?: number;
};
export type Resolve = (value?: TransactionReceipt) => void;
export const sendFewTxes = async ({
Expand All @@ -46,7 +46,7 @@ export const sendFewTxes = async ({
from,
times = 3,
gas,
timeout,
waitAfterEachSend,
}: SendFewTxParams): Promise<TransactionReceipt[]> => {
const res: TransactionReceipt[] = [];
const toAddress = to ?? createAccount().address;
Expand All @@ -61,10 +61,10 @@ export const sendFewTxes = async ({
gas: gas ?? '300000',
}),
);
if (timeout) {
if (waitAfterEachSend) {
// eslint-disable-next-line no-await-in-loop
await new Promise<void>(resolve => {
setTimeout(resolve, timeout);
setTimeout(resolve, waitAfterEachSend);
});
}
}
Expand Down

0 comments on commit 444255d

Please sign in to comment.