From 6ab1362c823b835b2a026a2c73e190c36675633e Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 18 Oct 2023 11:45:34 +0200 Subject: [PATCH] fix tests --- apps/remix-ide-e2e/src/tests/proxy-previous.test.ts | 7 +++++++ apps/remix-ide-e2e/src/tests/proxy.test.ts | 4 ++++ libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts | 9 ++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/proxy-previous.test.ts b/apps/remix-ide-e2e/src/tests/proxy-previous.test.ts index 32e296bdc5..0239cec582 100644 --- a/apps/remix-ide-e2e/src/tests/proxy-previous.test.ts +++ b/apps/remix-ide-e2e/src/tests/proxy-previous.test.ts @@ -16,6 +16,9 @@ module.exports = { return sources }, + 'Should set the compiler version to 8.19': function(browser: NightwatchBrowser) { + browser.setSolidityCompilerVersion('soljson-v0.8.19+commit.7dd6d404.js') + }, 'Should show deploy proxy option for UUPS upgradeable contract #group1': function (browser: NightwatchBrowser) { browser @@ -90,6 +93,7 @@ module.exports = { .click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander0"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander1"]') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Deploying ERC1967 < 5.0.0 as proxy...', 60000) }, 'Should interact with deployed contract via ERC1967 (proxy) #group1': function (browser: NightwatchBrowser) { @@ -140,6 +144,7 @@ module.exports = { .click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander0"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander1"]') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Deploying ERC1967 < 5.0.0 as proxy...', 60000) }, 'Should interact with initialized contract to verify parameters #group1': function (browser: NightwatchBrowser) { @@ -193,6 +198,7 @@ module.exports = { }) .waitForElementPresent('[data-id="universalDappUiTitleExpander0"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander1"]') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Using ERC1967 < 5.0.0 for the proxy upgrade..', 60000) }, 'Should interact with upgraded function in contract MyTokenV2 #group1': function (browser: NightwatchBrowser) { @@ -230,6 +236,7 @@ module.exports = { .click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander0"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander1"]') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Using ERC1967 < 5.0.0 for the proxy upgrade..', 60000) }, 'Should interact with upgraded contract through provided proxy address #group1': function (browser: NightwatchBrowser) { diff --git a/apps/remix-ide-e2e/src/tests/proxy.test.ts b/apps/remix-ide-e2e/src/tests/proxy.test.ts index 331dafd3ea..707944d2f6 100644 --- a/apps/remix-ide-e2e/src/tests/proxy.test.ts +++ b/apps/remix-ide-e2e/src/tests/proxy.test.ts @@ -91,6 +91,7 @@ module.exports = { .click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander0"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander1"]') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Deploying ERC1967 >= 5.0.0 as proxy...') }, 'Should interact with deployed contract via ERC1967 (proxy) #group1': function (browser: NightwatchBrowser) { @@ -142,6 +143,7 @@ module.exports = { .click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander0"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander1"]') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Deploying ERC1967 >= 5.0.0 as proxy...') }, 'Should interact with initialized contract to verify parameters #group1': function (browser: NightwatchBrowser) { @@ -196,6 +198,7 @@ module.exports = { }) .waitForElementPresent('[data-id="universalDappUiTitleExpander0"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander1"]') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Using ERC1967 >= 5.0.0 for the proxy upgrade...') }, 'Should interact with upgraded function in contract MyTokenV2 #group1': function (browser: NightwatchBrowser) { @@ -233,6 +236,7 @@ module.exports = { .click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander0"]') .waitForElementPresent('[data-id="universalDappUiTitleExpander1"]') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Using ERC1967 >= 5.0.0 for the proxy upgrade...') }, 'Should interact with upgraded contract through provided proxy address #group1': function (browser: NightwatchBrowser) { diff --git a/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts b/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts index fdbc6e2b00..4d9d432a7c 100644 --- a/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts +++ b/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts @@ -115,9 +115,9 @@ export class OpenZeppelinProxy extends Plugin { if (!hasUpgradeVersionCall) { data.contractByteCode = UUPSBytecode data.dataHex = UUPSBytecode + constructorData.replace('0x', '') - this.call('terminal', 'logHtml', `Using ERC1967 < 5.0.0 for proxy deployment...`) + this.call('terminal', 'logHtml', `Deploying ERC1967 < 5.0.0 as proxy...`) }else{ - this.call('terminal', 'logHtml', `Using ERC1967 >= 5.0.0 for proxy deployment...`) + this.call('terminal', 'logHtml', `Deploying ERC1967 >= 5.0.0 as proxy...`) } // re-use implementation contract's ABI for UI display in udapp and change name to proxy name. implementationContractObject.contractName = implementationContractObject.name @@ -154,7 +154,6 @@ export class OpenZeppelinProxy extends Plugin { let version = '4.8.3' if (error) { console.log(`error: ${error.message ? error.message : error}`) - console.log(`Will use version 4.8.3 of the proxy...`) } else { const response = txFormat.decodeResponse(returnValue, GETUUPSProxyVersionAbi) version = response[0].split('string: ')[1] @@ -173,7 +172,7 @@ export class OpenZeppelinProxy extends Plugin { linkReferences: {}, dataHex: fnData.replace('0x', ''), } - this.call('terminal', 'logHtml', `Using ERC1967 >= 5.0.0 for proxy upgrade...`) + this.call('terminal', 'logHtml', `Using ERC1967 >= 5.0.0 for the proxy upgrade...`) this.blockchain.upgradeProxy(proxyAddress, newImplAddress, data, newImplementationContractObject) } else { const fnData = await this.blockchain.getEncodedFunctionHex([newImplAddress], UUPSupgradeAbi) @@ -186,7 +185,7 @@ export class OpenZeppelinProxy extends Plugin { linkReferences: {}, dataHex: fnData.replace('0x', ''), } - this.call('terminal', 'logHtml', `Using ERC1967 < 5.0.0 for proxy upgrade...`) + this.call('terminal', 'logHtml', `Using ERC1967 < 5.0.0 for the proxy upgrade...`) this.blockchain.upgradeProxy(proxyAddress, newImplAddress, data, newImplementationContractObject) } }