-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Show success notification once a Goal has been created or updated #23809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chippison
wants to merge
33
commits into
5.x-dev
Choose a base branch
from
ux-333
base: 5.x-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+230
−21
Open
Changes from 22 commits
Commits
Show all changes
33 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 5069f40
adding a timeout so that we can wait a little for the async process o…
chippison b19d05d
Removing the '+1' from segmentCompareLimit and just making the value …
chippison e60a8f5
adding the check for maximum compared segments
chippison 53fd7a8
adding a 'no-click' class when max compared segments is reached which…
chippison 9cfeb67
adding the tooltip
chippison e656566
making the translatable error message available in the client side
chippison e122cc7
We make sure that it is only the <span> with class segname gets the c…
chippison 591da7e
adding listener for segment comparison change so we can mark them pro…
chippison e240800
using value from global.ini 'data_comparison_segment_limit' as the limit
chippison aa2a6ea
Initial commit with some hard-coded/fake message
chippison cb14a55
refactoring ManageGoals.vue so that we don't do a window.reload becau…
chippison 124f48c
making the message dynamic and basing it on whether it was an update …
chippison f13b31c
adding initial screenshot test
chippison cf2e5f0
changing from full window reload to just reloading the views via ajax…
chippison 20f2b9a
adding translations; also adding in the built js files
chippison cbdb502
removing commit mistake; these were for the other branch
chippison ea404ce
forgot to commit this
chippison ed4861f
We needed to use the returned new goalsList and just fallback to the …
chippison fe797db
removing console logs
chippison 3885c47
adding new screenshots for test;
chippison 78c00d2
making test check for Goal report url to be correct
chippison 1fb9efe
Merge branch '5.x-dev' into ux-333
chippison 385d6ff
added new screenshots for UI test
chippison f2e691a
Merge branch '5.x-dev' into ux-333
chippison 315e964
Merge branch '5.x-dev' into ux-333
chippison 5a74565
Merge branch '5.x-dev' into ux-333
chippison 3f2bc38
added a class name on goals success message so that we can target it …
chippison 6a03090
updating test so that we don't take screenshots anymore
chippison 9fcac3f
Merge branch '5.x-dev' into ux-333
chippison 638a529
putback refresh when new goal is added/updated
chippison 54e333b
making notifications get from sessionstore so that we can show notifi…
chippison 5941c4e
Merge branch '5.x-dev' into ux-333
chippison File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}`); | ||
| }); | ||
| }); | ||
3 changes: 3 additions & 0 deletions
3
plugins/Goals/tests/UI/expected-screenshots/ManageGoals_goals_created.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
plugins/Goals/tests/UI/expected-screenshots/ManageGoals_goals_updated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.