Skip to content
Extraits de code Groupes Projets
Valider 7f0fdeae rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

fix many ui tests

parent 3b37fe84
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 118 ajouts et 60 suppressions
......@@ -20,9 +20,13 @@
* <h2 piwik-enriched-headline edit-url="index.php?module=Foo&action=bar&id=4">All Websites Dashboard</h2>
* -> makes the headline clickable linking to the specified url
*
* <h2 piwik-enriched-headline inline-help="inlineHelp">Pages report</h2>
* -> inlineHelp specified via a attribute shows help icon on headline hover
*
* <h2 piwik-enriched-headline>All Websites Dashboard
* <div class="inlineHelp">My <strong>inline help</strong></div>
* </h2>
* -> alternative definition for inline help
* -> shows help icon to display inline help on click. Note: You can combine inlinehelp and help-url
*/
(function () {
......@@ -33,7 +37,8 @@
function piwikEnrichedHeadline($document, piwik, $filter){
var defaults = {
helpUrl: '',
editUrl: ''
editUrl: '',
inlineHelp: ''
};
return {
......@@ -42,7 +47,8 @@
scope: {
helpUrl: '@',
editUrl: '@',
featureName: '@'
featureName: '@',
inlineHelp: '@'
},
templateUrl: 'plugins/CoreHome/angularjs/enrichedheadline/enrichedheadline.directive.html?cb=' + piwik.cacheBuster,
compile: function (element, attrs) {
......@@ -52,19 +58,16 @@
}
return function (scope, element, attrs) {
if (!scope.inlineHelp) {
var helpNode = $('[ng-transclude] .inlineHelp', element);
if ((!helpNode || !helpNode.length) && element.next()) {
// hack for reports :(
helpNode = element.next().find('.reportDocumentation');
}
var helpNode = $('[ng-transclude] .inlineHelp', element);
if (helpNode && helpNode.length) {
if ($.trim(helpNode.text())) {
scope.inlineHelp = $.trim(helpNode.html());
if (helpNode && helpNode.length) {
if ($.trim(helpNode.text())) {
scope.inlineHelp = $.trim(helpNode.html());
}
helpNode.remove();
}
helpNode.remove();
}
if (!attrs.featureName) {
......
......@@ -26,6 +26,18 @@
currentCategory = category;
currentSubcategory = subcategory;
if (category === 'Dashboard_Dashboard' && $.isNumeric(subcategory) && $('[piwik-dashboard]').length) {
// hack to make loading of dashboards faster since all the information is already there in the
// piwik-dashboard widget, we can let the piwik-dashboard widget render the page. We need to find
// a proper solution for this. A workaround for now could be an event or something to let other
// components render a specific page.
$scope.loading = false;
var element = $('[piwik-dashboard]');
var scope = angular.element(element).scope();
scope.fetchDashboard(parseInt(subcategory, 10));
return;
}
pageModel.fetchPage(category, subcategory).then(function () {
$scope.hasNoPage = !pageModel.page;
$scope.loading = false;
......
......@@ -7,6 +7,7 @@
<h2 ng-if="!widget.parameters.widget && widget.name && !widgetized"
piwik-enriched-headline
ng-class="{'noTopMargin': widget.isFirstInPage}"
inline-help="{{widget.documentation}}"
feature-name="{{widget.name}}">{{widget.name}}</h2>
<h2 ng-if="widget.parameters.widget && widget.name && !widgetized">{{widget.name}}</h2>
......
......@@ -29,16 +29,15 @@
(function () {
angular.module('piwikApp').directive('piwikWidget', piwikWidget);
piwikWidget.$inject = ['piwik', 'piwikApi'];
piwikWidget.$inject = ['piwik', 'piwikApi', 'reportMetadataModel'];
function piwikWidget(piwik, piwikApi){
function piwikWidget(piwik, piwikApi, reportMetadataModel){
function findContainerWidget(containerId, scope) {
widgetsHelper.getAvailableWidgets(function (categorizedWidgets) {
angular.forEach(categorizedWidgets, function (widgets) {
angular.forEach(widgets, function (widget) {
if (widget && widget.isContainer && widget.parameters.containerId === containerId) {
widget = angular.copy(widget);
if (scope.widgetized) {
......@@ -57,6 +56,16 @@
});
}
function addReportDocumentationIfPossible(widget)
{
if (widget && widget.isReport && !widget.documentation) {
var report = reportMetadataModel.findReport(widget.module, widget.action);
if (report && report.documentation) {
widget.documentation = report.documentation;
}
}
}
function applyMiddleware(scope)
{
if (!scope.widget.middlewareParameters) {
......@@ -82,6 +91,7 @@
return function (scope, element, attrs, ngModel) {
if (scope.widget) {
addReportDocumentationIfPossible(scope.widget);
applyMiddleware(scope);
} else if (attrs.containerid) {
findContainerWidget(attrs.containerid, scope);
......
......@@ -12,6 +12,7 @@
{% endfor %}
{% if not isWidget %}
<br style="clear:left"/>
</div>
<div class="col-md-6">
{% endif %}
......@@ -22,6 +23,8 @@
{% endif %}
{% endfor %}
<br style="clear:left"/>
{% if not isWidget %}
</div>
</div>
......
......@@ -52,7 +52,10 @@
}
function fetchDashboard(dashboardId) {
$('#dashboardWidgetsArea').innerHTML ='';
var dashboardElement = $('#dashboardWidgetsArea');
dashboardElement.dashboard('destroyWidgets');
dashboardElement.empty();
globalAjaxQueue.abort();
var getDashboard = dashboardsModel.getDashboard(dashboardId);
var getLayout = dashboardsModel.getDashboardLayout(dashboardId);
......@@ -87,9 +90,10 @@
fetchDashboard(scope.dashboardid);
function onLocationChange(event, url1, url2)
function onLocationChange(event, newUrl, oldUrl)
{
if (url1 !== url2) {
if (newUrl !== oldUrl && newUrl.indexOf('category=Dashboard_Dashboard') === -1) {
// we remove the dashboard only if we no longer show a dashboard.
clearDashboard();
}
}
......
......@@ -27,6 +27,7 @@ function createDashboard() {
function (id) {
angular.element(document).injector().invoke(function ($location, reportingMenuModel, dashboardsModel) {
dashboardsModel.reloadAllDashboards().then(function () {
$('#dashboardWidgetsArea').dashboard('loadDashboard', id);
$('#dashboardWidgetsArea').dashboard('rebuildMenu');
});
......
......@@ -70,26 +70,32 @@
destroy: function () {
$(dashboardElement).remove();
dashboardElement = null;
var widgets = $('[widgetId]');
for (var i = 0; i < widgets.length; i++) {
$(widgets[i]).dashboardWidget('destroy');
}
destroyWidgets();
},
destroyWidgets: destroyWidgets,
/**
* Load dashboard with the given id
*
* @param {int} dashboardIdToLoad
*/
loadDashboard: function (dashboardIdToLoad) {
$(dashboardElement).empty();
dashboardName = '';
dashboardLayout = null;
dashboardId = dashboardIdToLoad;
var element = $('[piwik-dashboard]');
var scope = angular.element(element).scope();
scope.fetchDashboard(dashboardIdToLoad);
if (piwikHelper.isAngularRenderingThePage()) {
angular.element(document).injector().invoke(function ($location) {
$location.search('subcategory', '' + dashboardIdToLoad);
});
} else {
var element = $('[piwik-dashboard]');
var scope = angular.element(element).scope();
scope.fetchDashboard(dashboardIdToLoad);
}
return this;
},
......@@ -178,12 +184,30 @@
},
rebuildMenu: rebuildMenu,
/**
* Removes the current dashboard
*/
removeDashboard: function () {
removeDashboard();
if (dashboardId == 1) {
return; // dashboard with id 1 should never be deleted, as it is the default
}
var ajaxRequest = new ajaxHelper();
ajaxRequest.setLoadingElement();
ajaxRequest.addParams({
module: 'Dashboard',
action: 'removeDashboard',
idDashboard: dashboardId
}, 'get');
ajaxRequest.setCallback(
function () {
methods.loadDashboard.apply(this, [1]);
rebuildMenu();
}
);
ajaxRequest.withTokenInUrl();
ajaxRequest.setFormat('html');
ajaxRequest.send(true);
},
/**
......@@ -201,6 +225,14 @@
}
};
function destroyWidgets()
{
var widgets = $('[widgetId]');
for (var i = 0; i < widgets.length; i++) {
$(widgets[i]).dashboardWidget('destroy');
}
}
function removeNonExistingWidgets(availableWidgets, layout)
{
var existingModuleAction = {};
......@@ -490,7 +522,7 @@
*/
function rebuildMenu() {
if ($('[piwik-reporting-menu]').length) {
if (piwikHelper.isAngularRenderingThePage()) {
// dashboard in reporting page (regular Piwik UI)
angular.element(document).injector().invoke(function (reportingMenuModel) {
reportingMenuModel.reloadMenuItems();
......@@ -541,7 +573,6 @@
methods.loadDashboard.apply(_self, [idDashboard]);
$(this).closest('li').addClass('active');
});
};
......@@ -610,32 +641,6 @@
}
}
/**
* Removes the current dashboard
*/
function removeDashboard() {
if (dashboardId == 1) {
return; // dashboard with id 1 should never be deleted, as it is the default
}
var ajaxRequest = new ajaxHelper();
ajaxRequest.setLoadingElement();
ajaxRequest.addParams({
module: 'Dashboard',
action: 'removeDashboard',
idDashboard: dashboardId
}, 'get');
ajaxRequest.setCallback(
function () {
rebuildMenu();
methods.loadDashboard.apply(this, [1]);
}
);
ajaxRequest.withTokenInUrl();
ajaxRequest.setFormat('html');
ajaxRequest.send(true);
}
/**
* Make plugin methods available
*/
......
......@@ -121,7 +121,12 @@
var $widgetContent = $('.widgetContent', currentWidget);
$widgetContent.html(loadedContent);
piwikHelper.compileAngularComponents($widgetContent);
if (currentWidget.parents('body').size()) {
// there might be race conditions, eg widget might be just refreshed while whole dashboard is also
// removed from DOM
piwikHelper.compileAngularComponents($widgetContent);
}
$widgetContent.removeClass('loading');
$widgetContent.trigger('widget:create', [self]);
}
......
......@@ -131,6 +131,17 @@ var piwikHelper = {
return ($element.length && $element.hasClass('ng-isolate-scope'));
},
/**
* Detects whether angular is rendering the page. If so, the page will be reloaded automatically
* via angular as soon as it detects a $locationChange
*
* @returns {number|jQuery}
*/
isAngularRenderingThePage: function ()
{
return $('[piwik-reporting-page]').length;
},
/**
* Displays a Modal dialog. Text will be taken from the DOM node domSelector.
* Given callback handles will be mapped to the buttons having a role attriute
......
......@@ -142,7 +142,7 @@
<category>Visit</category>
<name>Device brand</name>
<segment>deviceBrand</segment>
<acceptedValues>3Q, Acer, Ainol, Airness, Alcatel, Allview, Altech UEC, Arnova, Amazon, Amoi, Apple, Archos, ARRIS, Airties, Asus, Avvio, Audiovox, Axxion, BBK, Becker, Bird, Beetel, Bmobile, Barnes &amp; Noble, BangOlufsen, BenQ, BenQ-Siemens, Blu, Boway, bq, Brondi, Bush, CUBOT, Carrefour, Captiva, Casio, Cat, Celkon, ConCorde, Changhong, Cherry Mobile, Cricket, Crosscall, Compal, CnM, Crius Mea, CreNova, Capitel, Compaq, Coolpad, Cowon, Cube, Coby Kyros, Danew, Datang, Denver, Desay, Dbtel, DoCoMo, Dicam, Dell, DMM, Doogee, Doov, Dopod, Dune HD, E-Boda, EBEST, Ericsson, ECS, Ezio, Elephone, Easypix, Energy Sistem, Ericy, Eton, eTouch, Evertek, Ezze, Fly, Foxconn, Fujitsu, Garmin-Asus, Gateway, Gemini, Gionee, Gigabyte, Gigaset, GOCLEVER, Goly, Google, Gradiente, Grundig, Haier, Hasee, Hisense, Hi-Level, Hosin, HP, HTC, Huawei, Humax, Hyrican, Hyundai, Ikea, iBall, i-Joy, iBerry, iKoMo, i-mate, iOcean, Infinix, Innostream, Inkti, Intex, i-mobile, INQ, Intek, Inverto, iTel, Jiayu, Jolla, Karbonn, KDDI, Kingsun, Konka, Komu, Koobee, K-Touch, KT-Tech, KOPO, Koridy, Kumai, Kyocera, Kazam, Lava, Lanix, LCT, Lenovo, Lenco, Le Pan, LG, Lingwin, Loewe, Logicom, Lexibook, Majestic, Manta Multimedia, Mobistel, Mecer, Medion, MEEG, Meizu, Metz, MEU, MicroMax, Mediacom, MediaTek, Mio, Mpman, Mofut, Motorola, Microsoft, MSI, Memup, Mitsubishi, MLLED, M.T.T., MyPhone, NEC, Netgear, NGM, Nintendo, Noain, Nokia, Nomi, Nikon, Newgen, Nexian, NextBook, Onda, OnePlus, OPPO, Orange, O2, Ouki, OUYA, Opsson, Panasonic, PEAQ, Philips, Polaroid, Palm, phoneOne, Pantech, Point of View, PolyPad, Pomp, Positivo, Prestigio, ProScan, PULID, Qilive, Qtek, QMobile, Quechua, Overmax, Oysters, Ramos, RCA Tablets, Readboy, Rikomagic, RIM, Roku, Rover, Samsung, Sega, Sony Ericsson, Sencor, Softbank, SFR, Sagem, Sharp, Siemens, Sendo, Skyworth, Smartfren, Sony, Spice, SuperSonic, Selevision, Sanyo, Symphony, Smart, Star, Storex, Stonex, SunVan, Sumvision, Tesla, TCL, Telit, ThL, TiPhone, Tecno Mobile, Tesco, TIANYU, Telefunken, Telenor, T-Mobile, Thomson, Tolino, Toplux, Toshiba, TechnoTrend, Trevi, Tunisie Telecom, Turbo-X, TVC, TechniSat, teXet, Unowhy, Uniscope, UTStarcom, Vastking, Videocon, Vertu, Vitelcom, VK Mobile, ViewSonic, Vestel, Vivo, Voto, Voxtel, Vodafone, Vizio, Videoweb, Walton, Web TV, WellcoM, Wexler, Wiko, Wolder, Wonu, Woxter, Xiaomi, Xolo, Unknown, Yarvik, Yuandao, Yusun, Ytone, Zeemi, Zonda, Zopo, ZTE</acceptedValues>
<acceptedValues>3Q, Acer, Ainol, Airness, Alcatel, Allview, Altech UEC, Arnova, Amazon, Amoi, Apple, Archos, ARRIS, Airties, Asus, Avvio, Audiovox, Axxion, BBK, Becker, Bird, Beetel, Bmobile, Barnes &amp; Noble, BangOlufsen, BenQ, BenQ-Siemens, Blu, Boway, bq, Brondi, Bush, CUBOT, Carrefour, Captiva, Casio, Cat, Celkon, ConCorde, Changhong, Cherry Mobile, Cricket, Crosscall, Compal, CnM, Crius Mea, CreNova, Capitel, Compaq, Coolpad, Cowon, Cube, Coby Kyros, Danew, Datang, Denver, Desay, Dbtel, DoCoMo, Dicam, Dell, DMM, Doogee, Doov, Dopod, Dune HD, E-Boda, EBEST, Ericsson, ECS, Ezio, Elephone, Easypix, Energy Sistem, Ericy, Eton, eTouch, Evertek, Ezze, Fly, Foxconn, Fujitsu, Garmin-Asus, Gateway, Gemini, Gionee, Gigabyte, Gigaset, GOCLEVER, Goly, Google, Gradiente, Grundig, Haier, Hasee, Hisense, Hi-Level, Hosin, HP, HTC, Huawei, Humax, Hyrican, Hyundai, Ikea, iBall, i-Joy, iBerry, iKoMo, i-mate, iOcean, iNew, Infinix, Innostream, Inkti, Intex, i-mobile, INQ, Intek, Inverto, iTel, Jiayu, Jolla, Karbonn, KDDI, Kingsun, Konka, Komu, Koobee, K-Touch, KT-Tech, KOPO, Koridy, Kumai, Kyocera, Kazam, Lava, Lanix, LCT, Lenovo, Lenco, Le Pan, LG, Lingwin, Loewe, Logicom, Lexibook, Majestic, Manta Multimedia, Mobistel, Mecer, Medion, MEEG, Meizu, Metz, MEU, MicroMax, Mediacom, MediaTek, Mio, Mpman, Mofut, Motorola, Microsoft, MSI, Memup, Mitsubishi, MLLED, M.T.T., MyPhone, NEC, Netgear, NGM, Nintendo, Noain, Nokia, Nomi, Nikon, Newgen, Nexian, NextBook, Onda, OnePlus, OPPO, Orange, O2, Ouki, OUYA, Opsson, Panasonic, PEAQ, Philips, Pioneer, Polaroid, Palm, phoneOne, Pantech, Point of View, PolyPad, Pomp, Positivo, Prestigio, ProScan, PULID, Qilive, Qtek, QMobile, Quechua, Overmax, Oysters, Ramos, RCA Tablets, Readboy, Rikomagic, RIM, Roku, Rover, Samsung, Sega, Sony Ericsson, Sencor, Softbank, SFR, Sagem, Sharp, Siemens, Sendo, Skyworth, Smartfren, Sony, Spice, SuperSonic, Selevision, Sanyo, Symphony, Smart, Star, Storex, Stonex, SunVan, Sumvision, Tesla, TCL, Telit, ThL, TiPhone, Tecno Mobile, Tesco, TIANYU, Telefunken, Telenor, T-Mobile, Thomson, Tolino, Toplux, Toshiba, TechnoTrend, Trevi, Tunisie Telecom, Turbo-X, TVC, TechniSat, teXet, Unowhy, Uniscope, UTStarcom, Vastking, Videocon, Vertu, Vitelcom, VK Mobile, ViewSonic, Vestel, Vivo, Voto, Voxtel, Vodafone, Vizio, Videoweb, Walton, Web TV, WellcoM, Wexler, Wiko, Wolder, Wonu, Woxter, Xiaomi, Xolo, Unknown, Yarvik, Yuandao, Yusun, Ytone, Zeemi, Zonda, Zopo, ZTE</acceptedValues>
</row>
<row>
<type>dimension</type>
......
Subproject commit 4513d00ca815838f3e749be13b62b568f4354036
Subproject commit 3a11316b302602779f3bbf1cd37fa140a9f6c2dc
......@@ -70,6 +70,8 @@ describe("Login", function () {
it("should send email when password reset form submitted", function (done) {
expect.screenshot("password_reset").to.be.capture(function (page) {
page.reload();
page.click("a#login_form_nav");
page.sendKeys("#reset_form_login", "superUserLogin");
page.sendKeys("#reset_form_password", "superUserPass2");
page.sendKeys("#reset_form_password_bis", "superUserPass2");
......
......@@ -51,6 +51,7 @@ describe("RowEvolution", function () {
page.evaluate(function () {
$('select.multirowevoltion-metric').val($('select.multirowevoltion-metric option:nth-child(3)').val()).change();
});
page.wait(1000);
}, done);
});
......
......@@ -43,7 +43,6 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
testEnvironment.save();
});
// dashboard tests
it("should load dashboard1 correctly", function (done) {
expect.screenshot("dashboard1").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) {
......@@ -567,7 +566,8 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
page.load("?" + generalParams + "&module=Widgetize&action=index");
page.mouseMove('.widgetpreview-categorylist>li:contains(Visitors)');
page.mouseMove('li[uniqueid="widgetVisitsSummarygetEvolutionGraphforceView1viewDataTablegraphEvolution"]');
page.mouseMove('.widgetpreview-widgetlist li:contains(Visits Over Time)');
page.click('.widgetpreview-widgetlist li:contains(Visits Over Time)');
page.evaluate(function () {
$('.formEmbedCode').each(function () {
var val = $(this).val();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter