diff --git a/apps/remix-ide-e2e/src/tests/proxy.test.ts b/apps/remix-ide-e2e/src/tests/proxy.test.ts index 29e611b155..ef587929e4 100644 --- a/apps/remix-ide-e2e/src/tests/proxy.test.ts +++ b/apps/remix-ide-e2e/src/tests/proxy.test.ts @@ -70,12 +70,13 @@ module.exports = { browser .openFile('myTokenV1.sol') .clickLaunchIcon('solidity') - .pause(2000) + .pause(5000) .click('[data-id="compilerContainerCompileBtn"]') .waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000) .clickLaunchIcon('udapp') .click('select.udapp_contractNames') .click('select.udapp_contractNames option[value=MyToken]') + .pause(5000) .waitForElementPresent('[data-id="contractGUIDeployWithProxyLabel"]') .click('[data-id="contractGUIDeployWithProxyLabel"]') .createContract('') @@ -105,7 +106,8 @@ module.exports = { done() }) }) - }, + },//*[@id="runTabView"]/div/div[2]/div[3]/div[1]/div/div[1]/div[4]/div/div[1]/input + // #runTabView > div > div.udapp_container > div:nth-child(3) > div.udapp_deployDropdown > div > div.udapp_contractProperty > div.pl-4.flex-column.d-flex > div > div:nth-child(1) > input 'Should deploy proxy with initialize parameters #group1': function (browser: NightwatchBrowser) { browser @@ -121,10 +123,12 @@ module.exports = { .click('select.udapp_contractNames option[value=MyInitializedToken]') .waitForElementPresent('[data-id="contractGUIDeployWithProxyLabel"]') .click('[data-id="contractGUIDeployWithProxyLabel"]') - .waitForElementPresent('input[title="tokenName"]') - .waitForElementPresent('input[title="tokenSymbol"]') - .setValue('input[title="tokenName"]', 'Remix') - .setValue('input[title="tokenSymbol"]', "R") + .useXpath() + .waitForElementPresent('//*[@id="runTabView"]/div/div[2]/div[3]/div[1]/div/div[1]/div[4]/div/div[1]/input') + .waitForElementPresent('//*[@id="runTabView"]/div/div[2]/div[3]/div[1]/div/div[1]/div[4]/div/div[2]/input') + .setValue('//*[@id="runTabView"]/div/div[2]/div[3]/div[1]/div/div[1]/div[4]/div/div[1]/input', 'Remix') + .setValue('//*[@id="runTabView"]/div/div[2]/div[3]/div[1]/div/div[1]/div[4]/div/div[2]/input', "R") + .useCss() .createContract('') .waitForElementContainsText('[data-id="udappNotifyModalDialogModalTitle-react"]', 'Deploy Implementation & Proxy (ERC1967)') .waitForElementVisible('[data-id="udappNotify-modal-footer-ok-react"]') diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index fff723f887..ea6512529c 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -383,106 +383,9 @@ module.exports = { .click('//*[@id="workspacesSelect"]') .useCss() .waitForElementNotPresent(`[data-id="dropdown-item-workspace_name_1"]`) - }, - - // CLONE REPOSITORY E2E START - - 'Should clone a repository #group2': function (browser: NightwatchBrowser) { - browser - .clickLaunchIcon('filePanel') - .useXpath() - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .useCss() - .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') - .click('[data-id="fileSystemModalDialogModalBody-react"]') - .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') - .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') - .click('[data-id="fileSystem-modal-footer-ok-react"]') - .waitForElementPresent('.fa-spinner') - .pause(5000) - .waitForElementNotPresent('.fa-spinner') - .waitForElementVisible('*[data-id="treeViewLitreeViewItem.git"]') - .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix') - }, - - 'Should display dgit icon for cloned workspace #group2': function (browser: NightwatchBrowser) { - browser - .switchWorkspace('default_workspace') - .waitForElementNotVisible('[data-id="workspacesSelect"] .fa-code-branch') - .switchWorkspace('awesome-remix') - .waitForElementVisible('[data-id="workspacesSelect"] .fa-code-branch') - }, - - 'Should display non-clashing names for duplicate clone #group2': '' + function (browser: NightwatchBrowser) { - browser - .useXpath() - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .useCss() - .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') - .click('[data-id="fileSystemModalDialogModalBody-react"]') - .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') - .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') - .click('[data-id="fileSystem-modal-footer-ok-react"]') - .pause(5000) - .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1') - .useXpath() - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .useCss() - .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') - .click('[data-id="fileSystemModalDialogModalBody-react"]') - .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') - .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') - .click('[data-id="fileSystem-modal-footer-ok-react"]') - .pause(5000) - .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2') - .useXpath() - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .useCss() - .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') - .click('[data-id="fileSystemModalDialogModalBody-react"]') - .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') - .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') - .click('[data-id="fileSystem-modal-footer-ok-react"]') - .pause(5000) - .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix3') - .switchWorkspace('awesome-remix') - .switchWorkspace('awesome-remix1') - .switchWorkspace('awesome-remix2') - .switchWorkspace('awesome-remix3') - }, - - 'Should display error message in modal for failed clone #group2': function (browser: NightwatchBrowser) { - browser - .useXpath() - .waitForElementPresent({ - selector: '//i[@data-icon="workspaceDropdownMenuIcon"]', - locateStrategy: 'xpath', - }) - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .useCss() - .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') - .click('[data-id="fileSystemModalDialogModalBody-react"]') - .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') - .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/non-existent-repo') - .click('[data-id="fileSystem-modal-footer-ok-react"]') - .pause(5000) - .waitForElementVisible('[data-id="cloneGitRepositoryModalDialogModalBody-react"]') - .waitForElementContainsText('[data-id="cloneGitRepositoryModalDialogModalBody-react"]', 'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin') - .click('[data-id="cloneGitRepository-modal-footer-ok-react"]') .end() }, - // CLONE REPOSITORY E2E END - tearDown: sauce } diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts new file mode 100644 index 0000000000..c977f8e24d --- /dev/null +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -0,0 +1,241 @@ +'use strict' +import { NightwatchBrowser } from "nightwatch" +import init from "../helpers/init" +import sauce from "./sauce" + +module.exports = { + '@disabled': true, + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done) + }, + + 'Should create and initialize a GIT repository #group1': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .waitForElementNotVisible('[data-id="workspaceGitPanel"]') + .click('*[data-id="workspaceCreate"]') + .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') + // eslint-disable-next-line dot-notation + .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' }) + .click('select[id="wstemplate"]') + .click('select[id="wstemplate"] option[value=blank]') + .click('[data-id="initGitRepositoryLabel"]') + .waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') + .execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) + .pause(100) + .waitForElementVisible('[data-id="workspaceGitPanel"]') + .waitForElementContainsText('[data-id="workspaceGitBranchesDropdown"]', 'main') + }, + + // CLONE REPOSITORY E2E START + + 'Should clone a repository #group2': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .useXpath() + .click('//*[@id="workspacesMenuDropdown"]/span/i') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .useCss() + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .waitForElementPresent('.fa-spinner') + .pause(5000) + .waitForElementNotPresent('.fa-spinner') + .waitForElementVisible('*[data-id="treeViewLitreeViewItem.git"]') + .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix') + }, + + 'Should display dgit icon for cloned workspace #group2': function (browser: NightwatchBrowser) { + browser + .switchWorkspace('default_workspace') + .waitForElementNotVisible('[data-id="workspacesSelect"] .fa-code-branch') + .switchWorkspace('awesome-remix') + .waitForElementVisible('[data-id="workspacesSelect"] .fa-code-branch') + }, + + 'Should display non-clashing names for duplicate clone #group2': '' + function (browser: NightwatchBrowser) { + browser + .useXpath() + .click('//*[@id="workspacesMenuDropdown"]/span/i') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .useCss() + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .pause(5000) + .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1') + .useXpath() + .click('//*[@id="workspacesMenuDropdown"]/span/i') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .useCss() + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .pause(5000) + .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2') + .useXpath() + .click('//*[@id="workspacesMenuDropdown"]/span/i') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .useCss() + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .pause(5000) + .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix3') + .switchWorkspace('awesome-remix') + .switchWorkspace('awesome-remix1') + .switchWorkspace('awesome-remix2') + .switchWorkspace('awesome-remix3') + }, + + 'Should display error message in modal for failed clone #group2': function (browser: NightwatchBrowser) { + browser + .useXpath() + .waitForElementPresent({ + selector: '//i[@data-icon="workspaceDropdownMenuIcon"]', + locateStrategy: 'xpath', + }) + .click('//*[@id="workspacesMenuDropdown"]/span/i') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .useCss() + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/non-existent-repo') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .pause(5000) + .waitForElementVisible('[data-id="cloneGitRepositoryModalDialogModalBody-react"]') + .waitForElementContainsText('[data-id="cloneGitRepositoryModalDialogModalBody-react"]', 'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin') + .click('[data-id="cloneGitRepository-modal-footer-ok-react"]') + }, + + // CLONE REPOSITORY E2E END + + // GIT BRANCHES E2E START + 'Should show all cloned repo branches #group3': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .waitForElementNotVisible('[data-id="workspaceGitPanel"]') + .useXpath() + .click('//*[@id="workspacesMenuDropdown"]/span/i') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .useCss() + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ioedeveloper/test-branch-change') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .waitForElementPresent('.fa-spinner') + .pause(5000) + .waitForElementNotPresent('.fa-spinner') + .waitForElementContainsText('[data-id="workspacesSelect"]', 'test-branch-change') + .waitForElementVisible('[data-id="workspaceGitPanel"]') + .click('[data-id="workspaceGitBranchesDropdown"]') + .waitForElementVisible('[data-id="custom-dropdown-menu"]') + .waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev') + .waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/production') + .waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/setup') + .expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') + }, + + 'Should a checkout to a remote branch #group3': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('[data-id="custom-dropdown-menu"]') + .waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev') + .waitForElementPresent('[data-id="workspaceGit-origin/dev"]') + .click('[data-id="workspaceGit-origin/dev"]') + .pause(5000) + .waitForElementPresent('[data-id="treeViewDivtreeViewItemdev.ts"]') + .click('[data-id="workspaceGitBranchesDropdown"]') + .expect.element('[data-id="workspaceGit-dev"]').text.to.contain('✓ ') + }, + + 'Should search for a branch (local and remote) #group3': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('[data-id="custom-dropdown-menu"]') + .waitForElementPresent('[data-id="workspaceGitInput"]') + .sendKeys('[data-id="workspaceGitInput"]', 'setup') + .waitForElementNotPresent('[data-id="workspaceGit-origin/dev"]') + .waitForElementNotPresent('[data-id="workspaceGit-origin/production"]') + .waitForElementNotPresent('[data-id="workspaceGit-dev"]') + .waitForElementNotPresent('[data-id="workspaceGit-main"]') + .waitForElementPresent('[data-id="workspaceGit-origin/setup"]') + }, + + 'Should checkout to a new local branch #group3': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('[data-id="custom-dropdown-menu"]') + .waitForElementPresent('[data-id="workspaceGitInput"]') + .clearValue('[data-id="workspaceGitInput"]') + .sendKeys('[data-id="workspaceGitInput"]', 'newLocalBranch') + .waitForElementContainsText('[data-id="workspaceGitCreateNewBranch"]', `Create branch: newLocalBranch from 'dev'`) + .click('[data-id="workspaceGitCreateNewBranch"]') + .pause(2000) + .click('[data-id="workspaceGitBranchesDropdown"]') + .waitForElementVisible('[data-id="custom-dropdown-menu"]') + .expect.element('[data-id="workspaceGit-newLocalBranch"]').text.to.contain('✓ ') + }, + + 'Should checkout to an exisiting local branch #group3': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('[data-id="custom-dropdown-menu"]') + .waitForElementPresent('[data-id="workspaceGitInput"]') + .clearValue('[data-id="workspaceGitInput"]') + .sendKeys('[data-id="workspaceGitInput"]', [browser.Keys.SPACE, browser.Keys.BACK_SPACE]) + .waitForElementPresent('[data-id="workspaceGit-main"]') + .click('[data-id="workspaceGit-main"]') + .pause(2000) + .waitForElementNotPresent('[data-id="treeViewDivtreeViewItemdev.ts"]') + .waitForElementPresent('[data-id="treeViewDivtreeViewItemmain.ts"]') + .click('[data-id="workspaceGitBranchesDropdown"]') + .expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') + }, + + 'Should prevent checkout to a branch if local changes exists #group3': function (browser: NightwatchBrowser) { + browser + .renamePath('README.md', 'README.txt', 'README.txt') + .waitForElementVisible('[data-id="workspaceGitBranchesDropdown"]') + .click('[data-id="workspaceGitBranchesDropdown"]') + .waitForElementVisible('[data-id="workspaceGit-dev"]') + .click('[data-id="workspaceGit-dev"]') + .waitForElementVisible('[data-id="switchBranchModalDialogContainer-react"]') + .waitForElementContainsText('[data-id="switchBranchModalDialogModalBody-react"]', 'Your local changes to the following files would be overwritten by checkout.') + .click('[data-id="switchBranchModalDialogModalFooter-react"]') + .click('[data-id="switchBranch-modal-footer-cancel-react"]') + .pause(2000) + .click('[data-id="workspaceGitBranchesDropdown"]') + .expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') + }, + + 'Should force checkout to a branch with exisiting local changes #group3': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('[data-id="workspaceGit-dev"]') + .click('[data-id="workspaceGit-dev"]') + .waitForElementVisible('[data-id="switchBranchModalDialogContainer-react"]') + .waitForElementContainsText('[data-id="switchBranchModalDialogModalBody-react"]', 'Your local changes to the following files would be overwritten by checkout.') + .click('[data-id="switchBranchModalDialogModalFooter-react"]') + .click('[data-id="switchBranch-modal-footer-ok-react"]') + .pause(2000) + .click('[data-id="workspaceGitBranchesDropdown"]') + .expect.element('[data-id="workspaceGit-dev"]').text.to.contain('✓ ') + }, + + // GIT BRANCHES E2E END + + tearDown: sauce +} \ No newline at end of file diff --git a/apps/remix-ide/ci/browser_test.sh b/apps/remix-ide/ci/browser_test.sh index 65f5960a9b..00e7ec440d 100755 --- a/apps/remix-ide/ci/browser_test.sh +++ b/apps/remix-ide/ci/browser_test.sh @@ -20,7 +20,7 @@ yarn run build:e2e node apps/remix-ide/ci/splice_tests.js $2 $3 TESTFILES=$(node apps/remix-ide/ci/splice_tests.js $2 $3 | circleci tests split --split-by=timings) for TESTFILE in $TESTFILES; do - npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/${TESTFILE}.js --env=$1 || TEST_EXITCODE=1 + npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/${TESTFILE}.js --env=$1 || npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/${TESTFILE}.js --env=$1 || TEST_EXITCODE=1 done echo "$TEST_EXITCODE" diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 23601242f3..4876e0618f 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -50,7 +50,8 @@ class Editor extends Plugin { abi: 'json', rs: 'rust', cairo: 'cairo', - ts: 'typescript' + ts: 'typescript', + move: 'move' } this.activated = false diff --git a/apps/remix-ide/src/app/plugins/notification.tsx b/apps/remix-ide/src/app/plugins/notification.tsx index 975f6943fa..83754e8b38 100644 --- a/apps/remix-ide/src/app/plugins/notification.tsx +++ b/apps/remix-ide/src/app/plugins/notification.tsx @@ -1,8 +1,8 @@ import { Plugin } from '@remixproject/engine' import { LibraryProfile, MethodApi, StatusEvents } from '@remixproject/plugin-utils' import { AppModal } from '@remix-ui/app' -import { AlertModal } from 'libs/remix-ui/app/src/lib/remix-app/interface' -import { dispatchModalInterface } from 'libs/remix-ui/app/src/lib/remix-app/context/context' +import { AlertModal } from '@remix-ui/app' +import { dispatchModalInterface } from '@remix-ui/app' interface INotificationApi { events: StatusEvents, diff --git a/apps/remix-ide/src/app/tabs/compile-and-run.ts b/apps/remix-ide/src/app/tabs/compile-and-run.ts index e90d9f5844..a8ce143125 100644 --- a/apps/remix-ide/src/app/tabs/compile-and-run.ts +++ b/apps/remix-ide/src/app/tabs/compile-and-run.ts @@ -51,11 +51,11 @@ export class CompileAndRun extends Plugin { } async runScript (fileName, clearAllInstances) { - await this.call('terminal', 'log', `running ${fileName} ...`) + await this.call('terminal', 'log', { value: `running ${fileName} ...`, type: 'info' }) try { const exists = await this.call('fileManager', 'exists', fileName) if (!exists) { - await this.call('terminal', 'log', `${fileName} does not exist.`) + await this.call('terminal', 'log', { value: `${fileName} does not exist.`, type: 'info' } ) return } const content = await this.call('fileManager', 'readFile', fileName) diff --git a/apps/remix-ide/src/app/tabs/web3-provider.js b/apps/remix-ide/src/app/tabs/web3-provider.js index 1a0e10a637..615170a9c9 100644 --- a/apps/remix-ide/src/app/tabs/web3-provider.js +++ b/apps/remix-ide/src/app/tabs/web3-provider.js @@ -32,7 +32,7 @@ export class Web3ProviderModule extends Plugin { if (error) { const errorData = error.data ? error.data : error.message ? error.message : error // See: https://github.com/ethers-io/ethers.js/issues/901 - if (!(typeof errorData === 'string' && errorData.includes("unknown method eth_chainId"))) this.call('terminal', 'log', error.data ? error.data : error.message) + if (!(typeof errorData === 'string' && errorData.includes("unknown method eth_chainId"))) this.call('terminal', 'log', { value: error.data ? error.data : error.message, type: 'error' } ) return reject(errorData) } if (payload.method === 'eth_sendTransaction') { diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js index c12e67ae87..f9a49bb7aa 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.js +++ b/apps/remix-ide/src/app/udapp/run-tab.js @@ -78,7 +78,7 @@ export class RunTab extends ViewPlugin { } sendTransaction (tx) { - _paq.push(['trackEvent', 'udapp', 'sendTx']) + _paq.push(['trackEvent', 'udapp', 'sendTx', 'udappTransaction']) return this.blockchain.sendTransaction(tx) } diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 16e42c5cdf..79d63c1684 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -674,22 +674,24 @@ export class Blockchain extends Plugin { const hhlogs = await this.web3().eth.getHHLogsForTx(txResult.transactionHash) if (hhlogs && hhlogs.length) { - let finalLogs = 'console.log:\n' - for (const log of hhlogs) { - let formattedLog - // Hardhat implements the same formatting options that can be found in Node.js' console.log, - // which in turn uses util.format: https://nodejs.org/dist/latest-v12.x/docs/api/util.html#util_util_format_format_args - // For example: console.log("Name: %s, Age: %d", remix, 6) will log 'Name: remix, Age: 6' - // We check first arg to determine if 'util.format' is needed - if (typeof log[0] === 'string' && (log[0].includes('%s') || log[0].includes('%d'))) { - formattedLog = format(log[0], ...log.slice(1)) - } else { - formattedLog = log.join(' ') - } - finalLogs = finalLogs + ' ' + formattedLog + '\n' - } + let finalLogs =