]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/e2e/block/images.e2e-spec.ts
d/control: depend on python3-yaml for ceph-mgr
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / e2e / block / images.e2e-spec.ts
1 import { PoolPageHelper } from '../pools/pools.po';
2 import { ImagesPageHelper } from './images.po';
3
4 describe('Images page', () => {
5 let pools: PoolPageHelper;
6 let images: ImagesPageHelper;
7
8 beforeAll(() => {
9 images = new ImagesPageHelper();
10 pools = new PoolPageHelper();
11 });
12
13 afterEach(async () => {
14 await ImagesPageHelper.checkConsole();
15 });
16
17 describe('breadcrumb and tab tests', () => {
18 beforeAll(async () => {
19 await images.navigateTo();
20 });
21
22 it('should open and show breadcrumb', async () => {
23 await images.waitTextToBePresent(images.getBreadcrumb(), 'Images');
24 });
25
26 it('should show four tabs', async () => {
27 await expect(images.getTabsCount()).toEqual(4);
28 });
29
30 it('should show text for all tabs', async () => {
31 await expect(images.getTabText(0)).toEqual('Images');
32 await expect(images.getTabText(1)).toEqual('Namespaces');
33 await expect(images.getTabText(2)).toEqual('Trash');
34 await expect(images.getTabText(3)).toEqual('Overall Performance');
35 });
36 });
37
38 describe('create, edit & delete image test', () => {
39 const poolName = 'e2e_images_pool';
40 const imageName = 'e2e_images#image';
41 const newImageName = 'e2e_images#image_new';
42
43 beforeAll(async () => {
44 await pools.navigateTo('create'); // Need pool for image testing
45 await pools.create(poolName, 8, 'rbd');
46 await pools.navigateTo();
47 await pools.exist(poolName, true);
48 await images.navigateTo();
49 });
50
51 it('should create image', async () => {
52 await images.createImage(imageName, poolName, '1');
53 await expect(images.getFirstTableCellWithText(imageName).isPresent()).toBe(true);
54 });
55
56 it('should edit image', async () => {
57 await images.editImage(imageName, poolName, newImageName, '2');
58 await expect(images.getFirstTableCellWithText(newImageName).isPresent()).toBe(true);
59 });
60
61 it('should delete image', async () => {
62 await images.navigateTo();
63 await images.delete(newImageName);
64 });
65
66 afterAll(async () => {
67 await pools.navigateTo();
68 await pools.delete(poolName);
69 });
70 });
71
72 describe('move to trash, restore and purge image tests', () => {
73 const poolName = 'trash_pool';
74 const imageName = 'trash#image';
75 const newImageName = 'newtrash#image';
76
77 beforeAll(async () => {
78 await pools.navigateTo('create'); // Need pool for image testing
79 await pools.create(poolName, 8, 'rbd');
80 await pools.navigateTo();
81 await pools.exist(poolName, true);
82
83 await images.navigateTo(); // Need image for trash testing
84 await images.createImage(imageName, poolName, '1');
85 await expect(images.getFirstTableCellWithText(imageName).isPresent()).toBe(true);
86 });
87
88 it('should move the image to the trash', async () => {
89 await images.moveToTrash(imageName);
90 await expect(images.getFirstTableCellWithText(imageName).isPresent()).toBe(true);
91 });
92
93 it('should restore image to images table', async () => {
94 await images.restoreImage(imageName, newImageName);
95 await expect(images.getFirstTableCellWithText(newImageName).isPresent()).toBe(true);
96 });
97
98 it('should purge trash in images trash tab', async () => {
99 await images.navigateTo();
100 // Have had issues with image not restoring fast enough, thus these tests/waits are here
101 await images.waitPresence(
102 images.getFirstTableCellWithText(newImageName),
103 'Timed out waiting for image to restore'
104 );
105 await images.moveToTrash(newImageName);
106 await images.purgeTrash(newImageName, poolName);
107 });
108
109 afterAll(async () => {
110 await pools.navigateTo();
111 await pools.delete(poolName); // Deletes images test pool
112 await pools.navigateTo();
113 await pools.exist(poolName, false);
114 });
115 });
116 });