From 454377947c7f5c16923b96d4f396649194306b22 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 10 May 2021 15:11:58 +0200 Subject: [PATCH] add e2e tests --- .../src/tests/transactionExecution.spec.ts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution.spec.ts b/apps/remix-ide-e2e/src/tests/transactionExecution.spec.ts index 17fb82c644..14dcddb9c4 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.spec.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.spec.ts @@ -137,6 +137,22 @@ module.exports = { .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .click('#runTabView button[class^="instanceButton"]') .waitForElementPresent('.instance:nth-of-type(2)') + }, + + 'Should Compile and Deploy a contract which define a custom error, the error should be logged in the terminal': function (browser: NightwatchBrowser) { + browser.testContracts('customError.sol', sources[4]['customError.sol'], ['C']) + .clickLaunchIcon('udapp') + .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite + .click('#runTabView button[class^="instanceButton"]') + .waitForElementPresent('.instance:nth-of-type(3)') + .click('.instance:nth-of-type(3) > div > button') + .clickFunction('g - transact (not payable)', { types: '', values: '' }) + .testFunction('latest', {}) + .journalLastChildIncludes(`Error provided by the contract: + E + Parameters: + 2 + Debug the transaction to get more information.`) .end() } } @@ -218,5 +234,23 @@ contract C { event Test(function() external); }` } + }, + // https://github.com/ethereum/remix-project/issues/1152 + { + 'customError.sol': { + content: `// SPDX-License-Identifier: GPL-3.0 + + pragma solidity ^0.8.4; + + error E(uint a); + contract C { + function f() public pure { + revert E(2); + } + function g() public { + revert E(2); + } + }` + } } ]