diff --git a/plugins/SitesManager/templates/index.html b/plugins/SitesManager/templates/index.html index 86041b25e4e1713e988fe0198f4a2c6d328c8fd6..cfdca4a97036b5e2b240c3494d0c539dac4b8728 100644 --- a/plugins/SitesManager/templates/index.html +++ b/plugins/SitesManager/templates/index.html @@ -1,6 +1,6 @@ <div ng-controller="SitesManagerController" class="SitesManager"> - <div ng-include="'plugins/SitesManager/templates/sites-manager-header.html?cb=' + cacheBuster"></div> + <div ng-include="'plugins/SitesManager/templates/sites-manager-header.html?cb=' + cacheBuster" class="sites-manager-header"></div> <div ng-include="'plugins/SitesManager/templates/loading.html?cb=' + cacheBuster"></div> diff --git a/plugins/SitesManager/tests/Fixtures/ManySites.php b/plugins/SitesManager/tests/Fixtures/ManySites.php index fe3d2fd32524a9faeba88f92df2abc1ede8554a5..0a06e1067269795ad45c388736b6d1245d6d07ca 100644 --- a/plugins/SitesManager/tests/Fixtures/ManySites.php +++ b/plugins/SitesManager/tests/Fixtures/ManySites.php @@ -8,6 +8,8 @@ namespace Piwik\Plugins\SitesManager\tests\Fixtures; use Piwik\Plugin; +use Piwik\Plugins\MobileAppMeasurable; +use Piwik\Plugins\WebsiteMeasurable; use Piwik\Tests\Framework\Fixture; /** @@ -27,7 +29,15 @@ class ManySites extends Fixture $siteName = 'Site ' . $idSite; } - self::createWebsite($this->dateTime, $ecommerce = 0, $siteName); + $type = null; + if ($idSite === 2) { + $type = MobileAppMeasurable\Type::ID; + } + + self::createWebsite($this->dateTime, $ecommerce = 0, $siteName, + $siteUrl = false, + $siteSearch = 1, $searchKeywordParameters = null, + $searchCategoryParameters = null, $timezone = null, $type); } } } diff --git a/tests/UI/specs/MeasurableManager_spec.js b/tests/UI/specs/MeasurableManager_spec.js new file mode 100644 index 0000000000000000000000000000000000000000..0be06a9ac8793c59be19185f224a87a4361cb968 --- /dev/null +++ b/tests/UI/specs/MeasurableManager_spec.js @@ -0,0 +1,56 @@ +/*! + * Piwik - free/libre analytics platform + * + * Site selector screenshot tests. + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +describe("MeasurableManager", function () { + this.timeout(0); + this.fixture = "Piwik\\Plugins\\SitesManager\\tests\\Fixtures\\ManySites"; + + var url = "?module=SitesManager&action=index&idSite=1&period=day&date=yesterday&showaddsite=false"; + + before(function () { + testEnvironment.pluginsToLoad = ['MobileAppMeasurable']; + + testEnvironment.save(); + }); + + function assertScreenshotEquals(screenshotName, done, test) + { + expect.screenshot(screenshotName).to.be.captureSelector('.sitesManagerList,.sitesButtonBar,.sites-manager-header', test, done); + } + + it("should load correctly and should not use SitesManager wording as another type is enabled", function (done) { + assertScreenshotEquals("loaded", done, function (page) { + page.load(url); + page.evaluate(function () { + $('.ui-inline-help:contains(UTC time is)').hide(); + }); + }); + }); + + it("should use measurable wording in menu", function (done) { + var selector = '.Menu-tabList *:contains(Administration):first'; + expect.screenshot('measurable_menu_item').to.be.captureSelector(selector, function (page) { + + }, done); + }); + + it("should show selection of available types when adding a type", function (done) { + assertScreenshotEquals("add_new_dialog", done, function (page) { + page.click('.SitesManager .addSite:first'); + }); + }); + + it("should load mobile app specific fields", function (done) { + assertScreenshotEquals("add_measurable_view", done, function (page) { + page.click('.ui-dialog-content button:contains(Mobile App)'); + page.wait(250); + }); + }); + +}); \ No newline at end of file