blob: 2a94231d744076ebfbe0752ccb8276bcd1ba431b (
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*!
* Piwik - free/libre analytics platform
*
* row evolution screenshot tests
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("RowEvolution", function () {
const viewDataTableUrl = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=week&date=2012-02-09&"
+ "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5";
const ecommerceItemReportWidgetized = "?module=Widgetize&action=iframe&moduleToWidgetize=Goals&actionToWidgetize=getItemsSku&idGoal=ecommerceAbandonedCart"
+ "&idSite=1&period=year&date=2012-02-09&viewDataTable=ecommerceAbandonedCart&filter_limit=-1";
it('should load when icon clicked in ViewDataTable', async function() {
await page.goto(viewDataTableUrl);
const row = await page.waitForSelector('tbody tr:first-child');
await row.hover();
const icon = await page.waitForSelector('tbody tr:first-child a.actionRowEvolution');
await icon.click();
await page.waitForSelector('.ui-dialog');
await page.waitForNetworkIdle();
const dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('row_evolution');
});
it('should change the metric shown when a metric sparkline row is clicked', async function() {
await page.click('table.metrics tr[data-i="1"]');
await page.waitForNetworkIdle();
const dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('row_evolution_other_metric');
});
it('should show two serieses when a metric sparkline row is shift+clicked', async function() {
await page.keyboard.down('Shift');
await page.click('table.metrics tr[data-i="2"]', ['shift']);
await page.keyboard.up('Shift');
await page.waitForNetworkIdle();
const dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('row_evolution_multiple_series');
});
it('should load multi-row evolution correctly', async function() {
await page.evaluate(function() {
$('.rowevolution-startmulti').click();
});
await page.waitForFunction("$('.ui-dialog').length === 0");
const row = await page.waitForSelector('tbody tr:nth-child(2)');
await row.hover();
const icon = await page.waitForSelector('tbody tr:nth-child(2) a.actionRowEvolution');
await icon.click();
await page.waitForSelector('.ui-dialog');
await page.waitForNetworkIdle();
const dialog = await page.$('.ui-dialog');
await page.waitForNetworkIdle();
expect(await dialog.screenshot()).to.matchImage('multirow_evolution');
});
it('should display a different row evolution metric when the metric selection is changed', async function() {
await page.evaluate(function () {
$('select.multirowevoltion-metric').val($('select.multirowevoltion-metric option:nth-child(3)').val()).change();
});
await page.waitForSelector('.ui-dialog');
await page.waitForNetworkIdle();
const dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('multirow_evolution_other_metric');
});
it('should display row evolution for an ecommerce item report correctly', async function() {
await page.goto(ecommerceItemReportWidgetized);
const row = await page.waitForSelector('tbody tr:first-child');
await row.hover();
const icon = await page.waitForSelector('tbody tr:first-child a.actionRowEvolution');
await icon.click();
await page.waitForSelector('.ui-dialog');
await page.waitForNetworkIdle();
const dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('row_evolution_ecommerce_item');
});
});
|