1 import { PoolPageHelper } from '../pools/pools.po';
2 import { ImagesPageHelper } from './images.po';
4 describe('Images page', () => {
5 let pools: PoolPageHelper;
6 let images: ImagesPageHelper;
9 images = new ImagesPageHelper();
10 pools = new PoolPageHelper();
13 afterEach(async () => {
14 await ImagesPageHelper.checkConsole();
17 describe('breadcrumb and tab tests', () => {
18 beforeAll(async () => {
19 await images.navigateTo();
22 it('should open and show breadcrumb', async () => {
23 await images.waitTextToBePresent(images.getBreadcrumb(), 'Images');
26 it('should show four tabs', async () => {
27 await expect(images.getTabsCount()).toEqual(4);
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');
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';
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();
51 it('should create image', async () => {
52 await images.createImage(imageName, poolName, '1');
53 await expect(images.getFirstTableCellWithText(imageName).isPresent()).toBe(true);
56 it('should edit image', async () => {
57 await images.editImage(imageName, poolName, newImageName, '2');
58 await expect(images.getFirstTableCellWithText(newImageName).isPresent()).toBe(true);
61 it('should delete image', async () => {
62 await images.navigateTo();
63 await images.delete(newImageName);
66 afterAll(async () => {
67 await pools.navigateTo();
68 await pools.delete(poolName);
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';
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);
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);
88 it('should move the image to the trash', async () => {
89 await images.moveToTrash(imageName);
90 await expect(images.getFirstTableCellWithText(imageName).isPresent()).toBe(true);
93 it('should restore image to images table', async () => {
94 await images.restoreImage(imageName, newImageName);
95 await expect(images.getFirstTableCellWithText(newImageName).isPresent()).toBe(true);
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'
105 await images.moveToTrash(newImageName);
106 await images.purgeTrash(newImageName, poolName);
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);