indexworkspace2
bunsenstraat 3 years ago
parent 7aeb5a7500
commit d227e4bc71
  1. 8
      apps/remix-ide-e2e/src/local-plugin/src/app/Client.ts
  2. 4
      apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx
  3. 15
      apps/remix-ide-e2e/src/local-plugin/tests/plugin-api.test.ts
  4. 86
      apps/remix-ide-e2e/src/tests/plugin_api.test.ts
  5. 1
      apps/remix-ide/src/assets/js/workspace_1632313874650
  6. 49
      package-lock.json
  7. 6
      package.json

@ -176,12 +176,12 @@ export class WorkSpacePlugin extends PluginClient {
async test (p: string) {}
async activate () {
this.call('manager', 'activatePlugin', 'remixd')
async activate (id: string) {
this.call('manager', 'activatePlugin', id)
}
async deactivate () {
this.call('manager', 'deactivatePlugin', '111')
async deactivate (id: string) {
this.call('manager', 'deactivatePlugin', id)
}
async getresult () {

@ -43,8 +43,8 @@ function App () {
<button className='btn btn-primary btn-sm' onClick={async () => await client.importcontent(payload)}>import content resolve</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.fetch(payload)}>api test fetch</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.axios(payload)}>api test axios</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.activate()}>activate</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.deactivate()}>deactivate</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.activate(payload)}>activate</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.deactivate(payload)}>deactivate</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.getresult()}>get compilation result</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.getcompilerconfig()}>get compiler config</button>
<button className='btn btn-primary btn-sm' onClick={async () => await client.getWorkSpace()}>get workspace</button>

@ -17,9 +17,9 @@ interface dataIdSelectorInterface extends Selector {
}
const setCompilerVersion = async (t: TestController, version: string) => {
const citySelect = Selector('#versionSelector')
const citySelect = Selector('#evmVersionSelector')
const cityOption = citySelect.find('option')
await t.click(citySelect).click(cityOption.withAttribute('value', 'builtin'))
await t.click(citySelect).click(cityOption.withAttribute('value', 'london'))
}
const ClickLaunchIcon = async (t: TestController, icon: string) => {
@ -56,7 +56,7 @@ const localPluginData = {
]
}
test('install plugin', async t => {
test.only('install plugin', async t => {
// exists doesn't wait with timeouts, this is a hack but it works, it will wait for buttons to appear
// https://testcafe.io/documentation/402829/guides/basic-guides/select-page-elements#selector-timeout
await Selector('Button', { timeout: 120000 }).innerText
@ -64,9 +64,14 @@ test('install plugin', async t => {
await t.click(Selector('Button').withText('Sure'))
}
await t.click('.introjs-skipbutton')
// await ClickLaunchIcon(t, 'solidity')
await ClickLaunchIcon(t, 'solidity')
await t.click(Selector("#optimize"))
await setCompilerVersion(t, 'builtin')
await t.wait(10000)
// await setCompilerVersion(t, 'builtin')
await installPlugin(t, localPluginData)
// await installPlugin(t, localPluginData)
})
test.disablePageReloads('switch to plugin', async t => {

@ -0,0 +1,86 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
declare global {
interface Window { testmode: boolean; }
}
const localPluginData = {
pluginName: 'localPlugin',
pluginDisplayName: 'Local Plugin',
pluginCanActivate: 'dGitProvider,flattener,solidityUnitTesting',
pluginUrl: 'http://localhost:2020'
}
const assertLog = function (browser: NightwatchBrowser, buttonText: string, msg: any, payload: string) {
if (payload) {
browser.clearValue('//*[@id="payload"]').setValue('//*[@id="payload"]', payload).pause(1000)
}
if (msg && typeof msg !== 'string') msg = JSON.stringify(msg)
browser
.useXpath().waitForElementVisible(`//*[text()='${buttonText}']`).click(`//*[text()='${buttonText}']`)
.pause(2000)
if (msg) {
browser.waitForElementVisible('//*[@id="log"]').assert.containsText('//*[@id="log"]', msg)
}
}
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080', false)
},
'Should Load Plugin Manager': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]')
.pause(3000)
.click('*[plugin="pluginManager"]')
.pause(3000)
.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'PLUGIN MANAGER')
},
'Should connect a local plugin': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.execute(function () {
window.testmode = true
})
.click('*[data-id="pluginManagerComponentPluginSearchButton"]')
.waitForElementVisible('*[data-id="pluginManagerLocalPluginModalDialogModalDialogContainer-react"]')
.click('*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalBody-react"]')
.waitForElementVisible('*[data-id="localPluginName"]')
.clearValue('*[data-id="localPluginName"]').setValue('*[data-id="localPluginName"]', localPluginData.pluginName)
.clearValue('*[data-id="localPluginDisplayName"]').setValue('*[data-id="localPluginDisplayName"]', localPluginData.pluginDisplayName)
.clearValue('*[data-id="localPluginUrl"]').setValue('*[data-id="localPluginUrl"]', localPluginData.pluginUrl)
.clearValue('*[data-id="localPluginCanActivate"]').setValue('*[data-id="localPluginCanActivate"]', localPluginData.pluginCanActivate)
.click('*[data-id="localPluginRadioButtoniframe"]')
.click('*[data-id="localPluginRadioButtonsidePanel"]')
.click('*[data-id="pluginManagerLocalPluginModalDialogModalDialogModalFooter-react"]')
.click('*[data-id="pluginManagerLocalPluginModalDialog-modal-footer-ok-react')
.waitForElementVisible('[data-id="verticalIconsKindlocalPlugin"]')
.click('[data-id="verticalIconsKindlocalPlugin"]')
// @ts-ignore
.frame(0)
},
'Should get current workspace': function (browser: NightwatchBrowser) {
assertLog(browser, 'get workspace', { name: 'default_workspace', isLocalhost: false, absolutePath: '.workspaces/default_workspace' }, null)
},
'Should get current files': function (browser: NightwatchBrowser) {
assertLog(browser, 'readdir', { contracts: { isDirectory: true }, scripts: { isDirectory: true }, tests: { isDirectory: true }, 'README.txt': { isDirectory: false } }, null)
},
'Should throw error on current file': function (browser: NightwatchBrowser) {
assertLog(browser, 'getcurrentfile', 'Error from IDE : Error: No such file or directory No file selected', null)
},
'Should open readme.txt': function (browser: NightwatchBrowser) {
assertLog(browser, 'openfile', null, 'README.txt')
},
'Should have current file': function (browser: NightwatchBrowser) {
assertLog(browser, 'getcurrentfile', 'README.txt', null)
},
'Should activate solidityUnitTesting': function (browser: NightwatchBrowser) {
assertLog(browser, 'activate', null, 'solidityUnitTesting')
}
}

@ -0,0 +1 @@
Subproject commit 6af4ed6169ee4165ce86457f98c0a568bd9d7491

49
package-lock.json generated

@ -25119,6 +25119,12 @@
"isobject": "^3.0.1"
}
},
"is-port-reachable": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/is-port-reachable/-/is-port-reachable-3.1.0.tgz",
"integrity": "sha512-vjc0SSRNZ32s9SbZBzGaiP6YVB+xglLShhgZD/FHMZUXBvQWaV9CtzgeVhjccFJrI6RAMV+LX7NYxueW/A8W5A==",
"dev": true
},
"is-posix-bracket": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz",
@ -42384,15 +42390,17 @@
"integrity": "sha1-9RWxoWLek8LM7y/AyjPztVQ+OMg="
},
"selenium-standalone": {
"version": "6.24.0",
"resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-6.24.0.tgz",
"integrity": "sha512-Dun2XgNAgCfJNrrSzuv7Z7Wj7QTvBKpqx0VXFz7bW9T9FUe5ytzgzoCEEshwDVMh0Dv6sCgdZg7VDhM/q2yPPQ==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-7.1.0.tgz",
"integrity": "sha512-Pc7U48qwB4LVy/XczBrPPXwUhEPl3XQSik8SjLfj2qzBEtZqrjyzOlnnXq4aVCdr5wH9FiFJm8LwheJbK2+/oQ==",
"dev": true,
"requires": {
"commander": "^2.20.3",
"commander": "^7.2.0",
"cross-spawn": "^7.0.3",
"debug": "^4.3.1",
"fs-extra": "^10.0.0",
"got": "^11.8.2",
"is-port-reachable": "^3.0.0",
"lodash.mapvalues": "^4.6.0",
"lodash.merge": "^4.6.2",
"minimist": "^1.2.5",
@ -42433,6 +42441,12 @@
"responselike": "^2.0.0"
}
},
"commander": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
"dev": true
},
"cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@ -42468,6 +42482,17 @@
"integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==",
"dev": true
},
"fs-extra": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
"integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
}
},
"get-stream": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
@ -42502,6 +42527,16 @@
"integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
"dev": true
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
}
},
"keyv": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.3.tgz",
@ -42577,6 +42612,12 @@
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true
},
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
"dev": true
},
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",

@ -90,7 +90,7 @@
"nightwatch_local_runAndDeploy": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/runAndDeploy.js --env=chrome-runAndDeploy",
"nightwatch_local_url": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/url.spec.js --env=chrome",
"nightwatch_local_verticalIconscontextmenu": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/verticalIconsPanel.spec.js --env=chrome",
"testcafe_local_pluginApi": "testcafe --config-file apps/remix-ide-e2e/src/local-plugin/.testcaferc.js apps/remix-ide-e2e/src/local-plugin/tests/plugin-api.test.ts",
"testcafe_local_pluginApi": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/plugin_api.test.js --env=chrome",
"onchange": "onchange apps/remix-ide/build/app.js -- npm-run-all lint",
"remixd": "nx build remixd && nx serve remixd --folder=./apps/remix-ide/contracts --remixide=http://127.0.0.1:8080",
"selenium": "selenium-standalone start",
@ -276,7 +276,7 @@
"mkdirp": "^0.5.1",
"mocha": "^8.0.1",
"nanohtml": "^1.6.3",
"nightwatch": "^1.5.1",
"nightwatch": "^1.7.11",
"nodemon": "^2.0.4",
"notify-error": "^1.2.0",
"npm-link-local": "^1.1.0",
@ -288,7 +288,7 @@
"remix-tabs": "1.1.3",
"request": "^2.83.0",
"rimraf": "^2.6.1",
"selenium-standalone": "^6.17.0",
"selenium-standalone": "^7.1.0",
"semver": "^6.3.0",
"solc": "0.7.4",
"swarmgw": "^0.3.1",

Loading…
Cancel
Save