Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions apps/remix-ide-e2e/src/tests/script-runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'

module.exports = {
const tests = {

before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080', false)
},
'Should activate plugins': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="remixIdeSidePanel"]')
.waitForElementVisible('*[plugin="pluginManager"]')
.click('*[plugin="pluginManager"]')
.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginManager"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtonUIScriptRunner"]')
},
'Should load default script runner': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('scriptRunnerBridge')
.waitForElementVisible('[data-id="sr-loaded-default"]')
.waitForElementVisible('[data-id="dependency-ethers-^5"]')
.waitForElementVisible('[data-id="sr-toggle-ethers6"]')
Expand Down Expand Up @@ -57,21 +65,36 @@ module.exports = {
.waitForElementPresent('*[data-id="create-semaphore"]')
.scrollAndClick('*[data-id="create-semaphore"]')
.modalFooterOKClick('TemplatesSelection')
.clickLaunchIcon('scriptRunnerBridge')
.waitForElementVisible({
locateStrategy: 'xpath',
selector: "//li[@data-id='UIScriptRunner' and @role='tab']"
})
.click({
locateStrategy: 'xpath',
selector: "//li[@data-id='UIScriptRunner' and @role='tab']"
})
.waitForElementVisible('[data-id="sr-loaded-default"]')
.waitForElementVisible('[data-id="dependency-ethers-^5"]')
.waitForElementVisible('[data-id="sr-toggle-ethers6"]')
},
'switch to default workspace that should be on ethers6': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('filePanel')
.switchWorkspace('default_workspace')
.clickLaunchIcon('scriptRunnerBridge')
.waitForElementVisible({
locateStrategy: 'xpath',
selector: "//li[@data-id='UIScriptRunner' and @role='tab']"
})
.click({
locateStrategy: 'xpath',
selector: "//li[@data-id='UIScriptRunner' and @role='tab']"
})
.waitForElementVisible('[data-id="sr-loaded-ethers6"]')
.waitForElementPresent('[data-id="dependency-ethers-^6"]')
}
}

module.exports = tests


const deployWithEthersJs = `
import { ethers } from 'ethers'
Expand Down
9 changes: 6 additions & 3 deletions apps/remix-ide/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import * as remixLib from '@remix-project/remix-lib'

import { QueryParams } from '@remix-project/remix-lib'
import { SearchPlugin } from './app/tabs/search'
import { ScriptRunnerUIPlugin } from './app/tabs/script-runner-ui'
import { ScriptRunnerBridgePlugin } from './app/plugins/script-runner-bridge'
import { ElectronProvider } from './app/files/electronProvider'

const Storage = remixLib.Storage
Expand All @@ -103,6 +103,7 @@ import Filepanel from './app/panels/file-panel'
import Editor from './app/editor/editor'
import Terminal from './app/panels/terminal'
import TabProxy from './app/panels/tab-proxy.js'
import { any } from 'async'

const _paq = (window._paq = window._paq || [])

Expand Down Expand Up @@ -281,7 +282,7 @@ class AppComponent {
const search = new SearchPlugin()

//---------------- Script Runner UI Plugin -------------------------
const scriptRunnerUI = new ScriptRunnerUIPlugin(this.engine)
const scriptRunnerUI = new ScriptRunnerBridgePlugin(this.engine)

//---- templates
const templates = new TemplatesPlugin()
Expand Down Expand Up @@ -677,7 +678,9 @@ class AppComponent {
this.appManager.call('sidePanel', 'pinView', JSON.parse(lastPinned))
}
})
.catch(console.error)
.catch((e) => {
console.error(e)
})
}
const loadedElement = document.createElement('span')
loadedElement.setAttribute('data-id', 'apploaded')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default class PluginManagerComponent extends ViewPlugin {
}

listenOnEvent () {
this.engine.event.on('onRegistration', () => this.renderComponent())
this.engine.event.on('onRegistration', () => this.getAndFilterPlugins())
this.appManager.event.on('activate', () => {
this.getAndFilterPlugins()
})
Expand Down
4 changes: 4 additions & 0 deletions apps/remix-ide/src/app/panels/tab-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ export default class TabProxy extends Plugin {
})

this.on('manager', 'pluginActivated', ({ name, location, displayName, icon, description }) => {

if (location === 'mainPanel') {
console.log('pluginActivated', name, location, displayName, icon, description)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this?

this.addTab(
name,
displayName,
Expand Down Expand Up @@ -201,6 +203,7 @@ export default class TabProxy extends Plugin {
}

focus (name) {
console.log('focus', name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?

this.emit('switchApp', name)
this.tabsApi.activateTab(name)
}
Expand Down Expand Up @@ -324,6 +327,7 @@ export default class TabProxy extends Plugin {
removeTab (name, currentFileTab) {
delete this._handlers[name]
let previous = currentFileTab
if(!this.loadedTabs.find(tab => tab.name === name)) return // prevent removing tab that doesn't exist
this.loadedTabs = this.loadedTabs.filter((tab, index) => {
if (!previous && tab.name === name) {
if(index - 1 >= 0 && this.loadedTabs[index - 1])
Expand Down
Loading