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

@ -322,7 +322,7 @@ module.exports = {
const script = `import "hardhat/console.sol";
function runSomething () view {
console.log("test running free run run");
console.log("test running free function");
}
`
browser
@ -334,13 +334,13 @@ module.exports = {
.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) {
.perform(function () {
const actions = this.actions({ async: true });
return actions
.keyDown(this.Keys.SHIFT)
.keyDown(this.Keys.ALT)
.sendKeys('r')
})
// .click(pathRunFunction) // run the script
.useCss()
.waitForElementContainsText('*[data-id="terminalJournal"]', 'test running free function', 120000)
}

@ -642,6 +642,10 @@ export const EditorUI = (props: EditorUIProps) => {
contextMenuOrder: 0, // choose the order
contextMenuGroupId: "execute", // create a new grouping
precondition: 'freeFunctionCondition',
keybindings: [
// eslint-disable-next-line no-bitwise
monacoRef.current.KeyMod.Shift | monacoRef.current.KeyMod.Alt | monacoRef.current.KeyCode.KeyR,
],
run: async () => {
const { nodesAtPosition } = await retrieveNodesAtPosition(props.editorAPI, props.plugin)
// find the contract and get the nodes of the contract and the base contracts and imports
@ -661,6 +665,10 @@ export const EditorUI = (props: EditorUIProps) => {
editor.addAction(formatAction)
editor.addAction(zoomOutAction)
editor.addAction(zoominAction)
editor.addAction(executeFreeFunctionAction)
// we have to add the command because the menu action isn't always available (see onContextMenuHandlerForFreeFunction)
editor.addCommand(monacoRef.current.KeyMod.Shift | monacoRef.current.KeyMod.Alt | monacoRef.current.KeyCode.KeyR, () => executeFreeFunctionAction.run())
const contextmenu = editor.getContribution('editor.contrib.contextmenu')
const orgContextMenuMethod = contextmenu._onContextMenu;

Loading…
Cancel
Save