Added Tests for plugin manager

pull/1/head
ioedeveloper 5 years ago
parent e3fc0fde9b
commit 2e47183b40
  1. 8
      src/app/components/plugin-manager-settings.js
  2. 2
      src/app/ui/modaldialog.js
  3. 8
      src/app/ui/persmission-handler.js
  4. 46
      test-browser/tests/plugin.js

@ -89,9 +89,9 @@ export class PluginManagerSettings {
<div class="form-group ${css.permissionKey}">
<div class="${css.checkbox}">
${checkbox}
<label for="permission-${name}">Allow plugin ${name} to write on ${key}</label>
<label for="permission-${name}" data-id="pluginManagerSettingsPermission${name}">Allow plugin ${name} to write on ${key}</label>
</div>
<i onclick="${() => this.clearPersmission(key, name)}" class="fa fa-trash-alt"></i>
<i onclick="${() => this.clearPersmission(key, name)}" class="fa fa-trash-alt" data-id="pluginManagerSettingsRemovePermission${name}"></i>
</div>`
}
@ -117,7 +117,7 @@ export class PluginManagerSettings {
? yo`<h4>No Permission requested yet.</h4>`
: yo`<h4>Current Permission settings</h4>`
return yo`<form class="${css.permissionForm}">
return yo`<form class="${css.permissionForm}" data-id="pluginManagerSettingsPermissionForm">
${title}
<hr/>
${permissions}
@ -127,7 +127,7 @@ export class PluginManagerSettings {
render () {
return yo`
<footer class="bg-light ${css.permissions} remix-bg-opacity">
<button onclick="${() => this.openDialog()}" class="btn btn-primary settings-button">Settings</button>
<button onclick="${() => this.openDialog()}" class="btn btn-primary settings-button" data-id="pluginManagerSettingsButton">Settings</button>
</footer>`
}

@ -130,7 +130,7 @@ module.exports = (title, content, ok, cancel, focusSelector, opts) => {
function html (opts) {
return yo`
<div id="modal-dialog" class="modal" tabindex="-1" role="dialog">
<div id="modal-dialog" data-id="modalDialogContainer" class="modal" tabindex="-1" role="dialog">
<div id="modal-background" class="modal-dialog" role="document">
<div class="modal-content ${css.modalContent} ${opts.class}">
<div class="modal-header">

@ -140,8 +140,8 @@ export class PermissionHandler {
: delete this.permissions[to.name][from.name]
}
const rememberSwitch = remember
? yo`<input type="checkbox" onchange="${switchMode}" checkbox class="custom-control-input" id="remember">`
: yo`<input type="checkbox" onchange="${switchMode}" class="custom-control-input" id="remember">`
? yo`<input type="checkbox" onchange="${switchMode}" checkbox class="custom-control-input" id="remember" data-id="permissionHandlerRememberChecked">`
: yo`<input type="checkbox" onchange="${switchMode}" class="custom-control-input" id="remember" data-id="permissionHandlerRememberUnchecked">`
const message = remember
? `"${fromName}" has changed and would like to access "${toName}"`
: `"${fromName}" would like to access "${toName}"`
@ -155,7 +155,7 @@ export class PermissionHandler {
</article>
<article>
<h4>${message} :</h4>
<h4 data-id="permissionHandlerMessage">${message} :</h4>
<h6>${fromName}</h6>
<p>${from.description || yo`<i>No description Provided</i>`}</p>
<h6>${toName} :</p>
@ -165,7 +165,7 @@ export class PermissionHandler {
<article class="${css.remember}">
<div class="custom-control custom-checkbox">
${rememberSwitch}
<label class="custom-control-label" for="remember">Remember this choice</label>
<label class="custom-control-label" for="remember" data-id="permissionHandlerRememberChoice">Remember this choice</label>
</div>
<button class="btn btn-sm" onclick="${_ => this.clear()}">Reset all Permissions</button>
</article>

@ -16,7 +16,7 @@ module.exports = {
},
'Should Search for plugins': function (browser) {
browser.waitForElementVisible('div[data-id="pluginManagerComponentPluginManager"]')
browser.waitForElementVisible('div[data-id="pluginManagerComponentPluginManager"]')
.click('input[data-id="pluginManagerComponentSearchInput"]')
.keys('debugger')
.waitForElementVisible('button[data-id="pluginManagerComponentActivateButtondebugger"]')
@ -31,10 +31,9 @@ module.exports = {
.clearValue('input[data-id="pluginManagerComponentSearchInput"]')
.click('input[data-id="pluginManagerComponentSearchInput"]')
.keys(browser.Keys.ENTER)
},
},
'Should activate plugins': function (browser) {
'Should activate plugins': function (browser) {
browser.waitForElementVisible('div[data-id="pluginManagerComponentPluginManager"]')
.click('div[data-id="pluginManagerComponentPluginManager"]')
.scrollAndClick('button[data-id="pluginManagerComponentActivateButtondebugger"]')
@ -43,6 +42,45 @@ module.exports = {
.waitForElementVisible('button[data-id="pluginManagerComponentDeactivateButtonudapp"]')
.scrollAndClick('button[data-id="pluginManagerComponentActivateButtonZoKrates"]')
.waitForElementVisible('button[data-id="pluginManagerComponentDeactivateButtonZoKrates"]')
},
'Should deactivate plugins': function (browser) {
browser.waitForElementVisible('div[data-id="pluginManagerComponentPluginManager"]')
.click('div[data-id="pluginManagerComponentPluginManager"]')
.scrollAndClick('button[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.waitForElementVisible('button[data-id="pluginManagerComponentActivateButtondebugger"]')
.scrollAndClick('button[data-id="pluginManagerComponentDeactivateButtonudapp"]')
.waitForElementVisible('button[data-id="pluginManagerComponentActivateButtonudapp"]')
},
'Grant plugin permission (ZOKRATES)': function (browser) {
browser.waitForElementVisible('div[data-id="pluginManagerComponentPluginManager"]')
.click('button[data-id="pluginManagerSettingsButton"]')
.waitForElementVisible('form[data-id="pluginManagerSettingsPermissionForm"]')
.assert.containsText('form[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet')
.modalFooterOKClick()
.click('div[data-id="verticalIconsFileExplorerIcons"]')
.switchFile('browser/3_Ballot.sol')
.click('div[plugin="ZoKrates"]')
.pause(5000)
.frame(0)
.useXpath().click("//span[text()='Compile']")
.frameParent()
.useCss().waitForElementVisible('div[data-id="modalDialogContainer"]')
.assert.containsText('h4[data-id="permissionHandlerMessage"]', 'ZOKRATES" WOULD LIKE TO ACCESS "FILE MANAGER" :')
.waitForElementVisible('label[data-id="permissionHandlerRememberChoice"]')
.click('label[data-id="permissionHandlerRememberChoice"]')
.modalFooterOKClick()
},
'Revert plugin permission (ZOKRATES)': function (browser) {
browser.waitForElementVisible('div[data-id="verticalIconsSettingsIcons"]')
.click('div[data-id="verticalIconsSettingsIcons"]')
.waitForElementVisible('button[data-id="pluginManagerSettingsButton"]')
.click('button[data-id="pluginManagerSettingsButton"]')
.waitForElementVisible('div[data-id="modalDialogContainer"]')
.click('i[data-id="pluginManagerSettingsRemovePermissionZoKrates"]')
.modalFooterOKClick()
.end()
},

Loading…
Cancel
Save