blob: 64b11de2a076dab1c837e61908d0c0196da28b3a (
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
|
/*!
* Piwik - free/libre analytics platform
*
* Visitor Map screenshot tests.
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("VisitorMap", function () {
this.timeout(0);
var url = "?module=Widgetize&action=iframe&moduleToWidgetize=UserCountryMap&idSite=1&period=year&date=2012-08-09&"
+ "actionToWidgetize=visitorMap&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1",
urlWithCities = "?module=Widgetize&action=iframe&moduleToWidgetize=UserCountryMap&idSite=3&period=week&date=yesterday&"
+ "actionToWidgetize=visitorMap&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1";
it("should display the bounce rate metric correctly", async function() {
await page.goto(url);
await page.evaluate(function () {
$('.userCountryMapSelectMetrics').val('bounce_rate').trigger('change');
});
await page.mouse.move(900, 140);
await page.waitFor(100); // wait for tooltip
expect(await page.screenshot({ fullPage: true })).to.matchImage('bounce_rate');
});
it("should display the average time on site metric correctly", async function() {
await page.mouse.move(0, 0);
await page.evaluate(function () {
$('.userCountryMapSelectMetrics').val('avg_time_on_site').trigger('change');
});
await page.mouse.move(900, 140);
await page.waitFor(100); // wait for tooltip
expect(await page.screenshot({ fullPage: true })).to.matchImage('avg_time_on_site');
});
it("should display the regions layer correctly", async function() {
await page.goto(urlWithCities);
await page.waitForNetworkIdle();
await page.waitFor(1000);
await page.webpage.evaluate(function () {
// zoom into USA
var path = window.visitorMap.map.getLayer('countries').getPaths({iso: "USA"})[0].svgPath[0];
$(path).click();
});
await page.waitFor(1000);
await page.webpage.evaluate(function () {
// go to regions view
var path = window.visitorMap.map.getLayer('countries').getPaths({iso: "USA"})[0].svgPath[0];
$(path).click();
});
await page.waitFor(1000);
expect(await page.screenshot({ fullPage: true })).to.matchImage('regions');
});
it("should display the cities layer correctly", async function() {
await page.click('.UserCountryMap-btn-city');
await page.waitForNetworkIdle();
await page.waitFor(1000); // wait for map
expect(await page.screenshot({ fullPage: true })).to.matchImage('cities');
});
});
|