diff --git a/test-browser/commands/getInstalledPlugins.js b/test-browser/commands/getInstalledPlugins.js new file mode 100644 index 00000000000..b595bdaea4d --- /dev/null +++ b/test-browser/commands/getInstalledPlugins.js @@ -0,0 +1,27 @@ +const EventEmitter = require('events') + +class GetInstalledPlugins extends EventEmitter { + command (cb) { + const browser = this.api + + browser.waitForElementPresent('[plugin]:not([plugin=""]') + .perform((done) => { + browser.execute(() => { + const pluginNames = [] + const plugins = document.querySelectorAll('[plugin]:not([plugin=""]') + + plugins.forEach(plugin => { + pluginNames.push(plugin.getAttribute('plugin')) + }) + return pluginNames + }, [], (result) => { + done() + cb(result.value) + this.emit('complete') + }) + }) + return this + } +} + +module.exports = GetInstalledPlugins diff --git a/test-browser/tests/pluginManager.js b/test-browser/tests/pluginManager.js index 2dc5bc5720c..f2ccd4bfcd5 100644 --- a/test-browser/tests/pluginManager.js +++ b/test-browser/tests/pluginManager.js @@ -127,6 +127,23 @@ module.exports = { .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)') .pause(2000) .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Cannot create Plugin : This name has already been used') + }, + + 'Should load back installed plugins after reload': function (browser) { + browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') + .getInstalledPlugins((plugins) => { + browser.refresh() + .waitForElementVisible('*[data-id="remixIdeSidePanel"]') + .pause(3000) + .perform((done) => { + plugins.forEach(plugin => { + if (plugin !== testData.pluginName) { + browser.waitForElementVisible(`[plugin="${plugin}"`) + } + }) + done() + }) + }) .end() }, tearDown: sauce