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
|
/*!
* Matomo - free/libre analytics platform
*
* Screenshot integration tests.
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("GoalsPages", function () {
var generalParams = 'idSite=1&period=year&date=2012-08-09',
urlBaseGeneric = 'module=CoreHome&action=index&',
urlBase = urlBaseGeneric + generalParams;
// goals pages
it('should load the goals > ecommerce page correctly', async function () {
await page.goto("?" + urlBase + "#?" + generalParams + "&category=Goals_Ecommerce&subcategory=General_Overview")
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('.pageWrap')).to.matchImage('ecommerce');
});
it('should show the correct relative data for the revenue in-cart tooltip', async function() {
var monthParams = 'idSite=1&period=month&date=2012-01-09';
await page.goto("?" + urlBase + "#?" + monthParams + "&category=Goals_Ecommerce&subcategory=General_Overview");
await page.waitForNetworkIdle();
const element = await page.jQuery('#rightcolumn .sparkline:eq(1) .metricEvolution');
await element.hover();
const tooltip = await page.waitForSelector('.ui-tooltip', { visible: true });
expect(await tooltip.screenshot()).to.matchImage('revenue_incart_tooltip');
});
it('should load the goals > overview page correctly', async function () {
await page.goto("?" + urlBase + "#?" + generalParams + "&category=Goals_Goals&subcategory=General_Overview");
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('.pageWrap')).to.matchImage('overview');
});
it('should load row evolution with goal metrics', async function() {
const row = await page.waitForSelector('.reportsByDimensionView tbody tr:first-child');
await row.hover();
const icon = await page.waitForSelector('.reportsByDimensionView tbody tr:first-child a.actionRowEvolution');
await icon.click();
await page.waitForSelector('.ui-dialog');
await page.waitForNetworkIdle();
const dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('overview_row_evolution');
});
it('should load row evolution with goal metrics again when reloading the page url', async function() {
// page.reload() won't work with url hashes
const url = await page.evaluate('location.href');
await page.goto('about:blank');
await page.goto(url);
await page.waitForSelector('.ui-dialog');
await page.waitForNetworkIdle();
await page.waitForTimeout(200);
const dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('overview_row_evolution_reloaded');
});
it('should load the goals > management page correctly', async function () {
await page.goto("?" + generalParams + "&module=Goals&action=manage");
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('#content,.top_bar_sites_selector,.entityContainer')).to.matchImage('manage');
});
it('should load the goals > single goal page correctly', async function () {
await page.goto("?" + urlBase + "#?" + generalParams + "&category=Goals_Goals&subcategory=1");
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('.pageWrap')).to.matchImage('individual_goal');
});
it('should update the evolution chart if a sparkline is clicked', async function () {
elem = await page.jQuery('.sparkline.linked:contains(conversion rate)');
await elem.click();
await page.waitForNetworkIdle();
await page.mouse.move(-10, -10);
expect(await page.screenshotSelector('.pageWrap')).to.matchImage('individual_goal_updated');
});
// should load the row evolution [see #11526]
it('should show rov evolution for goal tables', async function () {
await page.waitForNetworkIdle();
const row = await page.waitForSelector('.dataTable tbody tr:first-child');
await row.hover();
const icon = await page.waitForSelector('.dataTable tbody tr:first-child a.actionRowEvolution');
await icon.click();
await page.waitForSelector('.rowevolution');
await page.waitForNetworkIdle();
expect(await page.screenshotSelector('.ui-dialog')).to.matchImage('individual_row_evolution');
});
it('should load row evolution with goal metrics again when reloading the page url', async function() {
// page.reload() won't work with url hashes
const url = await page.evaluate('location.href');
await page.goto('about:blank');
await page.goto(url);
await page.waitForSelector('.ui-dialog');
await page.waitForNetworkIdle();
await page.waitForTimeout(200);
const dialog = await page.$('.ui-dialog');
expect(await dialog.screenshot()).to.matchImage('individual_row_evolution_reloaded');
});
});
|