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 { export class RemixPlugin extends PluginClient {
constructor () { constructor () {
super() super()
this.methods = ['testCommand']
createClient(this) createClient(this)
} }
async testCommand (data: any) {
}
} }

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

@ -93,8 +93,10 @@ const clickAndCheckLog = async (browser: NightwatchBrowser, buttonText: string,
} }
if (methodResult && typeof methodResult !== 'string') { methodResult = JSON.stringify(methodResult) } if (methodResult && typeof methodResult !== 'string') { methodResult = JSON.stringify(methodResult) }
if (eventResult && typeof eventResult !== 'string') { eventResult = JSON.stringify(eventResult) } if (eventResult && typeof eventResult !== 'string') { eventResult = JSON.stringify(eventResult) }
if (buttonText) {
await clickButton(browser, buttonText) await clickButton(browser, buttonText)
await checkForAcceptAndRemember(browser) await checkForAcceptAndRemember(browser)
}
await debugValues(browser, 'methods', methodResult) await debugValues(browser, 'methods', methodResult)
await debugValues(browser, 'events', eventResult) await debugValues(browser, 'events', eventResult)
} }
@ -122,6 +124,25 @@ module.exports = {
// FILESYSTEM // 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) { 'Should get current workspace': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:getCurrentWorkspace', { name: 'default_workspace', isLocalhost: false, absolutePath: '.workspaces/default_workspace' }, null, null) 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) await clickAndCheckLog(browser, 'dGitProvider:log', 'commit-message', null, null)
}, },
// context menu
// UNIT TESTING // UNIT TESTING
'Should activate solidityUnitTesting': async function (browser: NightwatchBrowser) { 'Should activate solidityUnitTesting': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'manager:activatePlugin', null, null, 'solidityUnitTesting') await clickAndCheckLog(browser, 'manager:activatePlugin', null, null, 'solidityUnitTesting')

Loading…
Cancel
Save