]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | import { PoolPageHelper } from '../pools/pools.po'; |
2 | import { ImagesPageHelper } from './images.po'; | |
11fdf7f2 TL |
3 | |
4 | describe('Images page', () => { | |
9f95a23c TL |
5 | let pools: PoolPageHelper; |
6 | let images: ImagesPageHelper; | |
11fdf7f2 TL |
7 | |
8 | beforeAll(() => { | |
9f95a23c TL |
9 | images = new ImagesPageHelper(); |
10 | pools = new PoolPageHelper(); | |
11fdf7f2 TL |
11 | }); |
12 | ||
9f95a23c TL |
13 | afterEach(async () => { |
14 | await ImagesPageHelper.checkConsole(); | |
11fdf7f2 TL |
15 | }); |
16 | ||
17 | describe('breadcrumb and tab tests', () => { | |
9f95a23c TL |
18 | beforeAll(async () => { |
19 | await images.navigateTo(); | |
11fdf7f2 TL |
20 | }); |
21 | ||
9f95a23c TL |
22 | it('should open and show breadcrumb', async () => { |
23 | await images.waitTextToBePresent(images.getBreadcrumb(), 'Images'); | |
11fdf7f2 TL |
24 | }); |
25 | ||
9f95a23c TL |
26 | it('should show four tabs', async () => { |
27 | await expect(images.getTabsCount()).toEqual(4); | |
11fdf7f2 TL |
28 | }); |
29 | ||
9f95a23c TL |
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); | |
11fdf7f2 TL |
114 | }); |
115 | }); | |
116 | }); |