Skip to content

Commit

Permalink
fix(ci): Intermittent failures in eth_getCode_9 (#1593)
Browse files Browse the repository at this point in the history
* fix eth_getCode_9 failed

* remove spaces

* Update tests/e2e/src/eth_getCode.test.js

Co-authored-by: Flouse <1297478+Flouse@users.noreply.github.com>

---------

Co-authored-by: Flouse <1297478+Flouse@users.noreply.github.com>
  • Loading branch information
sunchengzhu and Flouse authored Nov 24, 2023
1 parent 8ccbbbb commit 6ab0ae9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
pull_request:
merge_group:
workflow_dispatch:

# Ensure that only a single job or workflow using the same concurrency group will run at a time.
# see https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/src/eth_getCode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ describe("eth_getCode", () => {
await testType.type("1"); // 0: none params 1: common params to request 2: more params
await param1.type(testDataInfo.accountAddress);
await param2.type(testDataInfo.hexBlockNumber);
await goto.check(page, "0x");
});
// Running eth_getCode_4 and eth_getCode_9 simultaneously causes axonweb3/axon/issues/1579
// temporary solution: just wait 20 seconds after executing eth_getCode_4
await goto.checkAndWait(page, "0x", 20);
}, 25000);

/**
* param1: real account address but not exist
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/src/goto.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ const goto = {
await currentpage.waitForFunction(() => document.getElementById("ret").innerText !== "");
await expect(currentpage.$eval("#ret", (e) => e.innerText)).resolves.toMatch(expectedValue);
},

async checkAndWait(currentpage, expectedValue, second) {
await currentpage.click(goto.pageIds.btnId);
await currentpage.waitForFunction(() => document.getElementById("ret").innerText !== "");
await new Promise((resolve) => { setTimeout(resolve, second * 1000); });
await expect(currentpage.$eval("#ret", (e) => e.innerText)).resolves.toMatch(expectedValue);
},

// get the value
async value(currentpage) {
await currentpage.click(goto.pageIds.btnId);
Expand Down

0 comments on commit 6ab0ae9

Please sign in to comment.