diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2016-10-26 00:11:06 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2016-10-26 00:11:06 +0300 |
commit | 0088cd42b4a265420fca94b6ad57a686e9cde02d (patch) | |
tree | ddc09aad773bd7d28a41c88bc549f35bf0dc416a | |
parent | af9906ab2ed2557e0b6be2dd00fbfcbe1930d6db (diff) |
Fix plugins page does not work when marketplace is disabled (#10783)
33 files changed, 157 insertions, 52 deletions
diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php index fef5679773..c3220e99f5 100644 --- a/plugins/CorePluginsAdmin/Controller.php +++ b/plugins/CorePluginsAdmin/Controller.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\CorePluginsAdmin; use Exception; use Piwik\API\Request; use Piwik\Common; +use Piwik\Container\StaticContainer; use Piwik\Exception\MissingFilePermissionException; use Piwik\Filechecks; use Piwik\Filesystem; @@ -54,11 +55,24 @@ class Controller extends Plugin\ControllerAdmin */ private $pluginManager; - public function __construct(Translator $translator, PluginInstaller $pluginInstaller, Plugins $marketplacePlugins) + /** + * Controller constructor. + * @param Translator $translator + * @param PluginInstaller $pluginInstaller + * @param Plugins $marketplacePlugins + */ + public function __construct(Translator $translator, PluginInstaller $pluginInstaller, $marketplacePlugins = null) { $this->translator = $translator; $this->pluginInstaller = $pluginInstaller; - $this->marketplacePlugins = $marketplacePlugins; + + if (!empty($marketplacePlugins)) { + $this->marketplacePlugins = $marketplacePlugins; + } elseif (Marketplace::isMarketplaceEnabled()) { + // we load it manually as marketplace might not be loaded + $this->marketplacePlugins = StaticContainer::get('Piwik\Plugins\Marketplace\Plugins'); + } + $this->pluginManager = Plugin\Manager::getInstance(); parent::__construct(); diff --git a/plugins/Marketplace/Plugins.php b/plugins/Marketplace/Plugins.php index b3221d6114..1e412adfcc 100644 --- a/plugins/Marketplace/Plugins.php +++ b/plugins/Marketplace/Plugins.php @@ -40,6 +40,12 @@ class Plugins */ private $pluginManager; + /** + * @internal for tests only + * @var array + */ + private $activatedPluginNames = array(); + private $pluginsHavingUpdateCache = null; public function __construct(Api\Client $marketplaceClient, Consumer $consumer, Advertising $advertising) @@ -192,14 +198,43 @@ class Plugins return $pluginsHavingUpdate; } + /** + * for tests only + * @param array $pluginNames + * @internal + * @ignore + */ + public function setActivatedPluginNames($pluginNames) + { + $this->activatedPluginNames = $pluginNames; + } + + private function isPluginActivated($pluginName) + { + if (in_array($pluginName, $this->activatedPluginNames)) { + return true; + } + + return $this->pluginManager->isPluginActivated($pluginName); + } + + private function isPluginInstalled($pluginName) + { + if (in_array($pluginName, $this->activatedPluginNames)) { + return true; + } + + return $this->pluginManager->isPluginInstalled($pluginName); + } + private function enrichPluginInformation($plugin) { if (empty($plugin)) { return $plugin; } - $plugin['isInstalled'] = $this->pluginManager->isPluginInstalled($plugin['name']); - $plugin['isActivated'] = $this->pluginManager->isPluginActivated($plugin['name']); + $plugin['isInstalled'] = $this->isPluginInstalled($plugin['name']); + $plugin['isActivated'] = $this->isPluginActivated($plugin['name']); $plugin['isInvalid'] = $this->pluginManager->isPluginThirdPartyAndBogus($plugin['name']); $plugin['canBeUpdated'] = $plugin['isInstalled'] && $this->hasPluginUpdate($plugin); $plugin['lastUpdated'] = $this->toShortDate($plugin['lastUpdated']); diff --git a/plugins/Marketplace/config/test.php b/plugins/Marketplace/config/test.php index 74968f8479..8c21be15f8 100644 --- a/plugins/Marketplace/config/test.php +++ b/plugins/Marketplace/config/test.php @@ -40,10 +40,17 @@ return array( return $consumer; }, - 'Piwik\Plugins\Marketplace\Plugins' => DI\decorate(function ($previous) { + 'Piwik\Plugins\Marketplace\Plugins' => DI\decorate(function ($previous, ContainerInterface $c) { /** @var \Piwik\Plugins\Marketplace\Plugins $previous */ $previous->setPluginsHavingUpdateCache(null); + $pluginNames = $c->get('test.vars.mockMarketplaceAssumePluginNamesActivated'); + + if (!empty($pluginNames)) { + /** @var \Piwik\Plugins\Marketplace\Plugins $previous */ + $previous->setActivatedPluginNames($pluginNames); + } + return $previous; }), 'Piwik\Plugins\Marketplace\Api\Client' => DI\decorate(function ($previous) { diff --git a/plugins/Marketplace/tests/System/Api/ClientTest.php b/plugins/Marketplace/tests/System/Api/ClientTest.php index eaab88fb52..5143753356 100644 --- a/plugins/Marketplace/tests/System/Api/ClientTest.php +++ b/plugins/Marketplace/tests/System/Api/ClientTest.php @@ -94,7 +94,7 @@ class ClientTest extends SystemTestCase $this->assertNotEmpty($plugin['versions']); $lastVersion = $plugin['versions'][count($plugin['versions']) - 1]; - $this->assertEquals(array('name', 'release', 'requires','readme', 'numDownloads', 'license', 'repositoryChangelogUrl', 'readmeHtml', 'download'), array_keys($lastVersion)); + $this->assertEquals(array('name', 'release', 'requires', 'numDownloads', 'license', 'repositoryChangelogUrl', 'readmeHtml', 'download'), array_keys($lastVersion)); $this->assertNotEmpty($lastVersion['download']); } diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_exceeded_license_multiUserEnvironment.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_exceeded_license_multiUserEnvironment.png index 10369ad158..7369341bdf 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_exceeded_license_multiUserEnvironment.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_exceeded_license_multiUserEnvironment.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e92a53a13da9de82f564a8d6b6e209bc025a6b8b5277f40d8aaabd666db21515 -size 37703 +oid sha256:c4e25353e338bb6f405764e67855476e966ad4bf8d424ae4da338417a5a9a47b +size 38661 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_exceeded_license_superuser.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_exceeded_license_superuser.png index 10369ad158..7369341bdf 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_exceeded_license_superuser.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_exceeded_license_superuser.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e92a53a13da9de82f564a8d6b6e209bc025a6b8b5277f40d8aaabd666db21515 -size 37703 +oid sha256:c4e25353e338bb6f405764e67855476e966ad4bf8d424ae4da338417a5a9a47b +size 38661 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_multiUserEnvironment.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_multiUserEnvironment.png new file mode 100644 index 0000000000..16cdc2677d --- /dev/null +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_multiUserEnvironment.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00b296e7a77c860f88a338c419a822a193d8d10aae58fa03437d8fb7c8ddf258 +size 40327 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_superuser.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_superuser.png new file mode 100644 index 0000000000..e05d346526 --- /dev/null +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_superuser.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:120639f6d76af1791c1e5f57a4135f53737765ee3d7965736f0b7fe0276a437f +size 28959 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_user.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_user.png new file mode 100644 index 0000000000..d1f06267b9 --- /dev/null +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_user.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17dbcde4b4c0f6c0cb2eaf3828a2393ddc15c493b967425cb8d92d00930c3ca4 +size 28263 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_user_installed.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_user_installed.png new file mode 100644 index 0000000000..d1f06267b9 --- /dev/null +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_expired_license_user_installed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17dbcde4b4c0f6c0cb2eaf3828a2393ddc15c493b967425cb8d92d00930c3ca4 +size 28263 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_multiUserEnvironment_installed.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_multiUserEnvironment_installed.png new file mode 100644 index 0000000000..16cdc2677d --- /dev/null +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_multiUserEnvironment_installed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00b296e7a77c860f88a338c419a822a193d8d10aae58fa03437d8fb7c8ddf258 +size 40327 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_superuser_installed.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_superuser_installed.png new file mode 100644 index 0000000000..e05d346526 --- /dev/null +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_superuser_installed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:120639f6d76af1791c1e5f57a4135f53737765ee3d7965736f0b7fe0276a437f +size 28959 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_user_installed.png b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_user_installed.png new file mode 100644 index 0000000000..d1f06267b9 --- /dev/null +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugin_details_valid_license_user_installed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17dbcde4b4c0f6c0cb2eaf3828a2393ddc15c493b967425cb8d92d00930c3ca4 +size 28263 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_multiUserEnvironment.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_multiUserEnvironment.png index 9a8dc7ef65..91e3c17176 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_multiUserEnvironment.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_multiUserEnvironment.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17177c8f2d1cd7f933084af6a3ab5da6e250799a003e0d46b7a9fc8ce62a8a00 -size 38020 +oid sha256:42359065b1c469f7fcf429574359a1cb506c3128e597f42c34a4611e1bc6caa7 +size 35928 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_superuser.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_superuser.png index 9a8dc7ef65..91e3c17176 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_superuser.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_superuser.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17177c8f2d1cd7f933084af6a3ab5da6e250799a003e0d46b7a9fc8ce62a8a00 -size 38020 +oid sha256:42359065b1c469f7fcf429574359a1cb506c3128e597f42c34a4611e1bc6caa7 +size 35928 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_user.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_user.png index ce059ffed8..c5ad71d864 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_user.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_no_license_user.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7f9f2b4c93f7d090d23980407f90b85985a13c15cc1464038b334af373e59304 -size 37968 +oid sha256:905cdd0c0197467bebecbd92137d84ac7baef86f88c6497f721591245cff49b8 +size 35919 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_multiUserEnvironment.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_multiUserEnvironment.png index b62caf5a3c..8287ef4831 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_multiUserEnvironment.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_multiUserEnvironment.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d4717d75163730ea5a05a573135ad83214a3f8b14c5bef04df4b032732e2117 -size 42258 +oid sha256:483e5b141eae0f5963f7941a3fc3bb8d20be0376835b4048e549f4bb7b7ea8f5 +size 39805 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_superuser.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_superuser.png index b62caf5a3c..8287ef4831 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_superuser.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_superuser.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d4717d75163730ea5a05a573135ad83214a3f8b14c5bef04df4b032732e2117 -size 42258 +oid sha256:483e5b141eae0f5963f7941a3fc3bb8d20be0376835b4048e549f4bb7b7ea8f5 +size 39805 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_user.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_user.png index 1722c030fb..159b79c347 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_user.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_exceeded_license_user.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b0784f2f08b5f2e44c361d45631c9ab0871934825770fa80e5be8f41b1f678cf -size 31928 +oid sha256:1a54756526b7a03bdecee87c2b5b90cd2dab943060bac16f716aeb34c8d8f215 +size 29735 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_multiUserEnvironment.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_multiUserEnvironment.png index b55947456b..edfa5013f5 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_multiUserEnvironment.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_multiUserEnvironment.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c01bbd4cc52effcd42d85353cdff676a0e2b00dc5deff57f90211713850efbe -size 45160 +oid sha256:c9c273ea2c602d22a2934d5fec683cd7ed0310cc9ca18ccb2d4ca076b5ef6a79 +size 43019 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_superuser.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_superuser.png index 89c3f6e266..c6ec801aac 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_superuser.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_superuser.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c020c01bbd690e363c1bbb76e78a03c6138a31680d79de08626282fba3944e2e -size 44394 +oid sha256:a0281182e3aa74aa7a7871a27b17525cb46f9be82cffd6ef765ef3e1c0149cfe +size 42273 diff --git a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_user.png b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_user.png index 1863ec9e22..8dd2e07aad 100644 --- a/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_user.png +++ b/tests/UI/expected-screenshots/Marketplace_paid_plugins_with_license_user.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d6f7df8b72e622af99ddd227a45272a908d5374eb1a118f18ee7a4f26423f591 -size 33478 +oid sha256:982bb461683c3e9eb784c6988ff64de52389e563f5e32f5d0a0186a51bc2b9ec +size 31295 diff --git a/tests/UI/expected-screenshots/Marketplace_superuser_enable_plugins_admin.png b/tests/UI/expected-screenshots/Marketplace_superuser_enable_plugins_admin.png index 02963b2ddd..8b85592528 100644 --- a/tests/UI/expected-screenshots/Marketplace_superuser_enable_plugins_admin.png +++ b/tests/UI/expected-screenshots/Marketplace_superuser_enable_plugins_admin.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:793b2662ad94ebcd6bf45e6d186d58f4aabd848bb1346b5fbb3cd5cffce8996e -size 536593 +oid sha256:f6d1c72cb081c9354e089c2e0ac32674105aaaa5555374733d545a3d979acfd4 +size 534497 diff --git a/tests/UI/expected-screenshots/Marketplace_superuser_enable_plugins_admin_with_multiserver_enabled.png b/tests/UI/expected-screenshots/Marketplace_superuser_enable_plugins_admin_with_multiserver_enabled.png index 0545f298c5..eae6375869 100644 --- a/tests/UI/expected-screenshots/Marketplace_superuser_enable_plugins_admin_with_multiserver_enabled.png +++ b/tests/UI/expected-screenshots/Marketplace_superuser_enable_plugins_admin_with_multiserver_enabled.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b7c88148ac19208d6a7f679a55151f208ece3ef18f62ad009a543e50e9cba0b -size 570607 +oid sha256:7f53b7bc15bdb75b0bdbe35e2b086a2d88730e85a05004d06ca79ed7fc779094 +size 568467 diff --git a/tests/UI/expected-screenshots/Marketplace_superuser_invalid_license_key_entered.png b/tests/UI/expected-screenshots/Marketplace_superuser_invalid_license_key_entered.png index f3f3deac20..cb80f7f546 100644 --- a/tests/UI/expected-screenshots/Marketplace_superuser_invalid_license_key_entered.png +++ b/tests/UI/expected-screenshots/Marketplace_superuser_invalid_license_key_entered.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4846286f6412ea7a73ae04c428ee67789f3298069ae8c553fdafb4ef3a35ce8a -size 546693 +oid sha256:ee7bfed3065ac2474cc443a3f4ddf86980f2b7df52a256c3b9907ccc06efe87d +size 544547 diff --git a/tests/UI/expected-screenshots/Marketplace_superuser_remove_license_key_confirmed.png b/tests/UI/expected-screenshots/Marketplace_superuser_remove_license_key_confirmed.png index 95792c753c..9007c733ce 100644 --- a/tests/UI/expected-screenshots/Marketplace_superuser_remove_license_key_confirmed.png +++ b/tests/UI/expected-screenshots/Marketplace_superuser_remove_license_key_confirmed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:66cb7c2e38b2a8834a9f83c96e066d333b8d19d703783bc195d761de709ec84b -size 543444 +oid sha256:af46c50cc1e309d4146eb8d338bac047b9ec83c0ec6b29617c80200d0e8105ad +size 541301 diff --git a/tests/UI/expected-screenshots/Marketplace_superuser_valid_license_key_entered.png b/tests/UI/expected-screenshots/Marketplace_superuser_valid_license_key_entered.png index d18f9b0a2e..254aa2508f 100644 --- a/tests/UI/expected-screenshots/Marketplace_superuser_valid_license_key_entered.png +++ b/tests/UI/expected-screenshots/Marketplace_superuser_valid_license_key_entered.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3bbcdfbf8e4fe94b952e5df91abb8bf1dde73a3c3bc241e9db308305c0cdfec -size 548858 +oid sha256:3ae651f854b0226952102f8f0d801748c69bce735189e06aa3fbbb56d4bcee9c +size 546719 diff --git a/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_multiUserEnvironment.png b/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_multiUserEnvironment.png index a50732ecb7..6ebbcabe95 100644 --- a/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_multiUserEnvironment.png +++ b/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_multiUserEnvironment.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd8a8e709ef5db4aa57f264d2392123a412d9e567ddeb51dae5787f24750df0b -size 104836 +oid sha256:3cff46eccc2c9967f18f572fc72adef8113f6ef257e47142ac51f3c174244589 +size 102671 diff --git a/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_superuser.png b/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_superuser.png index 64ae36f54a..b901a5017f 100644 --- a/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_superuser.png +++ b/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_superuser.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6cccf14adcd33680ed3037569d1ea7236632f2a69aa943bd2fbb460ce9b642e1 -size 100307 +oid sha256:297eb7e1566c93ea946f483edec453574191c973fd06bada77782721a5c51fab +size 98166 diff --git a/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_user.png b/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_user.png index 9c6e3e7561..092aab7030 100644 --- a/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_user.png +++ b/tests/UI/expected-screenshots/Marketplace_themes_with_valid_license_user.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:103c3c83143f846a8df8559287355fff3b8ddcaf4949e16d9b4b527c8ecf099b -size 87961 +oid sha256:9f1e50d455b3f128ed5b48e3506b2a17dba356008b7ea744aaafa400e6e6067d +size 85824 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png index 382645e54e..8ca3465c0b 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ff28a2329894994a87925acff3e3533c2b1f75c02e169644292f84d72f7a06ae -size 1796972 +oid sha256:c669eec5d8bded3daa7f7e74fc5ed7e770ce66f917ad98a7357da36df09249ba +size 1792125 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png b/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png index 37233323d5..677e67168d 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e50ef290867d15776dc31f631749cdbb1cff7e28c0dd3073165b4ad0c7eface2 -size 2520612 +oid sha256:a7ece1049d6629bfb56c426266d854b107887eb5b63dd14b168d9df78e207343 +size 2523071 diff --git a/tests/UI/specs/Marketplace_spec.js b/tests/UI/specs/Marketplace_spec.js index df9b31203c..dfce2d0202 100644 --- a/tests/UI/specs/Marketplace_spec.js +++ b/tests/UI/specs/Marketplace_spec.js @@ -52,6 +52,12 @@ describe("Marketplace", function () { captureSelector(done, screenshotName, test, '.ui-dialog:visible'); } + function assumePaidPluginsActivated() + { + testEnvironment.mockMarketplaceAssumePluginNamesActivated = ['CustomPlugin1','CustomPlugin2','PaidPlugin1','PaidPlugin2']; + testEnvironment.save(); + } + function setEnvironment(mode, consumer) { if (mode === 'user') { @@ -106,6 +112,7 @@ describe("Marketplace", function () { it(mode + ' for a user with exceeded license key should be able to open paid plugins', function (done) { setEnvironment(mode, exceededLicense); + assumePaidPluginsActivated(); captureMarketplace(done, 'paid_plugins_with_exceeded_license_' + mode, function (page) { page.load(paidPluginsUrl); @@ -133,6 +140,7 @@ describe("Marketplace", function () { setEnvironment(mode, noLicense); captureWithDialog(done, 'paid_plugin_details_no_license_' + mode, function (page) { + assumePaidPluginsActivated(); var isFree = false; loadPluginDetailPage(page, 'PaidPlugin1', isFree); }); @@ -148,11 +156,33 @@ describe("Marketplace", function () { }); it('should show paid plugin details when having valid license', function (done) { + setEnvironment(mode, validLicense); + + captureWithDialog(done, 'paid_plugin_details_valid_license_' + mode + '_installed', function (page) { + assumePaidPluginsActivated(); + var isFree = false; + loadPluginDetailPage(page, 'PaidPlugin1', isFree); + }); + }); + + it('should show paid plugin details when having expired license', function (done) { + setEnvironment(mode, expiredLicense); + + captureWithDialog(done, 'paid_plugin_details_expired_license_' + mode, function (page) { + setEnvironment(mode, expiredLicense); + assumePaidPluginsActivated(); + var isFree = false; + loadPluginDetailPage(page, 'PaidPlugin1', isFree); + }); + }); + + it('should show paid plugin details when having exceeded license', function (done) { setEnvironment(mode, exceededLicense); captureWithDialog(done, 'paid_plugin_details_exceeded_license_' + mode, function (page) { + assumePaidPluginsActivated(); var isFree = false; - loadPluginDetailPage(page, 'PaidPlugin1', expiredLicense); + loadPluginDetailPage(page, 'PaidPlugin1', isFree); }); }); }); @@ -252,9 +282,7 @@ describe("Marketplace", function () { // when there is no license it should not show a warning! as it could be due to network problems etc it('should show a warning if license is ' + consumer, function (done) { setEnvironment('superuser', consumer); - - testEnvironment.mockMarketplaceAssumePluginNamesActivated = ['CustomPlugin1','CustomPlugin2','PaidPlugin1','PaidPlugin2']; - testEnvironment.save(); + assumePaidPluginsActivated(); captureSelector(done, 'notification_plugincheck_' + consumer, function (page) { page.load('?module=UsersManager&action=index'); |