-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update mark notification as read method (#17518)
* update mark notification as read method * Ensure notificationId is passed correctly to markNotificationAsRead * Adds notification UI tests Co-authored-by: sgiehl <[email protected]>
- Loading branch information
Showing
9 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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
2 changes: 1 addition & 1 deletion
2
plugins/CoreHome/angularjs/notification/notification.directive.html
This file contains 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 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,38 @@ | ||
<?php | ||
|
||
use Piwik\Notification; | ||
|
||
return [ | ||
'observers.global' => DI\add([ | ||
[ | ||
'Request.dispatch', | ||
DI\value( | ||
function () { | ||
if (!empty($_GET['setNotifications']) && $_GET['setNotifications'] == 1) { | ||
// trigger some notification | ||
$notification = new Notification('This is a persistent test notification'); | ||
$notification->title = 'Warning:'; | ||
$notification->context = Notification::CONTEXT_WARNING; | ||
$notification->type = Notification::TYPE_PERSISTENT; | ||
$notification->flags = Notification::FLAG_CLEAR; | ||
Notification\Manager::notify('NotificationFixture_persistent_warning', $notification); | ||
|
||
$notification = new Notification('This is another persistent test notification'); | ||
$notification->title = 'Error:'; | ||
$notification->context = Notification::CONTEXT_ERROR; | ||
$notification->type = Notification::TYPE_PERSISTENT; | ||
$notification->flags = Notification::FLAG_CLEAR; | ||
Notification\Manager::notify('NotificationFixture_persistent_error', $notification); | ||
|
||
$notification = new Notification('This is transient test notification'); | ||
$notification->title = 'Error:'; | ||
$notification->context = Notification::CONTEXT_ERROR; | ||
$notification->type = Notification::TYPE_TRANSIENT; | ||
$notification->flags = Notification::FLAG_CLEAR; | ||
Notification\Manager::notify('NotificationFixture_transient_error', $notification); | ||
} | ||
} | ||
), | ||
], | ||
]), | ||
]; |
This file contains 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,52 @@ | ||
/*! | ||
* Matomo - free/libre analytics platform | ||
* | ||
* Dashboard screenshot tests. | ||
* | ||
* @link https://matomo.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
*/ | ||
|
||
describe('Notifications', function () { | ||
this.timeout(0); | ||
|
||
this.fixture = "Piwik\\Tests\\Fixtures\\OneVisit"; | ||
|
||
var url = "?module=CoreAdminHome&action=home&idSite=1&period=day&date=yesterday"; | ||
|
||
it('should show notifications', async function () { | ||
await page.goto(url + '&setNotifications=1'); | ||
await page.waitForNetworkIdle(); | ||
|
||
var elem = await page.waitForSelector('#notificationContainer'); | ||
|
||
expect(await elem.screenshot()).to.matchImage('loaded'); | ||
}); | ||
|
||
it('should still show persistent notifications on reload', async function () { | ||
await page.goto(url); | ||
await page.waitForNetworkIdle(); | ||
|
||
var elem = await page.waitForSelector('#notificationContainer'); | ||
|
||
expect(await elem.screenshot()).to.matchImage('reloaded'); | ||
}); | ||
|
||
it('should close a notification', async function () { | ||
await page.click('.notification:first-child .close'); | ||
await page.waitForNetworkIdle(); | ||
|
||
var elem = await page.waitForSelector('#notificationContainer'); | ||
|
||
expect(await elem.screenshot()).to.matchImage('close'); | ||
}); | ||
|
||
it('should still be closed on reload', async function () { | ||
await page.reload(); | ||
await page.waitForNetworkIdle(); | ||
|
||
var elem = await page.waitForSelector('#notificationContainer'); | ||
|
||
expect(await elem.screenshot()).to.matchImage('close_reload'); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
plugins/CoreHome/tests/UI/expected-screenshots/Notifications_close.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/CoreHome/tests/UI/expected-screenshots/Notifications_close_reload.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/CoreHome/tests/UI/expected-screenshots/Notifications_loaded.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/CoreHome/tests/UI/expected-screenshots/Notifications_reloaded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.