]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/e2e/ui/notification.e2e-spec.ts
d/control: depend on python3-yaml for ceph-mgr
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / e2e / ui / notification.e2e-spec.ts
1 import { PoolPageHelper } from '../pools/pools.po';
2 import { NotificationSidebarPageHelper } from './notification.po';
3
4 describe('Notification page', () => {
5 let notification: NotificationSidebarPageHelper;
6 let pools: PoolPageHelper;
7
8 beforeAll(() => {
9 notification = new NotificationSidebarPageHelper();
10 pools = new PoolPageHelper();
11 });
12
13 afterEach(async () => {
14 await NotificationSidebarPageHelper.checkConsole();
15 });
16
17 it('should open notification sidebar', async () => {
18 await notification.waitInvisibility(notification.getSidebar());
19 await notification.open();
20 await notification.waitVisibility(notification.getSidebar());
21 });
22
23 it('should display a running task', async () => {
24 const poolName = 'e2e_notification_pool';
25
26 await pools.navigateTo('create');
27 await pools.create(poolName, 8);
28 await pools.edit_pool_pg(poolName, 4, false);
29 await notification.waitStaleness(notification.getToast());
30
31 // Check that running task is shown.
32 await notification.open();
33 await notification.waitFn(async () => {
34 const task = await notification.getTasks().first();
35 const text = await task.getText();
36 return text.includes(poolName);
37 }, 'Timed out verifying task.');
38
39 // Delete pool after task is complete (otherwise we get an error).
40 await notification.waitFn(
41 async () => {
42 const tasks = await notification.getTasks();
43 return tasks.length === 0 ? true : !(await tasks[0].getText()).includes(poolName);
44 },
45 'Timed out waiting for task to complete.',
46 40000
47 );
48 await pools.delete(poolName);
49 });
50
51 it('should have notifications', async () => {
52 await notification.open();
53 await expect((await notification.getNotifications()).length).toBeGreaterThan(0);
54 });
55
56 it('should clear notifications', async () => {
57 await notification.waitStaleness(notification.getToast());
58 await expect((await notification.getNotifications()).length).toBeGreaterThan(0);
59 await notification.waitVisibility(notification.getClearNotficationsBtn());
60
61 // It can happen that although notifications are cleared, by the time we check the
62 // notifications amount, another notification can appear, so we check it more than once (if needed).
63 await notification.waitClickableAndClick(notification.getClearNotficationsBtn());
64 await notification.waitFn(async () => {
65 const notifications = await notification.getNotifications();
66 if (notifications.length > 0) {
67 await notification.waitClickableAndClick(notification.getClearNotficationsBtn());
68 return false;
69 }
70 return true;
71 }, 'Timed out checking that notifications are cleared.');
72 });
73 });