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
|
/*!
* Matomo - free/libre analytics platform
*
* transitions screenshot tests
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("Transitions", function () {
this.timeout(0);
var generalParams = 'idSite=1&period=year&date=2012-08-09',
urlBase = 'module=CoreHome&action=index&' + generalParams;
async function selectValue(field, title)
{
await page.webpage.evaluate((field) => {
$(field + ' input.select-dropdown').click()
}, field);
await page.waitFor(500);
await page.webpage.evaluate((field, title) => {
$(field + ' .dropdown-content li:contains("' + title + '"):first').click()
}, field, title);
}
it('should load the transitions popup correctly for the page titles report', async function() {
await page.goto("?" + urlBase + "#?" + generalParams + "&category=General_Actions&subcategory=Actions_SubmenuPageTitles");
await (await page.jQuery('div.dataTable tbody tr:eq(2)')).hover();
await (await page.jQuery('a.actionTransitions:visible')).hover(); // necessary to get popover to display
await (await page.jQuery('a.actionTransitions:visible')).click();
await page.waitForNetworkIdle();
await page.waitFor('.ui-dialog', { visible: true });
expect(await page.screenshotSelector('.ui-dialog')).to.matchImage('transitions_popup_titles');
});
it('should load the transitions popup correctly for the page urls report', async function() {
await page.goto('about:blank');
await page.goto("?" + urlBase + "#?" + generalParams + "&category=General_Actions&subcategory=General_Pages&"
+ "popover=RowAction$3ATransitions$3Aurl$3Ahttp$3A$2F$2Fpiwik.net$2Fdocs$2Fmanage-websites$2F");
await page.waitFor(500);
await page.waitForNetworkIdle();
await page.hover('.Transitions_CurveTextRight');
expect(await page.screenshotSelector('.ui-dialog')).to.matchImage('transitions_popup_urls');
});
it('should show no data message in selector', async function () {
await page.goto("?module=Widgetize&action=iframe&widget=1&moduleToWidgetize=Transitions&actionToWidgetize=getTransitions&idSite=1&period=day&date=today&disableLink=1&widget=1");
expect(await page.screenshotSelector('body')).to.matchImage('transitions_report_no_data_widget');
});
it('should show report in reporting ui with data', async function () {
await page.goto("?" + urlBase + "#?" + generalParams + "&category=General_Actions&subcategory=Transitions_Transitions");
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('.pageWrap')).to.matchImage('transitions_report_with_data_report');
});
it('should show report in widget ui in selector', async function () {
await page.goto("?module=Widgetize&action=iframe&widget=1&moduleToWidgetize=Transitions&actionToWidgetize=getTransitions&"+generalParams+"&disableLink=1&widget=1");
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('body')).to.matchImage('transitions_report_with_data_widget');
});
it('should be possible to switch report', async function () {
await selectValue('[name="actionName"]', 'category/meta');
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('body')).to.matchImage('transitions_report_switch_url');
});
it('should be possible to show page titles', async function () {
await selectValue('[name="actionType"]', 'Title');
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('body')).to.matchImage('transitions_report_switch_type_title');
});
});
|