From 999819ab4fc073531f3ecd882f5a849dee230b6a Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 09:54:05 +0100 Subject: [PATCH 01/49] test flaky hover --- .circleci/config.yml | 2 +- apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a02ab093d2..b415615e72 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: false + default: true orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 diff --git a/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts b/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts index 2b130875e3..68100dd154 100644 --- a/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts +++ b/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts @@ -25,7 +25,7 @@ module.exports = { .pause(4000) // wait for the compiler to finish .scrollToLine(37) }, - 'Should show hover over contract in editor #group1': function (browser: NightwatchBrowser) { + 'Should show hover over contract in editor #group1 #flaky': function (browser: NightwatchBrowser) { const path = "//*[contains(text(),'BallotHoverTest')]" checkEditorHoverContent(browser, path, 'contract BallotHoverTest is BallotHoverTest') checkEditorHoverContent(browser, path, 'contracts/3_Ballot.sol 10:0') From 835ab82382e93010e844f4468ab0f0735140ce9a Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 10:30:10 +0100 Subject: [PATCH 02/49] fix --- .../src/tests/editorHoverContext.test.ts | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts b/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts index 68100dd154..94c6b85663 100644 --- a/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts +++ b/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts @@ -19,16 +19,17 @@ module.exports = { }, 'Should load the test file #group1': function (browser: NightwatchBrowser) { browser.openFile('contracts') - .openFile('contracts/3_Ballot.sol') - .waitForElementVisible('#editorView') - .setEditorValue(BallotWithARefToOwner) - .pause(4000) // wait for the compiler to finish + .addFile('contracts/3_BallotHover.sol', { + content: BallotWithARefToOwner + }) .scrollToLine(37) + .useXpath().waitForElementVisible("//*[@class='view-line' and contains(.,'gas')]") + }, 'Should show hover over contract in editor #group1 #flaky': function (browser: NightwatchBrowser) { const path = "//*[contains(text(),'BallotHoverTest')]" checkEditorHoverContent(browser, path, 'contract BallotHoverTest is BallotHoverTest') - checkEditorHoverContent(browser, path, 'contracts/3_Ballot.sol 10:0') + checkEditorHoverContent(browser, path, 'contracts/3_BallotHover.sol 10:0') checkEditorHoverContent(browser, path, '@title Ballot') }, 'Should show hover over var definition in editor #group1': function (browser: NightwatchBrowser) { @@ -88,13 +89,13 @@ module.exports = { }, 'Add token file #group1': function (browser: NightwatchBrowser) { browser - .clickLaunchIcon('solidity') - .setSolidityCompilerVersion('soljson-v0.8.20+commit.a1b79de6.js') - .click('*[data-id="scConfigExpander"]') - .setValue('#evmVersionSelector', 'berlin') // set target EVM for parser to berlin - .addFile('contracts/mytoken.sol', { - content: myToken - }).useXpath().waitForElementVisible("//*[@class='view-line' and contains(.,'gas')]") + .clickLaunchIcon('solidity') + .setSolidityCompilerVersion('soljson-v0.8.20+commit.a1b79de6.js') + .click('*[data-id="scConfigExpander"]') + .setValue('#evmVersionSelector', 'berlin') // set target EVM for parser to berlin + .addFile('contracts/mytoken.sol', { + content: myToken + }).useXpath().waitForElementVisible("//*[@class='view-line' and contains(.,'gas')]") }, // here we change quickly between files to test the files being parsed correctly when switching between them 'Should show ERC20 hover over contract in editor #group1': function (browser: NightwatchBrowser) { @@ -103,8 +104,12 @@ module.exports = { const expectedContent = 'contract ERC20Burnable is ERC20Burnable, ERC20, IERC20Errors, IERC20Metadata, IERC20, Context' checkEditorHoverContent(browser, path, expectedContent, 25) }, - 'Go back to ballot file': function (browser: NightwatchBrowser) { - browser.openFile('contracts/3_Ballot.sol') + 'Go back to ballot file #group1': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('*[data-id="treeViewDivDraggableItem.deps"]') + .click('*[data-id="treeViewDivDraggableItem.deps"]') + .openFile('contracts/3_BallotHover.sol') + .scrollToLine(37) .useXpath().waitForElementVisible("//*[@class='view-line' and contains(.,'gas')]") }, 'Should show hover over function in editor again #group1': function (browser: NightwatchBrowser) { From d8283e1035ac54641a2f9c36f8d11dd2a0b1c9e8 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 10:45:20 +0100 Subject: [PATCH 03/49] turn off flaky --- .circleci/config.yml | 2 +- apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b415615e72..a02ab093d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: true + default: false orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 diff --git a/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts b/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts index 94c6b85663..dc52bcf307 100644 --- a/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts +++ b/apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts @@ -26,7 +26,7 @@ module.exports = { .useXpath().waitForElementVisible("//*[@class='view-line' and contains(.,'gas')]") }, - 'Should show hover over contract in editor #group1 #flaky': function (browser: NightwatchBrowser) { + 'Should show hover over contract in editor #group1': function (browser: NightwatchBrowser) { const path = "//*[contains(text(),'BallotHoverTest')]" checkEditorHoverContent(browser, path, 'contract BallotHoverTest is BallotHoverTest') checkEditorHoverContent(browser, path, 'contracts/3_BallotHover.sol 10:0') From eff489a8c76d60eea36f5744970cedea470d2dc9 Mon Sep 17 00:00:00 2001 From: Aniket <30843294+Aniket-Engg@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:39:54 +0530 Subject: [PATCH 04/49] Update pr-reminder.yml --- .github/workflows/pr-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-reminder.yml b/.github/workflows/pr-reminder.yml index 41f7db24e8..7f2295f7a3 100644 --- a/.github/workflows/pr-reminder.yml +++ b/.github/workflows/pr-reminder.yml @@ -3,7 +3,7 @@ name: PRs reviews reminder on: schedule: - cron: "0 8 * * 1-5" - - cron: '0 9 * * 1-5' + - cron: '58 9 * * 1-5' workflow_dispatch: jobs: From 8960d13ad10b5d6e6b3d3fd528126a969bdcda4a Mon Sep 17 00:00:00 2001 From: Aniket <30843294+Aniket-Engg@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:35:06 +0530 Subject: [PATCH 05/49] Update pr-reminder.yml --- .github/workflows/pr-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-reminder.yml b/.github/workflows/pr-reminder.yml index 7f2295f7a3..e455d557a7 100644 --- a/.github/workflows/pr-reminder.yml +++ b/.github/workflows/pr-reminder.yml @@ -19,7 +19,7 @@ jobs: webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} freeze-date: '2024-11-04T18:00:00Z' - name: Reminder for standup - if: github.event.schedule == '0 9 * * 1-5' + if: github.event.schedule == '58 9 * * 1-5' uses: Aniket-Engg/pr-reviews-reminder-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 424863b9cd20172f2817ca890bf12492ab0919fc Mon Sep 17 00:00:00 2001 From: Manuel Wedler Date: Mon, 28 Oct 2024 16:58:15 +0100 Subject: [PATCH 06/49] Verification plugin: Fix crashing chain selector --- .../components/SearchableChainDropdown.tsx | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/apps/contract-verification/src/app/components/SearchableChainDropdown.tsx b/apps/contract-verification/src/app/components/SearchableChainDropdown.tsx index c6f78c5f2f..eec16f8845 100644 --- a/apps/contract-verification/src/app/components/SearchableChainDropdown.tsx +++ b/apps/contract-verification/src/app/components/SearchableChainDropdown.tsx @@ -37,7 +37,6 @@ export const SearchableChainDropdown: React.FC = ({ label, id, se const [searchTerm, setSearchTerm] = useState(selectedChain ? getChainDescriptor(selectedChain) : '') const [isOpen, setIsOpen] = useState(false) - const [filteredOptions, setFilteredOptions] = useState(dropdownChains) const dropdownRef = useRef(null) const fuse = new Fuse(dropdownChains, { @@ -45,14 +44,7 @@ export const SearchableChainDropdown: React.FC = ({ label, id, se threshold: 0.3, }) - useEffect(() => { - if (searchTerm === '') { - setFilteredOptions(dropdownChains) - } else { - const result = fuse.search(searchTerm) - setFilteredOptions(result.map(({ item }) => item)) - } - }, [searchTerm, dropdownChains]) + const filteredOptions = searchTerm ? fuse.search(searchTerm).map(({ item }) => item) : dropdownChains // Close dropdown when user clicks outside useEffect(() => { @@ -99,15 +91,13 @@ export const SearchableChainDropdown: React.FC = ({ label, id, se {/* Add ref here */} - {isOpen && ( -
    - {filteredOptions.map((chain) => ( -
  • handleOptionClick(chain)} className={`dropdown-item text-dark ${selectedChain?.chainId === chain.chainId ? 'active' : ''}`} style={{ cursor: 'pointer', whiteSpace: 'normal' }}> - {getChainDescriptor(chain)} -
  • - ))} -
- )} +
    + {filteredOptions.map((chain) => ( +
  • handleOptionClick(chain)} className={`dropdown-item text-dark ${selectedChain?.chainId === chain.chainId ? 'active' : ''}`} style={{ cursor: 'pointer', whiteSpace: 'normal' }}> + {getChainDescriptor(chain)} +
  • + ))} +
) } From 5c3c3950d52b61e9239f4e02f22001d490abe709 Mon Sep 17 00:00:00 2001 From: yann300 Date: Sat, 26 Oct 2024 22:43:04 +0200 Subject: [PATCH 07/49] show error in the terminal and don't switch away --- .../src/app/providers/abstract-provider.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide/src/app/providers/abstract-provider.tsx b/apps/remix-ide/src/app/providers/abstract-provider.tsx index b00efc3d0a..e41c331217 100644 --- a/apps/remix-ide/src/app/providers/abstract-provider.tsx +++ b/apps/remix-ide/src/app/providers/abstract-provider.tsx @@ -107,19 +107,13 @@ export abstract class AbstractProvider extends Plugin implements IProvider { }) } - private async switchAway(showError) { + private async switchAway(showError: boolean, msg: string) { if (!this.provider) return this.provider = null this.connected = false if (showError) { - const modalContent: AlertModal = { - id: this.profile.name, - title: this.profile.displayName, - message: `Error while connecting to the provider, provider not connected` - } - this.call('notification', 'alert', modalContent) + this.call('notification', 'toast', 'Error while querying the provider: ' + msg) } - await this.call('udapp', 'setEnvironmentMode', { context: 'vm-cancun' }) return } @@ -130,7 +124,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider { resolve({ jsonrpc: '2.0', result, id: data.id }) } catch (error) { if (error && error.message && error.message.includes('SERVER_ERROR')) { - this.switchAway(true) + this.switchAway(true, error.message) } error.code = -32603 reject({ jsonrpc: '2.0', error, id: data.id }) From fe6bc2fd2704de37ea6f293e192bceb91f7cd2d7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 28 Oct 2024 15:21:56 +0100 Subject: [PATCH 08/49] fix request --- apps/remix-dapp/src/utils/txRunner.ts | 2 +- apps/remix-ide/src/app/udapp/run-tab.tsx | 22 ++++++++++--------- libs/remix-lib/src/execution/txRunnerWeb3.ts | 6 ++++- .../run-tab/src/lib/actions/deploy.ts | 11 +++++++++- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/apps/remix-dapp/src/utils/txRunner.ts b/apps/remix-dapp/src/utils/txRunner.ts index 6f22ca6c13..1914302c02 100644 --- a/apps/remix-dapp/src/utils/txRunner.ts +++ b/apps/remix-dapp/src/utils/txRunner.ts @@ -267,7 +267,7 @@ export class TxRunner { }; } catch (error: any) { console.log( - `Send transaction failed: ${error.message} . if you use an injected provider, please check it is properly unlocked. ` + `Send transaction failed: ${error.message || error.error} . if you use an injected provider, please check it is properly unlocked. ` ); return { error }; } diff --git a/apps/remix-ide/src/app/udapp/run-tab.tsx b/apps/remix-ide/src/app/udapp/run-tab.tsx index b513a76c2e..b94d6cfb80 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.tsx +++ b/apps/remix-ide/src/app/udapp/run-tab.tsx @@ -198,16 +198,18 @@ export class RunTab extends ViewPlugin { sendAsync (payload) { return udapp.call(name, 'sendAsync', payload) }, - async request (payload) { - try { - const requestResult = await udapp.call(name, 'sendAsync', payload) - if (requestResult.error) { - throw new Error(requestResult.error.message) - } - return requestResult.result - } catch (err) { - throw new Error(err.message) - } + request (payload) { + return new Promise((resolve, reject) => { + udapp.call(name, 'sendAsync', payload).then((response) => { + if (response.error) { + reject(response.error.message) + } else { + resolve(response) + } + }).catch((err) => { + reject(err) + }) + }) } } }) diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index 0cdb0ee978..b2c46feff4 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -66,7 +66,7 @@ export class TxRunnerWeb3 { const res = await (this.getWeb3() as any).eth.personal.sendTransaction({ ...tx, value }, { checkRevertBeforeSending: false, ignoreGasPricing: true }) cb(null, res.transactionHash) } catch (e) { - console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) + console.log(`Send transaction failed: ${e.message || e.error} . if you use an injected provider, please check it is properly unlocked. `) // in case the receipt is available, we consider that only the execution failed but the transaction went through. // So we don't consider this to be an error. if (e.receipt) cb(null, e.receipt.transactionHash) @@ -82,6 +82,10 @@ export class TxRunnerWeb3 { const res = await this.getWeb3().eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true }) cb(null, res.transactionHash) } catch (e) { + if (!e.message) e.message = '' + if (e.error) { + e.message = e.message + ' ' + e.error + } console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) // in case the receipt is available, we consider that only the execution failed but the transaction went through. // So we don't consider this to be an error. diff --git a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts index dd08d62a36..2c2ee360c4 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts @@ -119,10 +119,19 @@ const getConfirmationCb = (plugin: RunTab, dispatch: React.Dispatch, confir export const continueHandler = (dispatch: React.Dispatch, gasEstimationPrompt: (msg: string) => JSX.Element, error, continueTxExecution, cancelCb) => { if (error) { - let msg = typeof error !== 'string' ? error.message : error + let msg = '' + if (typeof error === 'string') { + msg = error + } if (error && error.innerError) { msg += '\n' + error.innerError } + if (error && error.message) { + msg += '\n' + error.message + } + if (error && error.error) { + msg += '\n' + error.error + } if (msg.includes('invalid opcode')) msg += '\nThe EVM version used by the selected environment is not compatible with the compiler EVM version.' From 22dac4d75878e71aa3ccd1d3ad40bb4654881212 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 17:22:28 +0100 Subject: [PATCH 09/49] provider test --- apps/remix-ide-e2e/src/tests/providers.test.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index 7fb52593e2..03495b79ac 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -12,15 +12,15 @@ module.exports = { .clickLaunchIcon('udapp') .switchEnvironment('ganache-provider') .waitForElementVisible('*[data-id="ganache-providerModalDialogModalBody-react"]') + .execute(() => { (document.querySelector('*[data-id="ganache-providerModalDialogModalBody-react"] input') as any).focus() }, [], () => {}) .clearValue('*[data-id="ganache-providerModalDialogModalBody-react"] input') .setValue('*[data-id="ganache-providerModalDialogModalBody-react"] input', 'http://127.0.0.1:8084') .modalFooterOKClick('ganache-provider') - .waitForElementContainsText('*[data-id="ganache-providerModalDialogModalBody-react"]', 'Error while connecting to the provider') - .modalFooterOKClick('ganache-provider') - .waitForElementNotVisible('*[data-id="ganache-providerModalDialogModalBody-react"]') + .pause(2000) + .waitForElementNotPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000}) .pause(1000) }, @@ -29,6 +29,8 @@ module.exports = { .waitForElementVisible('*[data-id="ganache-providerModalDialogModalBody-react"]') .modalFooterOKClick('ganache-provider') .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom (') + .waitForElementVisible({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000}) + }, 'Should switch to foundry provider, set a custom URL and fail to connect': function (browser: NightwatchBrowser) { @@ -41,9 +43,6 @@ module.exports = { .clearValue('*[data-id="foundry-providerModalDialogModalBody-react"] input') .setValue('*[data-id="foundry-providerModalDialogModalBody-react"] input', 'http://127.0.0.1:8084') .modalFooterOKClick('foundry-provider') - .waitForElementContainsText('*[data-id="foundry-providerModalDialogModalBody-react"]', 'Error while connecting to the provider') - .modalFooterOKClick('foundry-provider') - .waitForElementNotVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') .pause(1000) }, From 5f9ac0483a5357b6cbf2169c727de430b08fdc37 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 18:56:12 +0100 Subject: [PATCH 10/49] error message --- apps/remix-ide/src/blockchain/blockchain.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx index 3690b3c122..e7d36d827c 100644 --- a/apps/remix-ide/src/blockchain/blockchain.tsx +++ b/apps/remix-ide/src/blockchain/blockchain.tsx @@ -245,9 +245,9 @@ export class Blockchain extends Plugin { true, constructor, args, - (error, data) => { + (error, data) => { if (error) { - return statusCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error}`) + return statusCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error.error ? error.error : error}`) } statusCb(`creation of ${selectedContract.name} pending...`) @@ -272,7 +272,7 @@ export class Blockchain extends Plugin { selectedContract.bytecodeLinkReferences, (error, data) => { if (error) { - return statusCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error}`) + return statusCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error.error ? error.error : error}`) } statusCb(`creation of ${selectedContract.name} pending...`) @@ -485,7 +485,7 @@ export class Blockchain extends Plugin { this.runTx({ data: data, useCall: false }, confirmationCb, continueCb, promptCb, (error, txResult, address) => { if (error) { - return finalCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error}`) + return finalCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error.error ? error.error : error}`) } if (txResult.receipt.status === false || txResult.receipt.status === '0x0' || txResult.receipt.status === 0) { return finalCb(`creation of ${selectedContract.name} errored: transaction execution failed`) @@ -614,7 +614,7 @@ export class Blockchain extends Plugin { callType, (error, data) => { if (error) { - return logCallback(`${logMsg} errored: ${error.message ? error.message : error}`) + return logCallback(`${logMsg} errored: ${error.message ? error.message : error.error ? error.error : error}`) } if (!lookupOnly) { logCallback(`${logMsg} pending ... `) @@ -631,7 +631,7 @@ export class Blockchain extends Plugin { const useCall = funABI.stateMutability === 'view' || funABI.stateMutability === 'pure' this.runTx({ to: address, data, useCall }, confirmationCb, continueCb, promptCb, (error, txResult, _address, returnValue) => { if (error) { - return logCallback(`${logMsg} errored: ${error.message ? error.message : error}`) + return logCallback(`${logMsg} errored: ${error.message ? error.message : error.error ? error.error : error}`) } if (lookupOnly) { outputCb(returnValue) From 876f3819265a03afe2d158731b4841cd260c380e Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 20:22:26 +0100 Subject: [PATCH 11/49] messages --- .../src/app/providers/abstract-provider.tsx | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/app/providers/abstract-provider.tsx b/apps/remix-ide/src/app/providers/abstract-provider.tsx index e41c331217..5e645ffe81 100644 --- a/apps/remix-ide/src/app/providers/abstract-provider.tsx +++ b/apps/remix-ide/src/app/providers/abstract-provider.tsx @@ -26,8 +26,8 @@ export type RejectRequest = (error: JsonDataResult) => void export type SuccessRequest = (data: JsonDataResult) => void export interface IProvider { - options: {[id: string]: any} - init(): Promise<{[id: string]: any}> + options: { [id: string]: any } + init(): Promise<{ [id: string]: any }> body(): JSX.Element sendAsync(data: JsonDataRequest): Promise } @@ -38,7 +38,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider { defaultUrl: string connected: boolean nodeUrl: string - options: {[id: string]: any} = {} + options: { [id: string]: any } = {} constructor(profile, blockchain, defaultUrl) { super(profile) @@ -124,7 +124,21 @@ export abstract class AbstractProvider extends Plugin implements IProvider { resolve({ jsonrpc: '2.0', result, id: data.id }) } catch (error) { if (error && error.message && error.message.includes('SERVER_ERROR')) { - this.switchAway(true, error.message) + try { + // replace escaped quotes with normal quotes + const errorString = String(error.message).replace(/\\"/g, '"'); + const messageMatches = Array.from(errorString.matchAll(/"message":"(.*?)"/g)); + // Extract the message values + const messages = messageMatches.map(match => match[1]); + if (messages && messages.length > 0) { + this.switchAway(true, messages[0]) + } else { + this.switchAway(true, error.message ? error.message : error.error ? error.error : error) + } + } catch (error) { + this.switchAway(true, error.message ? error.message : error.error ? error.error : error) + } + } error.code = -32603 reject({ jsonrpc: '2.0', error, id: data.id }) From ee7b215f24e35d096c4a84ce196da7e3d08c3d46 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 29 Oct 2024 15:09:13 +0100 Subject: [PATCH 12/49] fix external provider --- .../src/app/providers/abstract-provider.tsx | 10 +--- apps/remix-ide/src/app/udapp/run-tab.tsx | 59 +++++++++++++------ 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/apps/remix-ide/src/app/providers/abstract-provider.tsx b/apps/remix-ide/src/app/providers/abstract-provider.tsx index 5e645ffe81..6c0d866265 100644 --- a/apps/remix-ide/src/app/providers/abstract-provider.tsx +++ b/apps/remix-ide/src/app/providers/abstract-provider.tsx @@ -102,17 +102,15 @@ export abstract class AbstractProvider extends Plugin implements IProvider { sendAsync(data: JsonDataRequest): Promise { // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve, reject) => { - if (!this.provider) return reject({ jsonrpc: '2.0', id: data.id, error: { message: 'provider node set', code: -32603 } } as JsonDataResult) + if (!this.provider) return reject({ jsonrpc: '2.0', id: data.id, error: { message: 'provider not set', code: -32603 } } as JsonDataResult) this.sendAsyncInternal(data, resolve, reject) }) } private async switchAway(showError: boolean, msg: string) { if (!this.provider) return - this.provider = null - this.connected = false if (showError) { - this.call('notification', 'toast', 'Error while querying the provider: ' + msg) + this.call('terminal', 'log', { type: 'error', value: 'Error while querying the provider: ' + msg }) } return } @@ -138,10 +136,8 @@ export abstract class AbstractProvider extends Plugin implements IProvider { } catch (error) { this.switchAway(true, error.message ? error.message : error.error ? error.error : error) } - } - error.code = -32603 - reject({ jsonrpc: '2.0', error, id: data.id }) + reject({ jsonrpc: '2.0', error: { message: error.message, code: -32603 }, id: data.id }) } } else { const result = data.method === 'net_listening' ? 'canceled' : [] diff --git a/apps/remix-ide/src/app/udapp/run-tab.tsx b/apps/remix-ide/src/app/udapp/run-tab.tsx index b94d6cfb80..31125b4910 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.tsx +++ b/apps/remix-ide/src/app/udapp/run-tab.tsx @@ -194,24 +194,7 @@ export class RunTab extends ViewPlugin { if (options['fork']) this.fork = options['fork'] } }, - provider: { - sendAsync (payload) { - return udapp.call(name, 'sendAsync', payload) - }, - request (payload) { - return new Promise((resolve, reject) => { - udapp.call(name, 'sendAsync', payload).then((response) => { - if (response.error) { - reject(response.error.message) - } else { - resolve(response) - } - }).catch((err) => { - reject(err) - }) - }) - } - } + provider: new Provider(udapp, name) }) } @@ -304,3 +287,43 @@ export class RunTab extends ViewPlugin { this.addInstance(address, contractObject.abi, contractObject.name) } } + +class Provider { + udapp: RunTab + name: string + constructor(udapp, name) { + this.udapp = udapp + this.name = name + } + sendAsync (payload) { + return this.udapp.call(this.name, 'sendAsync', payload) + } + request (payload): Promise { + return new Promise((resolve, reject) => { + this.udapp.call(this.name, 'sendAsync', payload).then((response) => { + if (response.error) { + reject(response.error.message) + } else { + resolve(response) + } + }).catch((err) => { + if (typeof err === 'string') { + reject(err) + } else if (err.error && err.error.message) { + reject(err.error.message) + } else if (err.error && typeof err.error === 'string') { + reject(err.error) + } else { + let e + try { + e = JSON.stringify(err) + } catch (e) { + reject('unknown error') + return + } + reject(e) + } + }) + }) + } +} From be1f1804fa0a8706a2ad20c0f0c475bab47af4ad Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 29 Oct 2024 15:46:09 +0100 Subject: [PATCH 13/49] fix error message --- apps/remix-ide/src/app/tabs/web3-provider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/web3-provider.js b/apps/remix-ide/src/app/tabs/web3-provider.js index 41bd9d3c27..39e5543c2e 100644 --- a/apps/remix-ide/src/app/tabs/web3-provider.js +++ b/apps/remix-ide/src/app/tabs/web3-provider.js @@ -86,7 +86,7 @@ export class Web3ProviderModule extends Plugin { try { resultFn(null, await provider.sendAsync(payload)) } catch (e) { - resultFn(e.error ? new Error(e.error) : new Error(e)) + resultFn(e.error ? e.error : e) } } else { reject(new Error('User denied permission')) From e755f99e92b822c35e6f494d3c51a49968b3fbb5 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 15:28:39 +0100 Subject: [PATCH 14/49] test flaky --- .circleci/config.yml | 4 ++-- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a02ab093d2..cc2943426e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: false + default: true orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 @@ -640,7 +640,7 @@ jobs: type: string jobsize: type: string - parallelism: 10 + parallelism: 1 steps: - checkout - attach_workspace: diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 9d91319e22..46a04439b2 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -146,7 +146,7 @@ const tests = { .modalFooterCancelClick('udappNotify') }, - 'Should deploy Ballot to Sepolia using metamask': function (browser: NightwatchBrowser) { + 'Should deploy Ballot to Sepolia using metamask #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) @@ -275,7 +275,7 @@ const branch = process.env.CIRCLE_BRANCH; const isMasterBranch = branch === 'master'; module.exports = { - ...{} //(branch ? (isMasterBranch ? tests : {}) : tests), + ...tests //(branch ? (isMasterBranch ? tests : {}) : tests), }; const localsCheck = { From 0f140978e116ed014acecbaaa0fe21b829eb699a Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 16:24:06 +0100 Subject: [PATCH 15/49] setgroups --- .../src/tests/runAndDeploy_injected.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 46a04439b2..d4fc5d28e3 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -35,7 +35,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #flaky #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) @@ -115,7 +115,7 @@ const tests = { }) }, - 'Should connect to Ethereum Main Network using MetaMask #group1': function (browser: NightwatchBrowser) { + 'Should connect to Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) @@ -131,7 +131,7 @@ const tests = { .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network') }, - 'Should deploy contract on Ethereum Main Network using MetaMask #group1': function (browser: NightwatchBrowser) { + 'Should deploy contract on Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') .clickLaunchIcon('filePanel') @@ -146,7 +146,7 @@ const tests = { .modalFooterCancelClick('udappNotify') }, - 'Should deploy Ballot to Sepolia using metamask #group1': function (browser: NightwatchBrowser) { + 'Should deploy Ballot to Sepolia using metamask #group3': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) @@ -204,7 +204,7 @@ const tests = { * - Metamask for getting the transaction * - Sepolia node for retrieving the trace and storage */ - 'Should debug Sepolia transaction with source highlighting MetaMask #group1': function (browser: NightwatchBrowser) { + 'Should debug Sepolia transaction with source highlighting MetaMask #group3': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return let txhash browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) @@ -233,14 +233,14 @@ const tests = { }, - 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group1': function (browser: NightwatchBrowser) { + 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group3': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser .executeScriptInTerminal('web3.eth.getAccounts()') .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') }, - 'Test EIP 712 Signature with Injected Provider (Metamask) #group1 #flaky': function (browser: NightwatchBrowser) { + 'Test EIP 712 Signature with Injected Provider (Metamask) #group3': function (browser: NightwatchBrowser) { browser.waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') .waitForElementVisible('*[data-id="signMessageTextarea"]', 120000) From 795429d4ef755110aad459d4d842f7580e8a44d1 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 16:35:39 +0100 Subject: [PATCH 16/49] group3 --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index d4fc5d28e3..e34b12807b 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -35,7 +35,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #flaky #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #group3 #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) @@ -146,7 +146,7 @@ const tests = { .modalFooterCancelClick('udappNotify') }, - 'Should deploy Ballot to Sepolia using metamask #group3': function (browser: NightwatchBrowser) { + 'Should deploy Ballot to Sepolia using metamask #flaky #group3': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) From 42e35daa08b269ad8aa81fc9d131b6d95d3d91cb Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 17:05:29 +0100 Subject: [PATCH 17/49] inject --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9e40832324..742658034c 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,4 @@ apps/remixdesktop/build* apps/remixdesktop/reports apps/remixdesktop/logs/ logs +apps/remix-ide-e2e/src/tests/injected.test.ts From ff9795373bb69798b04a9852524e7500927bf0c1 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 17:48:46 +0100 Subject: [PATCH 18/49] debug test --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index e34b12807b..5fffd80429 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -165,6 +165,8 @@ const tests = { .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser + .saveScreenshot('./reports/screenshots/metamask_34.png') + .pause(2000) .hideMetaMaskPopup() .saveScreenshot('./reports/screenshots/metamask_4.png') .waitForElementPresent('[data-testid="page-container-footer-next"]', 60000) @@ -240,7 +242,8 @@ const tests = { .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') }, - 'Test EIP 712 Signature with Injected Provider (Metamask) #group3': function (browser: NightwatchBrowser) { + 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') .waitForElementVisible('*[data-id="signMessageTextarea"]', 120000) From 5c0877e978faea89d4bfbebc4dd58bdd3c578a10 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 28 Oct 2024 18:06:35 +0100 Subject: [PATCH 19/49] present --- apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts b/apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts index 234a3a08cd..16aaa69962 100644 --- a/apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts +++ b/apps/remix-ide-e2e/src/commands/hideMetaMaskPopup.ts @@ -5,7 +5,7 @@ class HideMetaMaskPopup extends EventEmitter { command(this: NightwatchBrowser) { browser .pause(5000) - .isVisible({ + .isPresent({ selector: 'button[data-testid="popover-close"]', locateStrategy: 'css selector', suppressNotFoundErrors: true, From 7283e6ae72395fe2dbdd5e683d6e40d5f1e53ffd Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 07:16:45 +0100 Subject: [PATCH 20/49] maximise window --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 5fffd80429..38cd35b4f5 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -162,9 +162,11 @@ const tests = { .waitForElementVisible('input[placeholder="bytes32[] proposalNames"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .click('*[data-id="Deploy - transact (not payable)"]') // deploy ballot + .saveScreenshot('./reports/screenshots/metamask_1.png') .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser + .maximizeWindow() .saveScreenshot('./reports/screenshots/metamask_34.png') .pause(2000) .hideMetaMaskPopup() From fb315d44d7b05ca35a6f25455dd845aac6fce775 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 08:35:57 +0100 Subject: [PATCH 21/49] deploy success --- .../src/tests/runAndDeploy_injected.test.ts | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 38cd35b4f5..fd5764893b 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -35,7 +35,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #group3 #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #group6 #group3 #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) @@ -62,7 +62,7 @@ const tests = { .switchBrowserTab(0) // back to remix }, - 'Should add a contract file #group1': function (browser: NightwatchBrowser) { + 'Should add a contract file #group1 #flaky': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .clickLaunchIcon('filePanel') @@ -80,10 +80,12 @@ const tests = { .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]') .pause(5000) + .clearConsole() .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { checkAlerts(browser) browser + .maximizeWindow() .hideMetaMaskPopup() .waitForElementPresent('[data-testid="page-container-footer-next"]') .click('[data-testid="page-container-footer-next"]') // approve the tx @@ -95,7 +97,10 @@ const tests = { }) }, - 'Should run low level interaction (fallback function) on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + + /// end of group 1 + + 'Should run low level interaction (fallback function) on Sepolia Test Network using MetaMask #group1': !function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.clearConsole().waitForElementPresent('*[data-id="remixIdeSidePanel"]') .clickInstance(0) @@ -115,7 +120,7 @@ const tests = { }) }, - 'Should connect to Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { + 'Should connect to Ethereum Main Network using MetaMask #group2': !function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) @@ -131,7 +136,7 @@ const tests = { .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network') }, - 'Should deploy contract on Ethereum Main Network using MetaMask #group2': function (browser: NightwatchBrowser) { + 'Should deploy contract on Ethereum Main Network using MetaMask #group2': !function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') .clickLaunchIcon('filePanel') @@ -146,7 +151,7 @@ const tests = { .modalFooterCancelClick('udappNotify') }, - 'Should deploy Ballot to Sepolia using metamask #flaky #group3': function (browser: NightwatchBrowser) { + 'Should deploy Ballot to Sepolia using metamask #group3': !function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) @@ -179,6 +184,7 @@ const tests = { .perform(() => done()) }) }) + /* .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .clearConsole() .clickInstance(0) @@ -201,6 +207,7 @@ const tests = { status: '0x1 Transaction mined and execution succeed', 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } }) + */ }, /* @@ -208,7 +215,7 @@ const tests = { * - Metamask for getting the transaction * - Sepolia node for retrieving the trace and storage */ - 'Should debug Sepolia transaction with source highlighting MetaMask #group3': function (browser: NightwatchBrowser) { + 'Should debug Sepolia transaction with source highlighting MetaMask #group3': !function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return let txhash browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) @@ -237,14 +244,14 @@ const tests = { }, - 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group3': function (browser: NightwatchBrowser) { + 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group3': !function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser .executeScriptInTerminal('web3.eth.getAccounts()') .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') }, - 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': function (browser: NightwatchBrowser) { + 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': !function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') From bf2499d78dcd74dab7631f0b941a2b50c32d1465 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 08:56:22 +0100 Subject: [PATCH 22/49] faulty --- .../src/tests/runAndDeploy_injected.test.ts | 79 +++++++++++++------ 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index fd5764893b..446623d9bd 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -96,6 +96,17 @@ const tests = { }) }) }, + 'Should deploy faulty contract on Sepolia Test Network using MetaMask and show error in terminal #group1': function (browser: NightwatchBrowser) { + browser + .clearConsole() + .clickLaunchIcon('filePanel') + .addFile('faulty.sol', sources[1]['faulty.sol']) + .clickLaunchIcon('udapp') + .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') + .click('*[data-id="Deploy - transact (not payable)"]') + .pause(5000) + .saveScreenshot('./reports/screenshots/metamask_7.png') + }, /// end of group 1 @@ -184,30 +195,30 @@ const tests = { .perform(() => done()) }) }) - /* - .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) - .clearConsole() - .clickInstance(0) - .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) - .perform((done) => { // call delegate - browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { - browser - .hideMetaMaskPopup() - .saveScreenshot('./reports/screenshots/metamask_5.png') - .waitForElementPresent('[data-testid="page-container-footer-next"]', 60000) - .click('[data-testid="page-container-footer-next"]') // approve the tx - .switchBrowserTab(0) // back to remix - .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) - .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) - .perform(() => done()) - }) + /* + .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) + .clearConsole() + .clickInstance(0) + .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) + .perform((done) => { // call delegate + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + browser + .hideMetaMaskPopup() + .saveScreenshot('./reports/screenshots/metamask_5.png') + .waitForElementPresent('[data-testid="page-container-footer-next"]', 60000) + .click('[data-testid="page-container-footer-next"]') // approve the tx + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .perform(() => done()) }) - .testFunction('last', - { - status: '0x1 Transaction mined and execution succeed', - 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - }) - */ + }) + .testFunction('last', + { + status: '0x1 Transaction mined and execution succeed', + 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + }) + */ }, /* @@ -286,9 +297,13 @@ const tests = { const branch = process.env.CIRCLE_BRANCH; const isMasterBranch = branch === 'master'; -module.exports = { - ...tests //(branch ? (isMasterBranch ? tests : {}) : tests), -}; +if (!checkBrowserIsChrome(browser)) { + module.exports = {} +} else { + module.exports = { + ...tests //(branch ? (isMasterBranch ? tests : {}) : tests), + }; +} const localsCheck = { to: { @@ -325,6 +340,18 @@ const sources = [ } }` + }, + 'faulty.sol': { + content: `// SPDX-License-Identifier: GPL-3.0 + + pragma solidity >=0.8.2 <0.9.0; + + contract Test { + error O_o(uint256); + constructor() { + revert O_o(block.timestamp); + } + }` } } ] From d84c580d4863f7c5db0c1b8e85a9e0c5b1fe0452 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 09:04:43 +0100 Subject: [PATCH 23/49] sources --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 446623d9bd..7f4a04de7f 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -100,7 +100,7 @@ const tests = { browser .clearConsole() .clickLaunchIcon('filePanel') - .addFile('faulty.sol', sources[1]['faulty.sol']) + .addFile('faulty.sol', sources[0]['faulty.sol']) .clickLaunchIcon('udapp') .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]') From 051b08f8378fd2905e860733c4a1e8bbae6a2e6d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 09:18:34 +0100 Subject: [PATCH 24/49] Update pr-reminder.yml --- .github/workflows/pr-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-reminder.yml b/.github/workflows/pr-reminder.yml index e455d557a7..697e304d94 100644 --- a/.github/workflows/pr-reminder.yml +++ b/.github/workflows/pr-reminder.yml @@ -3,7 +3,7 @@ name: PRs reviews reminder on: schedule: - cron: "0 8 * * 1-5" - - cron: '58 9 * * 1-5' + - cron: '0 9 * * 1-5' workflow_dispatch: jobs: From ff1e74afa48bf38ec4be261dbe4bcc3f85df1ae1 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 10:03:11 +0100 Subject: [PATCH 25/49] click cancel --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 7f4a04de7f..75aa20daec 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -106,6 +106,9 @@ const tests = { .click('*[data-id="Deploy - transact (not payable)"]') .pause(5000) .saveScreenshot('./reports/screenshots/metamask_7.png') + .waitForElementNotVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 60000) + .click('[data-id="udappNotify-modal-footer-cancel-react"]') + .saveScreenshot('./reports/screenshots/metamask_8.png') }, From 1f9ed02c7ae0bf5136b7dfa4f75c69a9ebe19ba4 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 10:27:30 +0100 Subject: [PATCH 26/49] fix test --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 75aa20daec..74cb271761 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -106,7 +106,7 @@ const tests = { .click('*[data-id="Deploy - transact (not payable)"]') .pause(5000) .saveScreenshot('./reports/screenshots/metamask_7.png') - .waitForElementNotVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 60000) + .waitForElementVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 60000) .click('[data-id="udappNotify-modal-footer-cancel-react"]') .saveScreenshot('./reports/screenshots/metamask_8.png') }, From dd8ba0e72631bd0ff4929762ca44ef5133f08c42 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 10:36:15 +0100 Subject: [PATCH 27/49] test error msg --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 74cb271761..e32565e252 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -109,6 +109,10 @@ const tests = { .waitForElementVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 60000) .click('[data-id="udappNotify-modal-footer-cancel-react"]') .saveScreenshot('./reports/screenshots/metamask_8.png') + .waitForElementVisible({ + locateStrategy: 'xpath', + selector: "//span[@class='text-log' and contains(text(), 'errored')]" + }) }, From d7636c445f8c8578ea1fe67c838b8f8a50393e3a Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 10:46:09 +0100 Subject: [PATCH 28/49] selector --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index e32565e252..008636ee06 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -111,7 +111,7 @@ const tests = { .saveScreenshot('./reports/screenshots/metamask_8.png') .waitForElementVisible({ locateStrategy: 'xpath', - selector: "//span[@class='text-log' and contains(text(), 'errored')]" + selector: "//span[@class='text-log' and contains(., 'errored')]" }) }, From fe4cdefeb89f7929bd0a6d4ca933adb80c81f352 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 10:58:55 +0100 Subject: [PATCH 29/49] deploy again --- .../src/tests/runAndDeploy_injected.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 008636ee06..11e8706517 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -114,6 +114,31 @@ const tests = { selector: "//span[@class='text-log' and contains(., 'errored')]" }) }, + 'Should deploy contract on Sepolia Test Network using MetaMask again #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return + browser.clearConsole().waitForElementPresent('*[data-id="runTabSelectAccount"] option', 45000) + .clickLaunchIcon('filePanel') + .openFile('Greet.sol') + .clickLaunchIcon('udapp') + .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') + .click('*[data-id="Deploy - transact (not payable)"]') + .pause(5000) + .clearConsole() + .perform((done) => { + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + checkAlerts(browser) + browser + .maximizeWindow() + .hideMetaMaskPopup() + .waitForElementPresent('[data-testid="page-container-footer-next"]') + .click('[data-testid="page-container-footer-next"]') // approve the tx + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .perform(() => done()) + }) + }) + }, /// end of group 1 From ad9f985f38d9f7e582a890c370be3c08630f60f5 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 15:16:01 +0100 Subject: [PATCH 30/49] provider testing --- .../remix-ide-e2e/src/tests/providers.test.ts | 71 +++++++++++++++++-- 1 file changed, 67 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index 03495b79ac..aa54c89d7c 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -3,11 +3,12 @@ import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' module.exports = { +'@disabled': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { init(browser, done, 'http://127.0.0.1:8080', false) }, - 'Should switch to ganache provider, set a custom URL and fail to connect': function (browser: NightwatchBrowser) { + 'Should switch to ganache provider, set a custom URL and fail to connect #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('udapp') .switchEnvironment('ganache-provider') @@ -24,7 +25,7 @@ module.exports = { .pause(1000) }, - 'Should switch to ganache provider, use the default ganache URL and succeed to connect': function (browser: NightwatchBrowser) { + 'Should switch to ganache provider, use the default ganache URL and succeed to connect #group1': function (browser: NightwatchBrowser) { browser.switchEnvironment('ganache-provider') .waitForElementVisible('*[data-id="ganache-providerModalDialogModalBody-react"]') .modalFooterOKClick('ganache-provider') @@ -33,7 +34,42 @@ module.exports = { }, - 'Should switch to foundry provider, set a custom URL and fail to connect': function (browser: NightwatchBrowser) { + + 'Add script #group2': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .addFile('testScript.ts', { content: testScript }) + }, + + 'Should switch to custom provider #group2': function (browser: NightwatchBrowser) { + browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) + .clickLaunchIcon('udapp') + .switchEnvironment('ganache-provider') + .waitForElementVisible('*[data-id="ganache-providerModalDialogModalBody-react"]') + + .execute(() => { + (document.querySelector('*[data-id="ganache-providerModalDialogModalBody-react"] input') as any).focus() + }, [], () => {}) + .clearValue('*[data-id="ganache-providerModalDialogModalBody-react"] input') + .setValue('*[data-id="ganache-providerModalDialogModalBody-react"] input', 'https://scroll-rpc.publicnode.com') + .modalFooterOKClick('ganache-provider') + .pause(100) + .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000}) + .pause(1000) + }, + + 'execute script #group2': function (browser: NightwatchBrowser) { + browser.openFile('testScript.ts') + .clearConsole() + .waitForElementVisible('*[data-id="play-editor"]') + .click('*[data-id="play-editor"]') + .waitForElementVisible({ + locateStrategy: 'xpath', + selector: "//span[@class='text-log' and contains(., 'exceed maximum block range')]" + }).pause() + }, + + 'Should switch to foundry provider, set a custom URL and fail to connect #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) .switchEnvironment('foundry-provider') .waitForElementVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') @@ -46,10 +82,37 @@ module.exports = { .pause(1000) }, - 'Should switch to foundry provider, use the default foundry URL and succeed to connect': function (browser: NightwatchBrowser) { + 'Should switch to foundry provider, use the default foundry URL and succeed to connect #group1': function (browser: NightwatchBrowser) { browser.switchEnvironment('foundry-provider') .waitForElementVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') .modalFooterOKClick('foundry-provider') .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom (') } } + + +const testScript = ` +// Importing necessary libraries from Ethers.js for interaction with Ethereum blockchain. +import { ethers } from "hardhat"; + +// https://scroll-rpc.publicnode.com +async function main() { + // Setting up provider (RPC URL) to interact with your chosen Ethereum chain, + const [deployer] = await ethers.getSigners(); + + try{ + let provider; + if(!provider){ + provider=ethers.provider; + } + + const contractAddress = "0x2bC16Bf30435fd9B3A3E73Eb759176C77c28308D"; // Replace with your smart contract's address. + + // Retrieving all events of a specific kind from the blockchain + let logs = await provider.getLogs({address:contractAddress, fromBlock: '0x332f23',toBlock: '0x384410', topics: ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef']}); + console.log("Got Logs ",logs) + }catch(error){console.error(\`Error \${error}\`)} + +} + +main()` \ No newline at end of file From 38a35632a85798c56603c2064d65e224c854ccfb Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 15:39:42 +0100 Subject: [PATCH 31/49] tests --- .../remix-ide-e2e/src/tests/providers.test.ts | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index aa54c89d7c..50c56fc323 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -3,12 +3,12 @@ import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' module.exports = { -'@disabled': true, + '@disabled': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { init(browser, done, 'http://127.0.0.1:8080', false) }, - 'Should switch to ganache provider, set a custom URL and fail to connect #group1': function (browser: NightwatchBrowser) { + 'Should switch to ganache provider, set a custom URL and fail to connect #flaky #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('udapp') .switchEnvironment('ganache-provider') @@ -16,32 +16,48 @@ module.exports = { .execute(() => { (document.querySelector('*[data-id="ganache-providerModalDialogModalBody-react"] input') as any).focus() - }, [], () => {}) + }, [], () => { }) .clearValue('*[data-id="ganache-providerModalDialogModalBody-react"] input') .setValue('*[data-id="ganache-providerModalDialogModalBody-react"] input', 'http://127.0.0.1:8084') .modalFooterOKClick('ganache-provider') - .pause(2000) - .waitForElementNotPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000}) + .pause() + .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 }) .pause(1000) }, 'Should switch to ganache provider, use the default ganache URL and succeed to connect #group1': function (browser: NightwatchBrowser) { - browser.switchEnvironment('ganache-provider') - .waitForElementVisible('*[data-id="ganache-providerModalDialogModalBody-react"]') - .modalFooterOKClick('ganache-provider') - .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom (') - .waitForElementVisible({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000}) - + browser + .switchEnvironment('vm-cancun') + .pause(2000) + .switchEnvironment('ganache-provider') + .waitForElementVisible('*[data-id="ganache-providerModalDialogModalBody-react"]') + .modalFooterOKClick('ganache-provider') + .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom (') + .waitForElementVisible({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 }) + }, + 'Should switch to foundry provider, set a custom URL and fail to connect #group1': function (browser: NightwatchBrowser) { + browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) + .switchEnvironment('foundry-provider') + .waitForElementVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') + .execute(() => { + (document.querySelector('*[data-id="foundry-providerModalDialogModalBody-react"] input') as any).focus() + }, [], () => { }) + .clearValue('*[data-id="foundry-providerModalDialogModalBody-react"] input') + .setValue('*[data-id="foundry-providerModalDialogModalBody-react"] input', 'http://127.0.0.1:8084') + .modalFooterOKClick('foundry-provider') + .pause(1000) - 'Add script #group2': function (browser: NightwatchBrowser) { - browser - .clickLaunchIcon('filePanel') - .addFile('testScript.ts', { content: testScript }) + }, + 'Should switch to foundry provider, use the default foundry URL and succeed to connect #group1': function (browser: NightwatchBrowser) { + browser.switchEnvironment('foundry-provider') + .waitForElementVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') + .modalFooterOKClick('foundry-provider') + .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom (') }, - 'Should switch to custom provider #group2': function (browser: NightwatchBrowser) { + 'Should switch to custom provider #flaky #group2': function (browser: NightwatchBrowser) { browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('udapp') .switchEnvironment('ganache-provider') @@ -49,44 +65,27 @@ module.exports = { .execute(() => { (document.querySelector('*[data-id="ganache-providerModalDialogModalBody-react"] input') as any).focus() - }, [], () => {}) + }, [], () => { }) .clearValue('*[data-id="ganache-providerModalDialogModalBody-react"] input') .setValue('*[data-id="ganache-providerModalDialogModalBody-react"] input', 'https://scroll-rpc.publicnode.com') .modalFooterOKClick('ganache-provider') .pause(100) - .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000}) + .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 }) .pause(1000) }, 'execute script #group2': function (browser: NightwatchBrowser) { - browser.openFile('testScript.ts') + browser.clickLaunchIcon('filePanel') + .addFile('testScript.ts', { content: testScript }) .clearConsole() + .pause(10000) .waitForElementVisible('*[data-id="play-editor"]') .click('*[data-id="play-editor"]') .waitForElementVisible({ locateStrategy: 'xpath', - selector: "//span[@class='text-log' and contains(., 'exceed maximum block range')]" - }).pause() - }, - - 'Should switch to foundry provider, set a custom URL and fail to connect #group1': function (browser: NightwatchBrowser) { - browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) - .switchEnvironment('foundry-provider') - .waitForElementVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') - .execute(() => { - (document.querySelector('*[data-id="foundry-providerModalDialogModalBody-react"] input') as any).focus() - }, [], () => {}) - .clearValue('*[data-id="foundry-providerModalDialogModalBody-react"] input') - .setValue('*[data-id="foundry-providerModalDialogModalBody-react"] input', 'http://127.0.0.1:8084') - .modalFooterOKClick('foundry-provider') - .pause(1000) - -}, - 'Should switch to foundry provider, use the default foundry URL and succeed to connect #group1': function (browser: NightwatchBrowser) { - browser.switchEnvironment('foundry-provider') - .waitForElementVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') - .modalFooterOKClick('foundry-provider') - .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom (') + selector: "//span[@class='text-danger' and contains(., 'exceed maximum block range')]" + }) + .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 } } } @@ -111,7 +110,8 @@ async function main() { // Retrieving all events of a specific kind from the blockchain let logs = await provider.getLogs({address:contractAddress, fromBlock: '0x332f23',toBlock: '0x384410', topics: ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef']}); console.log("Got Logs ",logs) - }catch(error){console.error(\`Error \${error}\`)} + }catch(error){ + } } From 2b004bdbdf20209fa2f8551a06943a3af909f619 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 15:43:42 +0100 Subject: [PATCH 32/49] Update pr-reminder.yml --- .github/workflows/pr-reminder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-reminder.yml b/.github/workflows/pr-reminder.yml index 697e304d94..e455d557a7 100644 --- a/.github/workflows/pr-reminder.yml +++ b/.github/workflows/pr-reminder.yml @@ -3,7 +3,7 @@ name: PRs reviews reminder on: schedule: - cron: "0 8 * * 1-5" - - cron: '0 9 * * 1-5' + - cron: '58 9 * * 1-5' workflow_dispatch: jobs: From 8d81cae6d414093163e7f1cdcd6699daac2845b3 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 15:45:24 +0100 Subject: [PATCH 33/49] fix test --- apps/remix-ide-e2e/src/tests/providers.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index 50c56fc323..a8a2d05e17 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -85,7 +85,7 @@ module.exports = { locateStrategy: 'xpath', selector: "//span[@class='text-danger' and contains(., 'exceed maximum block range')]" }) - .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 } + .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 }) } } From 68b4893e3cc31528cd609736d0734c882fba585d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 15:45:46 +0100 Subject: [PATCH 34/49] fix test --- apps/remix-ide-e2e/src/tests/providers.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index a8a2d05e17..ea4ceff225 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -20,7 +20,7 @@ module.exports = { .clearValue('*[data-id="ganache-providerModalDialogModalBody-react"] input') .setValue('*[data-id="ganache-providerModalDialogModalBody-react"] input', 'http://127.0.0.1:8084') .modalFooterOKClick('ganache-provider') - .pause() + .pause(1000) .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 }) .pause(1000) }, From b7a7a13f083aa02293fcfc3fc13bf630ff7607f6 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 15:48:30 +0100 Subject: [PATCH 35/49] fix test --- apps/remix-ide-e2e/src/tests/providers.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index ea4ceff225..2baa4f6e81 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -20,7 +20,10 @@ module.exports = { .clearValue('*[data-id="ganache-providerModalDialogModalBody-react"] input') .setValue('*[data-id="ganache-providerModalDialogModalBody-react"] input', 'http://127.0.0.1:8084') .modalFooterOKClick('ganache-provider') - .pause(1000) + .waitForElementVisible({ + locateStrategy: 'xpath', + selector: "//span[@class='text-danger' and contains(., 'missing response')]" + }) .waitForElementPresent({ selector: `[data-id="selected-provider-ganache-provider"]`, timeout: 5000 }) .pause(1000) }, From 3e7b94b55ee674b53ff39d0eaf5eabacd0302e34 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:02:51 +0100 Subject: [PATCH 36/49] disable foundry --- apps/remix-ide-e2e/src/tests/providers.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index 2baa4f6e81..4caa102578 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -53,7 +53,7 @@ module.exports = { .pause(1000) }, - 'Should switch to foundry provider, use the default foundry URL and succeed to connect #group1': function (browser: NightwatchBrowser) { + 'Should switch to foundry provider, use the default foundry URL and succeed to connect #group1': !function (browser: NightwatchBrowser) { browser.switchEnvironment('foundry-provider') .waitForElementVisible('*[data-id="foundry-providerModalDialogModalBody-react"]') .modalFooterOKClick('foundry-provider') From da367cafcdbd9e1becb4025957f7ff9fbefc4900 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:15:36 +0100 Subject: [PATCH 37/49] turn off flaky --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cc2943426e..a02ab093d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: true + default: false orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 @@ -640,7 +640,7 @@ jobs: type: string jobsize: type: string - parallelism: 1 + parallelism: 10 steps: - checkout - attach_workspace: From 882df14063d15325e67721bd9d4edad2c6a027cc Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:15:42 +0100 Subject: [PATCH 38/49] rm flaky --- apps/remix-ide-e2e/src/tests/providers.test.ts | 4 ++-- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/providers.test.ts b/apps/remix-ide-e2e/src/tests/providers.test.ts index 4caa102578..862fed757b 100644 --- a/apps/remix-ide-e2e/src/tests/providers.test.ts +++ b/apps/remix-ide-e2e/src/tests/providers.test.ts @@ -8,7 +8,7 @@ module.exports = { init(browser, done, 'http://127.0.0.1:8080', false) }, - 'Should switch to ganache provider, set a custom URL and fail to connect #flaky #group1': function (browser: NightwatchBrowser) { + 'Should switch to ganache provider, set a custom URL and fail to connect #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('udapp') .switchEnvironment('ganache-provider') @@ -60,7 +60,7 @@ module.exports = { .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom (') }, - 'Should switch to custom provider #flaky #group2': function (browser: NightwatchBrowser) { + 'Should switch to custom provider #group2': function (browser: NightwatchBrowser) { browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('udapp') .switchEnvironment('ganache-provider') diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 11e8706517..9ce2d8eca9 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -62,7 +62,7 @@ const tests = { .switchBrowserTab(0) // back to remix }, - 'Should add a contract file #group1 #flaky': function (browser: NightwatchBrowser) { + 'Should add a contract file #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .clickLaunchIcon('filePanel') @@ -333,7 +333,7 @@ if (!checkBrowserIsChrome(browser)) { module.exports = {} } else { module.exports = { - ...tests //(branch ? (isMasterBranch ? tests : {}) : tests), + ... (branch ? (isMasterBranch ? tests : {}) : tests), }; } From cc9419c82ee08ffd35446debb5fb07200ca5f815 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:16:34 +0100 Subject: [PATCH 39/49] remix_beta --- apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 9ce2d8eca9..4e1a504565 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -327,7 +327,7 @@ const tests = { } const branch = process.env.CIRCLE_BRANCH; -const isMasterBranch = branch === 'master'; +const isMasterBranch = (branch === 'master' || branch === 'remix_beta'); if (!checkBrowserIsChrome(browser)) { module.exports = {} From 5323597cee4aa49bc6782589ebe73a3866ec0fe4 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:21:57 +0100 Subject: [PATCH 40/49] new test file --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 193 ++++++++++++++++++ .../src/tests/runAndDeploy_injected.test.ts | 137 +++---------- 2 files changed, 226 insertions(+), 104 deletions(-) create mode 100644 apps/remix-ide-e2e/src/tests/metamask.test.ts diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts new file mode 100644 index 0000000000..0bf909e517 --- /dev/null +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -0,0 +1,193 @@ +'use strict' +import { NightwatchBrowser } from 'nightwatch' +import init from '../helpers/init' + +const passphrase = process.env.account_passphrase +const password = process.env.account_password +const extension_id = 'nkbihfbeogaeaoehlefnkodbefgpgknn' +const extension_url = `chrome-extension://${extension_id}/home.html` + +const checkBrowserIsChrome = function (browser: NightwatchBrowser) { + return browser.browserName.indexOf('chrome') > -1 +} + +const checkAlerts = function (browser: NightwatchBrowser) { + browser.isVisible({ + selector: '//*[contains(.,"not have enough")]', + locateStrategy: 'xpath', + suppressNotFoundErrors: true, + timeout: 3000 + }, (okVisible) => { + if (okVisible.value) { + browser.assert.fail('Not enough ETH in test account!!') + browser.end() + } + }) +} + +const tests = { + '@disabled': true, + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done) + }, + + '@sources': function () { + return sources + }, + + 'Should connect to Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return + browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') + .setupMetamask(passphrase, password) + .useCss().switchBrowserTab(0) + .refreshPage() + .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) + .click('*[data-id="landingPageStartSolidity"]') + .clickLaunchIcon('udapp') + .switchEnvironment('injected-MetaMask') + .waitForElementPresent('*[data-id="settingsNetworkEnv"]') + .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Sepolia (11155111) network') + .pause(5000) + .switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + browser + .hideMetaMaskPopup() + .waitForElementVisible('*[data-testid="page-container-footer-next"]', 60000) + .click('*[data-testid="page-container-footer-next"]') // this connects the metamask account to remix + .pause(2000) + .waitForElementVisible('*[data-testid="page-container-footer-next"]', 60000) + .click('*[data-testid="page-container-footer-next"]') + // .waitForElementVisible('*[data-testid="popover-close"]') + // .click('*[data-testid="popover-close"]') + }) + .switchBrowserTab(0) // back to remix + }, + + 'Should add a contract file #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return + browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') + .clickLaunchIcon('filePanel') + .addFile('Greet.sol', sources[0]['Greet.sol']) + .clickLaunchIcon('udapp') + .waitForElementVisible('*[data-id="Deploy - transact (not payable)"]', 45000) // wait for the contract to compile + }, + + 'Should deploy contract on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return + browser.clearConsole().waitForElementPresent('*[data-id="runTabSelectAccount"] option', 45000) + .clickLaunchIcon('filePanel') + .openFile('Greet.sol') + .clickLaunchIcon('udapp') + .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') + .click('*[data-id="Deploy - transact (not payable)"]') + .pause(5000) + .clearConsole() + .perform((done) => { + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + checkAlerts(browser) + browser + .maximizeWindow() + .hideMetaMaskPopup() + .waitForElementPresent('[data-testid="page-container-footer-next"]') + .click('[data-testid="page-container-footer-next"]') // approve the tx + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .perform(() => done()) + }) + }) + }, + 'Should deploy faulty contract on Sepolia Test Network using MetaMask and show error in terminal #group1': function (browser: NightwatchBrowser) { + browser + .clearConsole() + .clickLaunchIcon('filePanel') + .addFile('faulty.sol', sources[0]['faulty.sol']) + .clickLaunchIcon('udapp') + .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') + .click('*[data-id="Deploy - transact (not payable)"]') + .pause(5000) + .saveScreenshot('./reports/screenshots/metamask_7.png') + .waitForElementVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 60000) + .click('[data-id="udappNotify-modal-footer-cancel-react"]') + .saveScreenshot('./reports/screenshots/metamask_8.png') + .waitForElementVisible({ + locateStrategy: 'xpath', + selector: "//span[@class='text-log' and contains(., 'errored')]" + }) + }, + 'Should deploy contract on Sepolia Test Network using MetaMask again #group1': function (browser: NightwatchBrowser) { + if (!checkBrowserIsChrome(browser)) return + browser.clearConsole().waitForElementPresent('*[data-id="runTabSelectAccount"] option', 45000) + .clickLaunchIcon('filePanel') + .openFile('Greet.sol') + .clickLaunchIcon('udapp') + .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') + .click('*[data-id="Deploy - transact (not payable)"]') + .pause(5000) + .clearConsole() + .perform((done) => { + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + checkAlerts(browser) + browser + .maximizeWindow() + .hideMetaMaskPopup() + .waitForElementPresent('[data-testid="page-container-footer-next"]') + .click('[data-testid="page-container-footer-next"]') // approve the tx + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .perform(() => done()) + }) + }) + } +} + +const branch = process.env.CIRCLE_BRANCH; +const isMasterBranch = (branch === 'master' || branch === 'remix_beta'); + +if (!checkBrowserIsChrome(browser)) { + module.exports = {} +} else { + module.exports = { + ... (branch ? (isMasterBranch ? tests : {}) : tests), + }; +} + +const localsCheck = { + to: { + value: '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB', + type: 'address' + } +} + +const sources = [ + { + 'Greet.sol': { + content: + ` + pragma solidity ^0.8.0; + contract HelloWorld { + string public message; + + fallback () external { + message = 'Hello World!'; + } + + function greet(string memory _message) public { + message = _message; + } + }` + }, + 'faulty.sol': { + content: `// SPDX-License-Identifier: GPL-3.0 + + pragma solidity >=0.8.2 <0.9.0; + + contract Test { + error O_o(uint256); + constructor() { + revert O_o(block.timestamp); + } + }` + } + } +] diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts index 4e1a504565..9d91319e22 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts @@ -35,7 +35,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #group6 #group3 #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) @@ -80,55 +80,10 @@ const tests = { .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]') .pause(5000) - .clearConsole() - .perform((done) => { - browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { - checkAlerts(browser) - browser - .maximizeWindow() - .hideMetaMaskPopup() - .waitForElementPresent('[data-testid="page-container-footer-next"]') - .click('[data-testid="page-container-footer-next"]') // approve the tx - .switchBrowserTab(0) // back to remix - .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) - .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) - .perform(() => done()) - }) - }) - }, - 'Should deploy faulty contract on Sepolia Test Network using MetaMask and show error in terminal #group1': function (browser: NightwatchBrowser) { - browser - .clearConsole() - .clickLaunchIcon('filePanel') - .addFile('faulty.sol', sources[0]['faulty.sol']) - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .pause(5000) - .saveScreenshot('./reports/screenshots/metamask_7.png') - .waitForElementVisible('*[data-id="udappNotifyModalDialogModalBody-react"]', 60000) - .click('[data-id="udappNotify-modal-footer-cancel-react"]') - .saveScreenshot('./reports/screenshots/metamask_8.png') - .waitForElementVisible({ - locateStrategy: 'xpath', - selector: "//span[@class='text-log' and contains(., 'errored')]" - }) - }, - 'Should deploy contract on Sepolia Test Network using MetaMask again #group1': function (browser: NightwatchBrowser) { - if (!checkBrowserIsChrome(browser)) return - browser.clearConsole().waitForElementPresent('*[data-id="runTabSelectAccount"] option', 45000) - .clickLaunchIcon('filePanel') - .openFile('Greet.sol') - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .pause(5000) - .clearConsole() .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { checkAlerts(browser) browser - .maximizeWindow() .hideMetaMaskPopup() .waitForElementPresent('[data-testid="page-container-footer-next"]') .click('[data-testid="page-container-footer-next"]') // approve the tx @@ -140,10 +95,7 @@ const tests = { }) }, - - /// end of group 1 - - 'Should run low level interaction (fallback function) on Sepolia Test Network using MetaMask #group1': !function (browser: NightwatchBrowser) { + 'Should run low level interaction (fallback function) on Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.clearConsole().waitForElementPresent('*[data-id="remixIdeSidePanel"]') .clickInstance(0) @@ -163,7 +115,7 @@ const tests = { }) }, - 'Should connect to Ethereum Main Network using MetaMask #group2': !function (browser: NightwatchBrowser) { + 'Should connect to Ethereum Main Network using MetaMask #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) @@ -179,7 +131,7 @@ const tests = { .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network') }, - 'Should deploy contract on Ethereum Main Network using MetaMask #group2': !function (browser: NightwatchBrowser) { + 'Should deploy contract on Ethereum Main Network using MetaMask #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') .clickLaunchIcon('filePanel') @@ -194,7 +146,7 @@ const tests = { .modalFooterCancelClick('udappNotify') }, - 'Should deploy Ballot to Sepolia using metamask #group3': !function (browser: NightwatchBrowser) { + 'Should deploy Ballot to Sepolia using metamask': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .switchBrowserTab(1) @@ -210,13 +162,9 @@ const tests = { .waitForElementVisible('input[placeholder="bytes32[] proposalNames"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .click('*[data-id="Deploy - transact (not payable)"]') // deploy ballot - .saveScreenshot('./reports/screenshots/metamask_1.png') .perform((done) => { browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { browser - .maximizeWindow() - .saveScreenshot('./reports/screenshots/metamask_34.png') - .pause(2000) .hideMetaMaskPopup() .saveScreenshot('./reports/screenshots/metamask_4.png') .waitForElementPresent('[data-testid="page-container-footer-next"]', 60000) @@ -227,30 +175,28 @@ const tests = { .perform(() => done()) }) }) - /* - .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) - .clearConsole() - .clickInstance(0) - .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) - .perform((done) => { // call delegate - browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { - browser - .hideMetaMaskPopup() - .saveScreenshot('./reports/screenshots/metamask_5.png') - .waitForElementPresent('[data-testid="page-container-footer-next"]', 60000) - .click('[data-testid="page-container-footer-next"]') // approve the tx - .switchBrowserTab(0) // back to remix - .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) - .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) - .perform(() => done()) - }) - }) - .testFunction('last', - { - status: '0x1 Transaction mined and execution succeed', - 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) + .clearConsole() + .clickInstance(0) + .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) + .perform((done) => { // call delegate + browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => { + browser + .hideMetaMaskPopup() + .saveScreenshot('./reports/screenshots/metamask_5.png') + .waitForElementPresent('[data-testid="page-container-footer-next"]', 60000) + .click('[data-testid="page-container-footer-next"]') // approve the tx + .switchBrowserTab(0) // back to remix + .waitForElementContainsText('*[data-id="terminalJournal"]', 'view on etherscan', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'from: 0x76a...2708f', 60000) + .perform(() => done()) + }) }) - */ + .testFunction('last', + { + status: '0x1 Transaction mined and execution succeed', + 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + }) }, /* @@ -258,7 +204,7 @@ const tests = { * - Metamask for getting the transaction * - Sepolia node for retrieving the trace and storage */ - 'Should debug Sepolia transaction with source highlighting MetaMask #group3': !function (browser: NightwatchBrowser) { + 'Should debug Sepolia transaction with source highlighting MetaMask #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return let txhash browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) @@ -287,15 +233,14 @@ const tests = { }, - 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group3': !function (browser: NightwatchBrowser) { + 'Call web3.eth.getAccounts() using Injected Provider (Metamask) #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser .executeScriptInTerminal('web3.eth.getAccounts()') .journalLastChildIncludes('["0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f"]') }, - 'Test EIP 712 Signature with Injected Provider (Metamask) #group4': !function (browser: NightwatchBrowser) { - if (!checkBrowserIsChrome(browser)) return + 'Test EIP 712 Signature with Injected Provider (Metamask) #group1 #flaky': function (browser: NightwatchBrowser) { browser.waitForElementPresent('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]') .waitForElementVisible('*[data-id="signMessageTextarea"]', 120000) @@ -327,15 +272,11 @@ const tests = { } const branch = process.env.CIRCLE_BRANCH; -const isMasterBranch = (branch === 'master' || branch === 'remix_beta'); +const isMasterBranch = branch === 'master'; -if (!checkBrowserIsChrome(browser)) { - module.exports = {} -} else { - module.exports = { - ... (branch ? (isMasterBranch ? tests : {}) : tests), - }; -} +module.exports = { + ...{} //(branch ? (isMasterBranch ? tests : {}) : tests), +}; const localsCheck = { to: { @@ -372,18 +313,6 @@ const sources = [ } }` - }, - 'faulty.sol': { - content: `// SPDX-License-Identifier: GPL-3.0 - - pragma solidity >=0.8.2 <0.9.0; - - contract Test { - error O_o(uint256); - constructor() { - revert O_o(block.timestamp); - } - }` } } ] From b6df6bac74b37d746f97d7c694224457aff7d07d Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:22:25 +0100 Subject: [PATCH 41/49] flaky test --- .circleci/config.yml | 4 ++-- apps/remix-ide-e2e/src/tests/metamask.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a02ab093d2..cc2943426e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: false + default: true orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 @@ -640,7 +640,7 @@ jobs: type: string jobsize: type: string - parallelism: 10 + parallelism: 1 steps: - checkout - attach_workspace: diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 0bf909e517..49235c45a2 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -35,7 +35,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #flaky #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) From 76ba714395235ec80d62b3238319484ad20f63de Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:27:56 +0100 Subject: [PATCH 42/49] gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 742658034c..9e40832324 100644 --- a/.gitignore +++ b/.gitignore @@ -69,4 +69,3 @@ apps/remixdesktop/build* apps/remixdesktop/reports apps/remixdesktop/logs/ logs -apps/remix-ide-e2e/src/tests/injected.test.ts From 1d10f2290fd7d3248fc78a410327fc469766f7e0 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:29:08 +0100 Subject: [PATCH 43/49] run tests --- apps/remix-ide-e2e/src/tests/metamask.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 49235c45a2..2a54af0983 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -148,7 +148,7 @@ if (!checkBrowserIsChrome(browser)) { module.exports = {} } else { module.exports = { - ... (branch ? (isMasterBranch ? tests : {}) : tests), + ...tests// (branch ? (isMasterBranch ? tests : {}) : tests), }; } From 47eb8680121559ddb88c3baf95331803813ba07e Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 29 Oct 2024 21:00:01 +0530 Subject: [PATCH 44/49] fix linting --- apps/remix-ide/src/app/udapp/run-tab.tsx | 2 +- apps/remix-ide/src/blockchain/blockchain.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/udapp/run-tab.tsx b/apps/remix-ide/src/app/udapp/run-tab.tsx index 31125b4910..983629cb81 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.tsx +++ b/apps/remix-ide/src/app/udapp/run-tab.tsx @@ -316,7 +316,7 @@ class Provider { } else { let e try { - e = JSON.stringify(err) + e = JSON.stringify(err) } catch (e) { reject('unknown error') return diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx index e7d36d827c..6ccbaed7ac 100644 --- a/apps/remix-ide/src/blockchain/blockchain.tsx +++ b/apps/remix-ide/src/blockchain/blockchain.tsx @@ -245,7 +245,7 @@ export class Blockchain extends Plugin { true, constructor, args, - (error, data) => { + (error, data) => { if (error) { return statusCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error.error ? error.error : error}`) } From 890dd09cc0606a4ace63045c53eee7d2c8db87bd Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 29 Oct 2024 16:38:23 +0100 Subject: [PATCH 45/49] turn off flaky --- .circleci/config.yml | 4 ++-- apps/remix-ide-e2e/src/tests/metamask.test.ts | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cc2943426e..a02ab093d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: true + default: false orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 @@ -640,7 +640,7 @@ jobs: type: string jobsize: type: string - parallelism: 1 + parallelism: 10 steps: - checkout - attach_workspace: diff --git a/apps/remix-ide-e2e/src/tests/metamask.test.ts b/apps/remix-ide-e2e/src/tests/metamask.test.ts index 2a54af0983..0051c57d9c 100644 --- a/apps/remix-ide-e2e/src/tests/metamask.test.ts +++ b/apps/remix-ide-e2e/src/tests/metamask.test.ts @@ -35,7 +35,7 @@ const tests = { return sources }, - 'Should connect to Sepolia Test Network using MetaMask #flaky #group1': function (browser: NightwatchBrowser) { + 'Should connect to Sepolia Test Network using MetaMask #group1': function (browser: NightwatchBrowser) { if (!checkBrowserIsChrome(browser)) return browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') .setupMetamask(passphrase, password) @@ -148,16 +148,11 @@ if (!checkBrowserIsChrome(browser)) { module.exports = {} } else { module.exports = { - ...tests// (branch ? (isMasterBranch ? tests : {}) : tests), + ...(branch ? (isMasterBranch ? tests : {}) : tests), }; } -const localsCheck = { - to: { - value: '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB', - type: 'address' - } -} + const sources = [ { From 87b2425879ba99f9f4b591f5a44d01d5e5adb255 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:50:25 +0100 Subject: [PATCH 46/49] rm AI key binding for explaining function --- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index ab8de7ec34..9a3957eb8c 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -825,10 +825,6 @@ export const EditorUI = (props: EditorUIProps) => { label: intl.formatMessage({ id: 'editor.explainFunction' }), contextMenuOrder: 1, // choose the order contextMenuGroupId: 'gtp', // create a new grouping - keybindings: [ - // Keybinding for Ctrl + Shift + E - monacoRef.current.KeyMod.CtrlCmd | monacoRef.current.KeyMod.Shift | monacoRef.current.KeyCode.KeyE - ], run: async () => { const file = await props.plugin.call('fileManager', 'getCurrentFile') const context = await props.plugin.call('fileManager', 'readFile', file) From 000124946a3a72332d69ae351d780fd38d6303b7 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 23 Oct 2024 13:29:43 +0200 Subject: [PATCH 47/49] new icon for remixguide, border for navtab etc --- apps/remix-ide/src/app/plugins/remixGuide.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide/src/app/plugins/remixGuide.tsx b/apps/remix-ide/src/app/plugins/remixGuide.tsx index adee5e5a1a..f19163f7bc 100644 --- a/apps/remix-ide/src/app/plugins/remixGuide.tsx +++ b/apps/remix-ide/src/app/plugins/remixGuide.tsx @@ -8,6 +8,7 @@ import { RemixUIGridSection } from '@remix-ui/remix-ui-grid-section' import { RemixUIGridCell } from '@remix-ui/remix-ui-grid-cell' import * as Data from './remixGuideData.json' import './remixGuide.css' +import Icon from 'libs/remix-ui/vertical-icons-panel/src/lib/components/Icon' //@ts-ignore const _paq = (window._paq = window._paq || []) From fb77f3dfaf3a4d6c46fbba1e478ac60e25cac9d4 Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 24 Oct 2024 16:11:27 +0200 Subject: [PATCH 48/49] fixed matomo --- apps/contract-verification/src/app/views/VerifyView.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/contract-verification/src/app/views/VerifyView.tsx b/apps/contract-verification/src/app/views/VerifyView.tsx index 20a0022d47..a924a2a89a 100644 --- a/apps/contract-verification/src/app/views/VerifyView.tsx +++ b/apps/contract-verification/src/app/views/VerifyView.tsx @@ -68,9 +68,9 @@ export const VerifyView = () => { name: verifierId as VerifierIdentifier, } receipts.push({ verifierInfo, status: 'pending', contractId, isProxyReceipt: false, failedChecks: 0 }) - if (enabledVerifiers.Blockscout) await sendToMatomo('verify', "verifyWith: Blockscout On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) - if (enabledVerifiers.Etherscan) await sendToMatomo('verify', "verifyWithEtherscan On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) - if (enabledVerifiers.Sourcify) await sendToMatomo('verify', "verifyWithSourcify On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) + if (enabledVerifiers.Blockscout) await sendToMatomo('verify', "verifyWith: Blockscout On: " + selectedChain?.chainId + " IsProxy: " + (hasProxy && !proxyAddress)) + if (enabledVerifiers.Etherscan) await sendToMatomo('verify', "verifyWithEtherscan On: " + selectedChain?.chainId + " IsProxy: " + (hasProxy && !proxyAddress)) + if (enabledVerifiers.Sourcify) await sendToMatomo('verify', "verifyWithSourcify On: " + selectedChain?.chainId + " IsProxy: " + (hasProxy && !proxyAddress)) } const newSubmittedContract: SubmittedContract = { From 9d6ef464d1f4fc944eac151548cea991097d33af Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 28 Oct 2024 18:44:50 +0100 Subject: [PATCH 49/49] Update remixGuide.tsx --- apps/remix-ide/src/app/plugins/remixGuide.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/app/plugins/remixGuide.tsx b/apps/remix-ide/src/app/plugins/remixGuide.tsx index f19163f7bc..adee5e5a1a 100644 --- a/apps/remix-ide/src/app/plugins/remixGuide.tsx +++ b/apps/remix-ide/src/app/plugins/remixGuide.tsx @@ -8,7 +8,6 @@ import { RemixUIGridSection } from '@remix-ui/remix-ui-grid-section' import { RemixUIGridCell } from '@remix-ui/remix-ui-grid-cell' import * as Data from './remixGuideData.json' import './remixGuide.css' -import Icon from 'libs/remix-ui/vertical-icons-panel/src/lib/components/Icon' //@ts-ignore const _paq = (window._paq = window._paq || [])