parent
caa696a0eb
commit
7bdf308a9a
@ -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 |
Loading…
Reference in new issue