blob: d5e66f101ab3d106f1d5d90fbf72cafd35203f98 (
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
|
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("TrackingFailures", function () {
this.timeout(0);
this.fixture = 'Piwik\\Tests\\Fixtures\\InvalidVisits';
var manageUrl = '?module=CoreAdminHome&action=trackingFailures&idSite=1&period=day&date=today';
var widgetUrl = '?module=Widgetize&action=iframe&moduleToWidgetize=CoreAdminHome&actionToWidgetize=getTrackingFailures&idSite=1&period=day&date=today&widget=1';
function generateTrackingFailures()
{
testEnvironment.generateTrackingFailures = 1;
testEnvironment.save();
}
async function confirmModal()
{
await (await page.jQuery('.modal.open .modal-footer a:contains(Yes):visible')).click();
}
afterEach(function () {
delete testEnvironment.generateTrackingFailures;
testEnvironment.save();
});
it('should show widget with no failures', async function () {
await page.goto(widgetUrl);
expect(await page.screenshot({ fullPage: true })).to.matchImage('widget_no_failures');
});
it('should show manage page with no failures', async function () {
await page.goto(manageUrl);
const frame = await page.waitForSelector('.matomoTrackingFailures');
expect(await frame.screenshot()).to.matchImage('manage_no_failures');
});
it('should show widget with failures', async function () {
generateTrackingFailures();
await page.waitForTimeout(500);
await page.goto(widgetUrl);
expect(await page.screenshot({ fullPage: true })).to.matchImage('widget_with_failures');
});
it('should show manage page with failures', async function () {
await page.goto(manageUrl);
await page.waitForSelector('.matomoTrackingFailures td');
await page.waitForTimeout(250);
const elem = await page.$('.matomoTrackingFailures');
expect(await elem.screenshot()).to.matchImage('manage_with_failures');
});
it('should show ask to confirm delete one', async function () {
await page.evaluate(function () {
$('.matomoTrackingFailures table tbody tr:nth-child(2) .icon-delete').click();
});
const elem = await page.waitForSelector('.modal.open');
await page.waitForTimeout(500);
expect(await elem.screenshot()).to.matchImage('manage_with_failures_delete_one_ask_confirmation');
});
it('should show delete when confirmed', async function () {
await confirmModal();
await page.waitForNetworkIdle();
await page.waitForSelector('.matomoTrackingFailures td .icon-delete');
await page.waitForTimeout(500); // animation
const elem = await page.$('.matomoTrackingFailures');
expect(await elem.screenshot()).to.matchImage('manage_with_failures_delete_one_confirmed');
});
it('should show ask to confirm delete all', async function () {
await page.click('.matomoTrackingFailures .deleteAllFailures');
await page.waitForSelector('.modal.open');
await page.waitForTimeout(500);
expect(await (await page.$('.modal.open')).screenshot()).to.matchImage('manage_with_failures_delete_all_ask_confirmation');
});
it('should show nothing when confirmed', async function () {
await confirmModal();
await page.waitForSelector('.matomoTrackingFailures td .icon-ok');
await page.waitForTimeout(500);
const frame = await page.waitForSelector('.matomoTrackingFailures');
expect(await frame.screenshot()).to.matchImage('manage_with_failures_delete_all_confirmed');
});
});
|