From 522e3321d82ebb86a49ce5ccb4a4414344da0147 Mon Sep 17 00:00:00 2001 From: Pavel Date: Wed, 31 Jul 2024 18:22:17 +0200 Subject: [PATCH] test: debug timeout issue --- packages/integration-tests/src/helper.ts | 4 ++++ .../integration-tests/src/playbook/deploy/erc20toL2.ts | 1 + packages/integration-tests/src/playbook/deploy/nftToL1.ts | 8 +++----- .../src/playbook/scenarios/deploy/deployERC20toL2.ts | 4 ++-- packages/integration-tests/tests/api/blocks.test.ts | 3 ++- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index a0d2aaf680..f17251f4dc 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -19,6 +19,10 @@ export class Helper { } } + async printLog(text: string) { + console.log(text); + } + async executeScript(script: string) { const output = execSync(script, { encoding: "utf-8" }); diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts index f24fe0739e..444e8493b5 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts @@ -15,4 +15,5 @@ export default async function (hre: HardhatRuntimeEnvironment) { const contractAddress = await contract.getAddress(); console.log(`${artifact.contractName} was deployed to ${contractAddress}`); await fs.writeFile(Buffer.L2, contractAddress); + console.log(`deployERC20toL2 - done`); } diff --git a/packages/integration-tests/src/playbook/deploy/nftToL1.ts b/packages/integration-tests/src/playbook/deploy/nftToL1.ts index 24ae4e4d1c..c074dcc16f 100644 --- a/packages/integration-tests/src/playbook/deploy/nftToL1.ts +++ b/packages/integration-tests/src/playbook/deploy/nftToL1.ts @@ -3,16 +3,14 @@ import { ethers } from "hardhat"; import * as hardhatConfig from "hardhat"; import { Buffer, Wallets } from "../../entities"; +import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; -async function sleep(ms: number): Promise { - return new Promise((resolve) => setTimeout(resolve, ms)); -} - async function main() { const hre: HardhatRuntimeEnvironment = hardhatConfig; + const helper = new Helper(); const wallet = await getWallet(hre); const deployer = wallet.connect(hre.ethers.provider); const MyNFTArtifact = await hre.artifacts.readArtifact("MyNFT"); @@ -22,7 +20,7 @@ async function main() { const address = await myNFT.getAddress(); console.log("Contract deployed to L1 address:", address); - await sleep(3000); // Important to update nonce. + await helper.delay(3000); // Important to update nonce. const mintNFT = await myNFT.mintNFT(address, Wallets.richWalletAddress); if (mintNFT) { console.log(`Contract mint for us!`); diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts index 469ae20867..c5ddbf3834 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts @@ -8,9 +8,9 @@ export const deployERC20toL2 = async function () { await helper.executeScript(`cd ${playbookRoot} && npm run compile`); await helper.executeScript(`cd ${playbookRoot} && npm run deployToL2`); - + await helper.printLog(`Return to the initial script: deployERC20toL2`); const deployedToken = await helper.getStringFromFile(bufferFile); - console.log("The custom ERC20 token has been deployed to L2: ", Logger.textSeparator, deployedToken); + await helper.printLog("The custom ERC20 token has been deployed to L2: " + Logger.textSeparator + deployedToken); return deployedToken; }; diff --git a/packages/integration-tests/tests/api/blocks.test.ts b/packages/integration-tests/tests/api/blocks.test.ts index 2a6f02a764..6e058da87d 100644 --- a/packages/integration-tests/tests/api/blocks.test.ts +++ b/packages/integration-tests/tests/api/blocks.test.ts @@ -7,7 +7,8 @@ describe("Blocks", () => { let response; describe("/blocks", () => { - // jest.setTimeout(localConfig.standardTimeout); + jest.setTimeout(localConfig.standardTimeout); + //@id1511 it("Verify the response via /blocks", async () => { await helper.retryTestAction(async () => {