mirror of
https://github.com/mattermost/mattermost.git
synced 2026-03-02 21:31:09 -05:00
14 lines
540 B
TypeScript
14 lines
540 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
// Stub the browser notification API with the given name and permission
|
|
export function spyNotificationAs(name: string, permission: NotificationPermission) {
|
|
cy.window().then((win) => {
|
|
win.Notification = Notification;
|
|
win.Notification.requestPermission = () => Promise.resolve(permission);
|
|
|
|
cy.stub(win, 'Notification').as(name);
|
|
});
|
|
|
|
cy.window().should('have.property', 'Notification');
|
|
}
|