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
|
/*!
* Matomo - free/libre analytics platform
*
* SegmentEditor screenshot tests.
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("UnprocessedSegmentTest", function () {
this.fixture = 'Piwik\\Tests\\Fixtures\\OneVisitorTwoVisits';
var generalParams = 'idSite=1&period=day&date=2010-03-06';
var segment = 'browserCode==ff';
var customSegment = 'languageCode==fr';
var url = '?module=CoreHome&action=index&' + generalParams + '#?' + generalParams + '&category=General_Visitors&subcategory=General_Overview';
before(async function () {
await testEnvironment.callApi('SegmentEditor.add', {
name: '<script>alert("testsegment");</script>',
definition: segment,
idSite: 1,
autoArchive: 1,
enableAllUsers: 1,
});
});
before(async function () {
testEnvironment.configOverride.General = {
browser_archiving_disabled_enforce: '1',
enable_browser_archiving_triggering: '0',
};
testEnvironment.optionsOverride = {
enableBrowserTriggerArchiving: '0',
};
testEnvironment.save();
});
after(async function () {
await testEnvironment.callApi('SegmentEditor.delete', { idSegment: 1 });
});
it("should show a notification for unprocessed segments", async function () {
await page.goto(url + '&segment=' + encodeURIComponent(segment));
expect(await page.screenshotSelector('.pageWrap,#notificationContainer')).to.matchImage('unprocessed_segment');
});
it('should not show a notification for custom segments that are not preprocessed', async function () {
await page.goto(url + '&segment=' + encodeURIComponent(customSegment));
expect(await page.screenshotSelector('.pageWrap,#notificationContainer')).to.matchImage('custom_segment');
});
});
|