re-add test

pull/3549/head
yann300 2 years ago committed by Aniket
parent c6ed45a921
commit 5c35e324c3
  1. 33
      apps/remix-ide-e2e/src/tests/terminal.test.ts
  2. 4
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx

@ -317,18 +317,33 @@ module.exports = {
.executeScriptInTerminal(`web3.eth.getCode('0x75F509A4eDA030470272DfBAf99A47D587E76709')`) // sepolia contract .executeScriptInTerminal(`web3.eth.getCode('0x75F509A4eDA030470272DfBAf99A47D587E76709')`) // sepolia contract
.waitForElementContainsText('*[data-id="terminalJournal"]', byteCodeInSepolia, 120000) .waitForElementContainsText('*[data-id="terminalJournal"]', byteCodeInSepolia, 120000)
}, },
/*
'Should run free function which logs in the terminal #group10': function (browser: NightwatchBrowser) { 'Should run free function which logs in the terminal #group10': function (browser: NightwatchBrowser) {
const script = ` const script = `import "hardhat/console.sol";
function run () public {
console.log("test running free function"); function runSomething () view {
} ` console.log("test running free run run");
}
`
browser browser
.addFile('test.script.sol', {content: script }) .addFile('test.sol', { content: script })
.click('*[data-id="play-editor"]') // run the script .scrollToLine(3)
const path = "//*[@class='view-line' and contains(.,'runSomething') and contains(.,'view')]//span//span[contains(.,'(')]"
const pathRunFunction = `//li//*[@aria-label='Run the free function "runSomething" in the Remix VM']`
browser.waitForElementVisible('#editorView')
.useXpath()
.click(path)
.pause(3000) // the parser need to parse the code
.rightClick(path)
.execute(function () {
// @ts-ignore
document.querySelector('.shadow-root-host').shadowRoot.querySelector(`.monaco-menu span[aria-label='Run the free function "runSomething" in the Remix VM']`).parentElement.click()
}, [], function (result) {
})
// .click(pathRunFunction) // run the script
.useCss()
.waitForElementContainsText('*[data-id="terminalJournal"]', 'test running free function', 120000) .waitForElementContainsText('*[data-id="terminalJournal"]', 'test running free function', 120000)
}, }
*/
} }

@ -638,7 +638,7 @@ export const EditorUI = (props: EditorUIProps) => {
let freeFunctionAction let freeFunctionAction
const executeFreeFunctionAction = { const executeFreeFunctionAction = {
id: "executeFreeFunction", id: "executeFreeFunction",
label: "Run free function in the Remix VM", label: "Run a free function in the Remix VM",
contextMenuOrder: 0, // choose the order contextMenuOrder: 0, // choose the order
contextMenuGroupId: "execute", // create a new grouping contextMenuGroupId: "execute", // create a new grouping
precondition: 'freeFunctionCondition', precondition: 'freeFunctionCondition',
@ -674,7 +674,7 @@ export const EditorUI = (props: EditorUIProps) => {
const freeFunctionNode = nodesAtPosition.find((node) => node.kind === 'freeFunction') const freeFunctionNode = nodesAtPosition.find((node) => node.kind === 'freeFunction')
if (freeFunctionAction) freeFunctionAction.dispose() if (freeFunctionAction) freeFunctionAction.dispose()
if (freeFunctionNode) { if (freeFunctionNode) {
executeFreeFunctionAction.label = `Execute the free function "${freeFunctionNode.name}" in the Remix VM` executeFreeFunctionAction.label = `Run the free function "${freeFunctionNode.name}" in the Remix VM`
freeFunctionAction = editor.addAction(executeFreeFunctionAction) freeFunctionAction = editor.addAction(executeFreeFunctionAction)
} }
freeFunctionCondition.set(!!freeFunctionNode) freeFunctionCondition.set(!!freeFunctionNode)

Loading…
Cancel
Save