Skip to content
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

Update/tests for multibrand support #10

Merged
merged 4 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions includes/NotificationsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static function get_test_notification_data() {
'pages' => '#/help',
]
],
'expiration' => 1649860279240,
'expiration' => 1749860279240,
'content' => '<div class="notice notice-warning"><p>Here is a plugin notice it should display on home and help screen only! <a data-action="close">x</a></p></div>',
];
$results[] = [
Expand Down Expand Up @@ -141,7 +141,7 @@ public static function get_test_notification_data() {
'locations' => [
[
'pages' => ["#/marketplace/services"],
'context' => "web-plugin"
'context' => container()->plugin()->id . "-plugin"
],
[
'pages' => 'index.php',
Expand Down
66 changes: 0 additions & 66 deletions tests/cypress/fixtures/notifications.json

This file was deleted.

67 changes: 66 additions & 1 deletion tests/cypress/integration/notifications.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,70 @@
// <reference types="Cypress" />
const notifications = require('../fixtures/notifications.json');
const notifications = [
{
"id": "test-1",
"locations": [
{
"context": Cypress.env('pluginId') + "-plugin",
"pages": "#/settings"
}
],
"expiration": 2748863456503,
"content": "<div class=\"newfold-notice notice notice-success\" style=\"position:relative;\"><p>Notice should only display on plugin app settings page<button type=\"button\" data-action=\"close\" class=\"notice-dismiss\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button><\/p><\/div>"
},
{
"id": "test-2",
"locations": [
{
"context": Cypress.env('pluginId') + "-plugin",
"pages": [
"#/home/onboarding",
"#/home"
]
}
],
"expiration": 2749860279240,
"content": "<div class=\"newfold-notice notice notice-error\" style=\"position:relative;\"><p>Here is a plugin notice it should display on home and onboarding screens only! <button type=\"button\" data-action=\"close\" class=\"notice-dismiss\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button><\/p><\/div>"
},
{
"id": "test-3",
"locations": [
{
"context": Cypress.env('pluginId') + "-plugin",
"pages": [
"#/marketplace"
]
}
],
"expiration": 2749860279240,
"content": "<div class=\"newfold-notice notice notice-info\" style=\"position:relative;\"><p>Here is a plugin notice it should display on marketplace themes screen only! <button type=\"button\" data-action=\"close\" class=\"notice-dismiss\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button><\/p><\/div>"
},
{
"id": "test-4",
"locations": [
{
"context": Cypress.env('pluginId') + "-plugin",
"pages": "all"
},
{
"context": "wp-admin-notice",
"pages": "all"
}
],
"expiration": 2749860279240,
"content": "<div class=\"newfold-notice notice notice-warning\" style=\"position:relative;\"><p>Here is a notice it should display everywhere in the app and in wp-admin! <button type=\"button\" data-action=\"close\" class=\"notice-dismiss\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button><\/p><\/div>"
},
{
"id": "test-expired",
"locations": [
{
"context": Cypress.env('pluginId') + "-plugin",
"pages": "all"
}
],
"expiration": 1649860279240,
"content": "<div class=\"newfold-notice notice notice-error\" style=\"position:relative;\"><p>Here is an expired notice it should never display anywhere even though it has location `all` <button type=\"button\" data-action=\"close\" class=\"notice-dismiss\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button><\/p><\/div>"
}
];

describe('Notifications', () => {
let appClass = '.' + Cypress.env('appId');
Expand Down