Skip to content

Commit

Permalink
test: debug timeout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pcheremu committed Jul 31, 2024
1 parent 24e955e commit 522e332
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions packages/integration-tests/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
8 changes: 3 additions & 5 deletions packages/integration-tests/src/playbook/deploy/nftToL1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
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");
Expand All @@ -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!`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
3 changes: 2 additions & 1 deletion packages/integration-tests/tests/api/blocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 522e332

Please sign in to comment.