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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
/*!
* Matomo - free/libre analytics platform
*
* Screenshot integration tests.
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("DeactivatedFeatures", function () {
afterEach(async function () {
await setFeatures(1, 0, 0);
if (testEnvironment.configOverride.Live) {
delete testEnvironment.configOverride.Live;
await testEnvironment.save();
}
});
after(async function () {
await setFeatures(1, 0, 0);
if (testEnvironment.configOverride.Live) {
delete testEnvironment.configOverride.Live;
await testEnvironment.save();
}
});
async function setFeatures(idSite, vLog, vProfile) {
await testEnvironment.callApi("SitesManager.updateSite", {
idSite: idSite, settingValues: {
Live: [
{name: 'disable_visitor_log', value: vLog},
{name: 'disable_visitor_profile', value: vProfile},
]
}
});
}
async function setConfig(vLog, vProfile) {
testEnvironment.overrideConfig('Live', 'disable_visitor_log', vLog);
testEnvironment.overrideConfig('Live', 'disable_visitor_profile', vProfile);
await testEnvironment.save();
}
// test measurable setting
it('menu should contain visits log & realtime when enabled', async function () {
await setFeatures(1, 0, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2009-01-04#?idSite=1&period=year&date=2009-01-04&category=General_Visitors&subcategory=General_Overview");
await page.waitFor('#secondNavBar', {visible: true});
const vlog = await page.$('#secondNavBar .navbar a[href*="Live_VisitorLog"]');
expect(vlog).to.be.ok;
const realtime = await page.$('#secondNavBar .navbar a[href*="General_RealTime"]');
expect(realtime).to.be.ok;
const realtimemap = await page.$('#secondNavBar .navbar a[href*="UserCountryMap_RealTimeMap"]');
expect(realtimemap).to.be.ok;
});
it('menu should not contain visits log & realtime when deactivated', async function () {
await setFeatures(1, 1, 1);
await page.reload();
await page.waitFor('#secondNavBar', {visible: true});
const vlog = await page.$('#secondNavBar .navbar a[href*="Live_VisitorLog"]');
expect(vlog).to.be.not.ok;
const realtime = await page.$('#secondNavBar .navbar a[href*="General_RealTime"]');
expect(realtime).to.be.not.ok;
const realtimemap = await page.$('#secondNavBar .navbar a[href*="UserCountryMap_RealTimeMap"]');
expect(realtimemap).to.be.not.ok;
});
it('it should not show visits log, when opened directly but disabled', async function () {
await setFeatures(1, 1, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2009-08-09#?idSite=1&period=year&date=2009-08-09&category=General_Visitors&subcategory=Live_VisitorLog");
await page.waitForNetworkIdle();
expect(await page.getWholeCurrentUrl()).to.not.match(/Live_VisitorLog/); // page should be redirected to next subcategory
});
it('it should not show realtime, when opened directly but disabled', async function () {
await setFeatures(1, 1, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2009-08-09#?idSite=1&period=year&date=2009-08-09&category=General_Visitors&subcategory=General_RealTime");
await page.waitForNetworkIdle();
expect(await page.getWholeCurrentUrl()).to.not.match(/General_RealTime/); // page should be redirected to next subcategory
});
it('it should not show realtime map, when opened directly but disabled', async function () {
await setFeatures(1, 1, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2009-08-09#?idSite=1&period=year&date=2009-08-09&category=General_Visitors&subcategory=UserCountryMap_RealTimeMap");
await page.waitForNetworkIdle();
expect(await page.getWholeCurrentUrl()).to.not.match(/UserCountryMap_RealTimeMap/); // page should be redirected to next subcategory
});
it('menu should contain ecommerce log when visits log enabled', async function () {
await setFeatures(1, 0, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2009-01-04#?idSite=1&period=year&date=2009-01-04&category=Goals_Ecommerce&subcategory=Goals_EcommerceLog");
await page.waitFor('#secondNavBar', {visible: true});
const element = await page.$('#secondNavBar .navbar a[href*="Goals_EcommerceLog"]');
expect(element).to.be.ok;
});
it('menu should not contain ecommerce log when visits log deactivated', async function () {
await setFeatures(1, 1, 1);
await page.reload();
await page.waitFor('#secondNavBar', {visible: true});
const element = await page.$('#secondNavBar .navbar a[href*="Goals_EcommerceLog"]');
expect(element).to.be.not.ok;
});
it('it should not show ecommerce log, when opened directly but disabled', async function () {
await setFeatures(1, 1, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2009-08-09#?idSite=1&period=year&date=2009-08-09&category=Goals_Ecommerce&subcategory=Goals_EcommerceLog");
await page.waitForNetworkIdle();
expect(await page.getWholeCurrentUrl()).to.not.match(/Goals_EcommerceLog/); // page should be redirected to next subcategory
});
it('it should show profile link in visits log when enabled', async function () {
await setFeatures(1, 0, 0);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#?idSite=1&period=year&date=2012-08-09&category=General_Visitors&subcategory=Live_VisitorLog");
await page.waitFor('.dataTableVizVisitorLog');
const element = await page.$('.dataTableVizVisitorLog .card .visitor-log-visitor-profile-link');
expect(element).to.be.ok;
});
it('it should not show profile link in visits log when disabled', async function () {
await setFeatures(1, 0, 1);
await page.reload();
await page.waitFor('.dataTableVizVisitorLog');
const element = await page.$('.dataTableVizVisitorLog .card .visitor-log-visitor-profile-link');
expect(element).to.be.not.ok;
});
it('it should show button to test new segments with enabled visits log', async function () {
await setFeatures(1, 0, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2012-07-09#?idSite=1&period=year&date=2012-07-09&category=General_Visitors&subcategory=General_Overview");
await page.waitFor('.segmentationContainer');
await page.click('.segmentationContainer');
await page.click('.add_new_segment');
const element = await page.$('.segmentEditorPanel .testSegment');
expect(element).to.be.ok;
});
it('it should not show button to test new segments with disabled visits log', async function () {
await setFeatures(1, 1, 1);
await page.reload();
await page.waitFor('.segmentationContainer');
await page.click('.segmentationContainer');
await page.click('.add_new_segment');
const element = await page.$('.segmentEditorPanel .testSegment');
expect(element).to.be.not.ok;
});
it('it should show segmented visits log row action when enabled', async function () {
await setFeatures(1, 0, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-08#?idSite=1&period=year&date=2012-08-08&category=General_Visitors&subcategory=DevicesDetection_Software");
await page.waitForNetworkIdle();
await (await page.jQuery('#widgetDevicesDetectiongetOsVersions td.label:first')).hover();
await page.waitFor('#widgetDevicesDetectiongetOsVersions .dataTableRowActions', {visible: true});
const element = await page.$('#widgetDevicesDetectiongetOsVersions .dataTableRowActions .actionSegmentVisitorLog');
expect(element).to.be.ok;
});
it('it should not show segmented visits log row action when disabled', async function () {
await setFeatures(1, 1, 1);
await page.reload();
await page.waitForNetworkIdle();
await (await page.jQuery('#widgetDevicesDetectiongetOsVersions td.label:first')).hover();
await page.waitFor('#widgetDevicesDetectiongetOsVersions .dataTableRowActions', {visible: true});
const element = await page.$('#widgetDevicesDetectiongetOsVersions .dataTableRowActions .actionSegmentVisitorLog');
expect(element).to.be.not.ok;
});
it('widget list should contain log and profile when enabled', async function () {
await setFeatures(1, 0, 0);
await page.goto("?module=Widgetize&action=index&idSite=1&period=day&date=yesterday");
await page.waitForNetworkIdle();
await (await page.jQuery('.widgetpreview-categorylist li:contains("Visitors"):first')).hover();
await page.waitFor('.widgetpreview-widgetlist', {visible: true});
const profile = await page.$('.widgetpreview-widgetlist [uniqueid=widgetLivegetVisitorProfilePopup]');
expect(profile).to.be.ok;
const log = await page.$('.widgetpreview-widgetlist [uniqueid=widgetLivegetLastVisitsDetailsforceView1viewDataTableVisitorLogsmall1]');
expect(log).to.be.ok;
const realtime = await page.$('.widgetpreview-widgetlist [uniqueid=widgetLivewidget]');
expect(realtime).to.be.ok;
const realtimemap = await page.$('.widgetpreview-widgetlist [uniqueid=widgetUserCountryMaprealtimeMap]');
expect(realtimemap).to.be.ok;
});
it('widget list should not contain log and profile when disabled', async function () {
await setFeatures(1, 1, 1);
await page.goto("?module=Widgetize&action=index&idSite=1&period=day&date=yesterday");
await page.waitForNetworkIdle();
await (await page.jQuery('.widgetpreview-categorylist li:contains("Visitors"):first')).hover();
await page.waitFor('.widgetpreview-widgetlist', {visible: true});
const profile = await page.$('.widgetpreview-widgetlist [uniqueid=widgetLivegetVisitorProfilePopup]');
expect(profile).to.be.not.ok;
const log = await page.$('.widgetpreview-widgetlist [uniqueid=widgetLivegetLastVisitsDetailsforceView1viewDataTableVisitorLogsmall1]');
expect(log).to.be.not.ok;
const realtime = await page.$('.widgetpreview-widgetlist [uniqueid=widgetLivewidget]');
expect(realtime).to.be.not.ok;
const realtimemap = await page.$('.widgetpreview-widgetlist [uniqueid=widgetUserCountryMaprealtimeMap]');
expect(realtimemap).to.be.not.ok;
});
it('Goal overview contains segmented visitor log link when activated', async function () {
await setFeatures(1, 0, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-08#?idSite=1&period=year&date=2012-08-08&category=Goals_Goals&subcategory=1");
await page.waitFor('#widgetGoalsgoalConversionsOverviewidGoal1', {visible: true});
const profile = await page.$('#widgetGoalsgoalConversionsOverviewidGoal1 a.segmentedlog');
expect(profile).to.be.ok;
});
it('Goal overview does not contain segmented visitor log link when disabled', async function () {
await setFeatures(1, 1, 1);
await page.reload();
await page.waitFor('#widgetGoalsgoalConversionsOverviewidGoal1', {visible: true});
const profile = await page.$('#widgetGoalsgoalConversionsOverviewidGoal1 a.segmentedlog');
expect(profile).to.be.not.ok;
});
// test system setting
it('system settings for live plugin should be available by default', async function () {
await page.goto("?module=CoreAdminHome&action=generalSettings");
await page.waitForNetworkIdle();
const log = await page.$('#LivePluginSettings #disable_visitor_log');
expect(log).to.be.ok;
const profile = await page.$('#LivePluginSettings #disable_visitor_profile');
expect(profile).to.be.ok;
});
it('system settings for live plugin should be hidden if disabled in config', async function () {
await setConfig(1, 1);
await page.reload();
await page.waitForNetworkIdle();
const log = await page.$('#LivePluginSettings #disable_visitor_log');
expect(log).to.be.not.ok;
const profile = await page.$('#LivePluginSettings #disable_visitor_profile');
expect(profile).to.be.not.ok;
});
it('measurable settings for live plugin should be available by default', async function () {
await page.goto("?module=SitesManager&action=index&idSite=1");
await page.waitForNetworkIdle();
await page.click('[idsite="1"] .icon-edit');
await page.waitForNetworkIdle();
const log = await page.$('[idsite="1"] #disable_visitor_log');
expect(log).to.be.ok;
const profile = await page.$('[idsite="1"] #disable_visitor_profile');
expect(profile).to.be.ok;
});
it('measurable settings for live plugin should be available by default', async function () {
await setConfig(1, 1);
await page.reload();
await page.waitForNetworkIdle();
await page.click('[idsite="1"] .icon-edit');
await page.waitForNetworkIdle();
const log = await page.$('[idsite="1"] #disable_visitor_log');
expect(log).to.be.not.ok;
const profile = await page.$('[idsite="1"] #disable_visitor_profile');
expect(profile).to.be.not.ok;
});
it('menu should not contain visits log when deactivated globally', async function () {
await setConfig(1, 1);
await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2009-01-04#?idSite=1&period=year&date=2009-01-04&category=General_Visitors&subcategory=General_Overview");
await page.waitFor('#secondNavBar', {visible: true});
const element = await page.$('#secondNavBar .navbar a[href*="Live_VisitorLog"]');
expect(element).to.be.not.ok;
});
});
|