context test

indexworkspace2
bunsenstraat 3 years ago
parent fa670bd70a
commit 1f7b741765
  1. 5
      apps/remix-ide-e2e/src/local-plugin/src/app/Client.ts
  2. 6
      apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx
  3. 23
      apps/remix-ide-e2e/src/tests/plugin_api.ts

@ -3,6 +3,11 @@ import { createClient } from '@remixproject/plugin-webview'
export class RemixPlugin extends PluginClient {
constructor () {
super()
this.methods = ['testCommand']
createClient(this)
}
async testCommand (data: any) {
}
}

@ -36,6 +36,11 @@ function App () {
client.onload(async () => {
const customProfiles = ['menuicons', 'tabs', 'solidityUnitTesting']
client.testCommand = async (data: any) => {
console.log(data)
setLog(data)
}
let addProfiles = []
for (const name of customProfiles) {
const p = await client.call('manager', 'getProfile', name)
@ -72,6 +77,7 @@ function App () {
} catch (e) { }
const args = ob || [payload]
console.log('calling :', profile.name, method, ...args)
await client.call('manager', 'activatePlugin', profile.name)
const result = await client.call(profile.name as any, method, ...args)
console.log('result :', result)
setLog(result)

@ -93,8 +93,10 @@ const clickAndCheckLog = async (browser: NightwatchBrowser, buttonText: string,
}
if (methodResult && typeof methodResult !== 'string') { methodResult = JSON.stringify(methodResult) }
if (eventResult && typeof eventResult !== 'string') { eventResult = JSON.stringify(eventResult) }
if (buttonText) {
await clickButton(browser, buttonText)
await checkForAcceptAndRemember(browser)
}
await debugValues(browser, 'methods', methodResult)
await debugValues(browser, 'events', eventResult)
}
@ -122,6 +124,25 @@ module.exports = {
// FILESYSTEM
'Should create context menu item': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:registerContextMenuItem', null, null, {
id: 'localPlugin',
name: 'testCommand',
label: 'testCommand',
type: [],
extension: ['.sol'],
path: [],
pattern: []
})
await browser.useXpath().frameParent(async () => {
await clickButton(browser, 'verticalIconsFileExplorerIcons')
// await clickButton(browser, 'treeViewLitreeViewItemcontracts')
browser.rightClick('*[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]').waitForElementVisible('//*[@id="menuitemtestcommand"]').click('//*[@id="menuitemtestcommand"]', async () => {
await clickAndCheckLog(browser, null, { id: 'localPlugin', name: 'testCommand', label: 'testCommand', type: [], extension: ['.sol'], path: ['contracts/1_Storage.sol'], pattern: [] }, null, null)
})
})
},
'Should get current workspace': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:getCurrentWorkspace', { name: 'default_workspace', isLocalhost: false, absolutePath: '.workspaces/default_workspace' }, null, null)
},
@ -224,6 +245,8 @@ module.exports = {
await clickAndCheckLog(browser, 'dGitProvider:log', 'commit-message', null, null)
},
// context menu
// UNIT TESTING
'Should activate solidityUnitTesting': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'manager:activatePlugin', null, null, 'solidityUnitTesting')

Loading…
Cancel
Save