From 13d77e44f8820f335cdb45f09ac72bd98c5ecbad Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 21 Feb 2022 10:35:25 +0100 Subject: [PATCH] e2e test revert --- apps/remix-ide-e2e/src/tests/debugger.test.ts | 63 +++++++++++++++++-- .../lib/button-navigator/button-navigator.tsx | 2 +- .../src/lib/vm-debugger/assembly-items.tsx | 2 +- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index e9292689e8..56a1174521 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -40,8 +40,8 @@ module.exports = { browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') .waitForElementVisible('*[data-id="slider"]') .goToVMTraceStep(51) - .click('*[data-id="dropdownPanelSolidityLocals"]') - .waitForElementContainsText('*[data-id="solidityLocals"]', 'no locals', 60000) + .waitForElementContainsText('*[data-id="solidityLocals"]', 'toast', 60000) + .waitForElementContainsText('*[data-id="solidityLocals"]', '999', 60000) .waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n51', 60000) }, @@ -227,8 +227,23 @@ module.exports = { .waitForElementVisible('*[data-id="solidityLocals"]', 60000) .pause(10000) .checkVariableDebug('soliditylocals', { num: { value: '2', type: 'uint256' } }) - .checkVariableDebug('soliditystate', { number: { value: '0', type: 'uint256', constant: false, immutable: false } }) - .end() + .checkVariableDebug('soliditystate', { number: { value: '0', type: 'uint256', constant: false, immutable: false } }) + }, + + 'Should debug reverted transactions #group5': function (browser: NightwatchBrowser) { + browser + .testContracts('reverted.sol', sources[6]['reverted.sol'], ['A', 'B', 'C']) + .clickLaunchIcon('udapp') + .selectContract('A') + .createContract('') + .pause(500) + .clickInstance(0) + .clickFunction('callA - transact (not payable)') + .debugTransaction(1) + .goToVMTraceStep(79) + .waitForElementVisible('*[data-id="debugGoToRevert"]', 60000) + .click('*[data-id="debugGoToRevert"]') + .waitForElementContainsText('*[data-id="asmitems"] div[selected="selected"]', '117 REVERT') } } @@ -352,6 +367,46 @@ const sources = [ } ` } + }, + { + 'reverted.sol': { + content: `contract A { + B b; + uint p; + constructor () { + b = new B(); + } + function callA() public { + p = 123; + try b.callB() { + + } + catch (bytes memory reason) { + + } + } + } + + contract B { + C c; + uint p; + constructor () { + c = new C(); + } + function callB() public { + p = 124; + revert("revert!"); + c.callC(); + } + } + + contract C { + uint p; + function callC() public { + p = 125; + } + }` + } } ] diff --git a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx index 5200de41f7..2db94f72cc 100644 --- a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx @@ -68,7 +68,7 @@ export const ButtonNavigation = ({ stepOverBack, stepIntoBack, stepIntoForward, This call has reverted, state changes made during the call will be reverted. This call will run out of gas. The parent call will throw an exception -
Click { jumpToException && jumpToException() }}>here to jump where the call reverted.
+
Click { jumpToException && jumpToException() }}>here to jump where the call reverted.
) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx index eb57159048..b32b229f0b 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx @@ -125,7 +125,7 @@ export const AssemblyItems = ({ registerEvent }) => {
-
+
{ assemblyItems.display.map((item, i) => { return
{ refs.current[i] = ref }}>{item}