From 3650155bd97bbd8fb7e60264cad03989a4449caa Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 21 Apr 2020 09:58:18 +0000 Subject: [PATCH] Test for plugin reload after webpage refresh --- test-browser/commands/getInstalledPlugins.js | 27 ++++++++++++++++++++ test-browser/tests/pluginManager.js | 17 ++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 test-browser/commands/getInstalledPlugins.js diff --git a/test-browser/commands/getInstalledPlugins.js b/test-browser/commands/getInstalledPlugins.js new file mode 100644 index 0000000000..b595bdaea4 --- /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 2dc5bc5720..f2ccd4bfcd 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