blob: 32cbe20e1241084eb6c9add980d02e40d09ef442 [file] [log] [blame]
ys969316a9fce2020-01-19 13:50:02 +02001import { initCommonFixtures } from "../common/init";
2
3describe('The Composition Page', function () {
4
5 beforeEach(() => {
6 cy.server();
7 initCommonFixtures(cy);
8
9 cy.fixture('metadata-vf').as('metadata');
10 cy.fixture('full-data-vf').as('fullData');
11
12 cy.fixture('metadata-vf1').as('metadata1');
13 cy.fixture('full-data-vf1').as('fullData1');
14 })
15
16 it('VF Verify groups policies right panel tabs, name and Icon', function () {
17 cy.route('GET', '**/resources/*/filteredDataByParams?include=metadata', '@metadata');
18 cy.route('GET', '**/resources/*/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=nonExcludedPolicies&include=nonExcludedGroups', '@fullData');
19
20 const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/resource/composition/details';
21 cy.visit(compositionPageUrl);
22
23 cy.get('.sdc-composition-graph-wrapper').should('be.visible'); // it should show the correct number of elements on the canvas -- how to??
24
25 //Group / Policy
26 cy.get('.policy-zone .sdc-canvas-zone__counter').should('have.text', this.fullData.policies.length.toString()); //4 Policies
27 cy.get('.group-zone .sdc-canvas-zone__counter').should('have.html', this.fullData.groups.length.toString()); //2 Groups
28
29 //VF name & Icon
30 cy.get('[data-tests-id=selectedCompTitle]').should('contain', this.metadata.metadata.name);// Name is vf
31 cy.get('.icon').children('sdc-element-icon').children('div').children('svg-icon').should('exist');// Icon exist
32 cy.get('.icon').children('sdc-element-icon').children('div').children('svg-icon').should('have.attr', 'ng-reflect-name', 'defaulticon');
33 cy.get('.icon').children('sdc-element-icon').children('div').children('svg-icon').should('have.attr', 'ng-reflect-type','resources_24');
34 cy.get('.icon').children('sdc-element-icon').children('div').children('svg-icon').should('have.attr', 'ng-reflect-size','x_large');
35 cy.get('.icon').children('sdc-element-icon').children('div').children('svg-icon').should('have.attr', 'ng-reflect-background-shape','circle');
36 cy.get('.icon').children('sdc-element-icon').children('div').children('svg-icon').should('have.attr', 'ng-reflect-background-color','purple');
37
38 //Verify the below tabs exist for VF
39 cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text=Information]').should('exist');//General Info Tab Exist
40 cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Deployment Artifacts"]').should('exist');//General Info Tab Exist
41 cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text=Properties]').should('exist');//General Info Tab Exist
42 cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Information Artifacts"]').should('exist');//General Info Tab Exist
43 cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Requirements and Capabilities"]').should('exist');//General Info Tab Exist
44
45 cy.get('[data-tests-id="leftPalette.category.Generic"]').should('exist');
46 cy.get('[data-tests-id="leftPalette.category.Generic"]').children().get('.sdc-accordion-header').should('exist');
47 cy.get('[data-tests-id="leftPalette.category.Generic"]').children().get('.sdc-accordion-header').first().trigger('click');
48
49
50 // //Drag & Drop
51 // cy.get('[data-tests-id="extContrailCP"]').children('palette-element').children('div').trigger("mousedown", { which: 1 })
52 // .trigger("mousemove", { which: 1, clientX: 200, clientY: 200})
53 // .trigger("mouseup")
54
55 })
56
57 it('successfully loads VF', function () {
58 //Verify can change ShayTestVF from V1.0 to V1.1
59 //Verify the right panel properties
60
61 cy.route('GET', '**/resources/*/filteredDataByParams?include=metadata', '@metadata1');
62 cy.route('GET', '**/resources/*/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=nonExcludedPolicies&include=nonExcludedGroups', '@fullData1');
63
64 const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/resource/composition/details'
65 cy.visit(compositionPageUrl);
66
67 cy.get('.sdc-composition-graph-wrapper').should('be.visible'); // it should show the correct number of elements on the canvas -- how to??
68
69
70 // TODO:
71 // 1. Verify element exist on Canvas
72 // 2. Drag and drop new Element
73
74
75 // //Drag & Drop
76 // // cy.get('[data-tests-id="Port"]').children('palette-element').children('div').children('sdc-element-icon').trigger("mousedown", { which: 1 })
77 // cy.get('[data-tests-id="extContrailCP"]').children('palette-element').children('div').trigger("mousedown", { which: 1 })
78 // // cy.get('.zoom-icons').first()
79 // .trigger("mousemove", { which: 1, clientX: 200, clientY: 200})
80 // // .trigger("mousemove")
81 // .trigger("mouseup")
82
83 })
84
85 // it('can add a deployment artifact', function() {
86
87 // });
88 // it('can delete a deployment artifact', function() {
89
90 // });
91 // it('can delete a component instance on the canvas', function() {
92
93 // });
94 // it('can add a component instance to the canvas', function() {
95
96 // });
97 // it('can add a group', function() {
98
99 // });
100 // it('can add targets to a group', function() {
101
102 // });
103
104})