blob: ac10abbebd30453209625ba3c704890f89ef130e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*!
* Piwik - free/libre analytics platform
*
* Dashboard screenshot tests.
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe('SingleMetricView', function () {
this.timeout(0);
var url = "?module=Widgetize&action=iframe&idSite=1&period=year&date=2012-08-09&moduleToWidgetize=Dashboard&"
+ "actionToWidgetize=index&idDashboard=5";
var rangeUrl = "?module=Widgetize&action=iframe&idSite=1&period=range&date=2012-08-07,2012-08-10&moduleToWidgetize=Dashboard&"
+ "actionToWidgetize=index&idDashboard=5";
it('should load correctly', async function () {
await page.goto(url);
await page.waitForNetworkIdle();
await page.click('.dashboard-manager a.title');
await (await page.jQuery('.widgetpreview-categorylist>li:contains(Goals)')).hover(); // have to mouse move twice... otherwise Live! will just be highlighted
await (await page.jQuery('.widgetpreview-categorylist > li:contains(Generic)')).hover();
await (await page.jQuery('.widgetpreview-widgetlist li:contains(Metric)')).hover();
await (await page.jQuery('.widgetpreview-widgetlist li:contains(Metric)')).click();
var elem = await page.waitForSelector('#widgetCoreVisualizationssingleMetricViewcolumn');
await page.waitForNetworkIdle();
await page.waitFor(250);
expect(await elem.screenshot()).to.matchImage('loaded');
});
it('should handle formatted metrics properly', async function () {
await page.evaluate(() => {
$('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn .jqplot-seriespicker').trigger('mouseenter');
});
await page.webpage.evaluate(function(){
$('#dashboardWidgetsArea .jqplot-seriespicker-popover label:contains(Revenue)').click();
});
await page.waitForNetworkIdle();
await page.waitFor(250);
var elem = await page.waitForSelector('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn');
expect(await elem.screenshot()).to.matchImage('formatted_metric');
});
it('should handle individual goal metrics properly', async function () {
await page.evaluate(function(){
$('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn .jqplot-seriespicker').last().trigger('mouseenter');
});
await page.waitFor(250);
await page.evaluate(function(){
$('#dashboardWidgetsArea .jqplot-seriespicker-popover label:contains(_x)').click()
});
await page.waitForNetworkIdle();
await page.waitFor(250);
var elem = await page.$('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn');
expect(await elem.screenshot()).to.matchImage('goal_metric');
});
it('should handle range periods correctly', async function () {
await page.goto(rangeUrl);
await page.evaluate(function(){
$('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn .jqplot-seriespicker').trigger('mouseenter');
});
await page.waitFor(250);
await page.evaluate(function(){
$('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn .jqplot-seriespicker-popover label:contains(Revenue)').click()
});
await page.waitForNetworkIdle();
await page.waitFor(250);
var elem = await page.$('#dashboardWidgetsArea #widgetCoreVisualizationssingleMetricViewcolumn');
expect(await elem.screenshot()).to.matchImage('range');
});
});
|