]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/block/images.e2e-spec.ts
import ceph 16.2.7
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / cypress / integration / block / images.e2e-spec.ts
1 import { PoolPageHelper } from '../pools/pools.po';
2 import { ImagesPageHelper } from './images.po';
3
4 describe('Images page', () => {
5 const pools = new PoolPageHelper();
6 const images = new ImagesPageHelper();
7
8 const poolName = 'e2e_images_pool';
9
10 before(() => {
11 cy.login();
12 Cypress.Cookies.preserveOnce('token');
13 // Need pool for image testing
14 pools.navigateTo('create');
15 pools.create(poolName, 8, 'rbd');
16 pools.existTableCell(poolName);
17 });
18
19 after(() => {
20 // Deletes images test pool
21 pools.navigateTo();
22 pools.delete(poolName);
23 pools.navigateTo();
24 pools.existTableCell(poolName, false);
25 });
26
27 beforeEach(() => {
28 cy.login();
29 Cypress.Cookies.preserveOnce('token');
30 images.navigateTo();
31 });
32
33 it('should open and show breadcrumb', () => {
34 images.expectBreadcrumbText('Images');
35 });
36
37 it('should show four tabs', () => {
38 images.getTabsCount().should('eq', 4);
39 });
40
41 it('should show text for all tabs', () => {
42 images.getTabText(0).should('eq', 'Images');
43 images.getTabText(1).should('eq', 'Namespaces');
44 images.getTabText(2).should('eq', 'Trash');
45 images.getTabText(3).should('eq', 'Overall Performance');
46 });
47
48 describe('create, edit & delete image test', () => {
49 const imageName = 'e2e_images#image';
50 const newImageName = 'e2e_images#image_new';
51
52 it('should create image', () => {
53 images.createImage(imageName, poolName, '1');
54 images.getFirstTableCell(imageName).should('exist');
55 });
56
57 it('should edit image', () => {
58 images.editImage(imageName, poolName, newImageName, '2');
59 images.getFirstTableCell(newImageName).should('exist');
60 });
61
62 it('should delete image', () => {
63 images.delete(newImageName);
64 });
65 });
66
67 describe('move to trash, restore and purge image tests', () => {
68 const imageName = 'e2e_trash#image';
69 const newImageName = 'e2e_newtrash#image';
70
71 before(() => {
72 cy.login();
73 Cypress.Cookies.preserveOnce('token');
74 // Need image for trash testing
75 images.createImage(imageName, poolName, '1');
76 images.getFirstTableCell(imageName).should('exist');
77 });
78
79 it('should move the image to the trash', () => {
80 images.moveToTrash(imageName);
81 images.getFirstTableCell(imageName).should('exist');
82 });
83
84 it('should restore image to images table', () => {
85 images.restoreImage(imageName, newImageName);
86 images.getFirstTableCell(newImageName).should('exist');
87 });
88
89 it('should purge trash in images trash tab', () => {
90 images.getFirstTableCell(newImageName).should('exist');
91 images.moveToTrash(newImageName);
92 images.purgeTrash(newImageName, poolName);
93 });
94 });
95 });