Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4d87f7d
adding console logs to be able to understand the flow of the code better
chippison Nov 17, 2025
5069f40
adding a timeout so that we can wait a little for the async process o…
chippison Nov 17, 2025
b19d05d
Removing the '+1' from segmentCompareLimit and just making the value …
chippison Nov 17, 2025
e60a8f5
adding the check for maximum compared segments
chippison Nov 17, 2025
53fd7a8
adding a 'no-click' class when max compared segments is reached which…
chippison Nov 17, 2025
9cfeb67
adding the tooltip
chippison Nov 18, 2025
e656566
making the translatable error message available in the client side
chippison Nov 18, 2025
e122cc7
We make sure that it is only the <span> with class segname gets the c…
chippison Nov 19, 2025
591da7e
adding listener for segment comparison change so we can mark them pro…
chippison Nov 19, 2025
e240800
using value from global.ini 'data_comparison_segment_limit' as the limit
chippison Nov 19, 2025
aa2a6ea
Initial commit with some hard-coded/fake message
chippison Nov 19, 2025
cb14a55
refactoring ManageGoals.vue so that we don't do a window.reload becau…
chippison Nov 21, 2025
124f48c
making the message dynamic and basing it on whether it was an update …
chippison Nov 21, 2025
f13b31c
adding initial screenshot test
chippison Nov 21, 2025
cf2e5f0
changing from full window reload to just reloading the views via ajax…
chippison Nov 21, 2025
20f2b9a
adding translations; also adding in the built js files
chippison Nov 21, 2025
cbdb502
removing commit mistake; these were for the other branch
chippison Nov 23, 2025
ea404ce
forgot to commit this
chippison Nov 23, 2025
ed4861f
We needed to use the returned new goalsList and just fallback to the …
chippison Nov 23, 2025
fe797db
removing console logs
chippison Nov 23, 2025
3885c47
adding new screenshots for test;
chippison Nov 23, 2025
78c00d2
making test check for Goal report url to be correct
chippison Nov 23, 2025
1fb9efe
Merge branch '5.x-dev' into ux-333
chippison Nov 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugins/Goals/Goals.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'General_Yes';
$translationKeys[] = 'General_No';
$translationKeys[] = 'General_OrCancel';
$translationKeys[] = 'Goals_GoalCreated';
$translationKeys[] = 'Goals_GoalUpdated';
$translationKeys[] = 'Goals_ViewGoalReport';
}

public function filterSegments(SegmentsList &$list, array $idSites)
Expand Down
5 changes: 4 additions & 1 deletion plugins/Goals/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
"ColumnRevenueAttributedDocumentation": "The share of all revenue for %s where this page was viewed before conversion.",
"ColumnConversionsEntryDocumentation": "The total number of goal conversions where this page was the entry page.",
"ColumnConversionEntryRateDocumentation": "The percent of entrances that were converted for %s.",
"ColumnRevenueEntryDocumentation": "The share of all revenue for %s where this page was the entry page."
"ColumnRevenueEntryDocumentation": "The share of all revenue for %s where this page was the entry page.",
"GoalCreated": "Goal successfully created",
"GoalUpdated": "Goal successfully updated",
"ViewGoalReport": "View Goal Report"
}
}
76 changes: 76 additions & 0 deletions plugins/Goals/tests/UI/ManageGoals_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*!
* Matomo - free/libre analytics platform
*
* ManageGoals UI tests.
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

describe("ManageGoals", function () {
this.fixture = 'Piwik\\Tests\\Fixtures\\SomePageGoalVisitsWithConversions';

const manageGoalsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2009-01-01#?idSite=1&period=year&date=2009-01-01&category=Goals_Goals&subcategory=Goals_ManageGoals";

async function fillField(selector, value) {
await page.$eval(selector, (el) => {
el.value = '';
el.dispatchEvent(new Event('input', { bubbles: true }));
el.dispatchEvent(new Event('change', { bubbles: true }));
});
await page.type(selector, value);
}

it("should show correct notification when creating a new goal", async function () {
await page.goto(manageGoalsUrl);
await page.waitForNetworkIdle();

await page.waitForSelector('#add-goal');
await page.click('#add-goal');
await page.waitForSelector('.addEditGoal', { visible: true });

const goalName = 'My name';
await fillField('#goal_name', goalName);
await fillField('#pattern', '/thank-you');

const saveButton = await page.waitForSelector('.addEditGoal .matomo-save-button .btn');
await saveButton.click();

await page.waitForNetworkIdle();
expect(await page.screenshot()).to.matchImage('goals_created');

// We check that the created goal id is in the View Goal Report url
const createdGoalId = await page.$eval(
'div.manageGoals table.entityTable tbody tr:last-child td:first-child',
(cell) => cell.textContent.trim()
);
const viewGoalLinkHref = await page.$eval(
'.notification.notification-success a',
(link) => link.getAttribute('href')
);
expect(viewGoalLinkHref).to.include(`subcategory=${createdGoalId}`);
});
it("should show the correct notification when editing the goal", async function () {
const goalEditButtonSelector = 'table.entityTable tbody tr:nth-last-child(1) button.icon-edit';
await page.click(goalEditButtonSelector);

const updatedGoalName = 'My edited name';
await fillField('#goal_name', updatedGoalName);

const updateButton = await page.waitForSelector('.addEditGoal .matomo-save-button .btn');
await updateButton.click();
await page.waitForNetworkIdle();
expect(await page.screenshot()).to.matchImage('goals_updated');

// We check that the edited goal id is in the View Goal Report url
const editedGoalId = await page.$eval(
'div.manageGoals table.entityTable tbody tr:last-child td:first-child',
(cell) => cell.textContent.trim()
);
const viewGoalLinkHref = await page.$eval(
'.notification.notification-success a',
(link) => link.getAttribute('href')
);
expect(viewGoalLinkHref).to.include(`subcategory=${editedGoalId}`);
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 57 additions & 14 deletions plugins/Goals/vue/dist/Goals.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading