summaryrefslogtreecommitdiffstats
path: root/catalog-ui/cypress/integration/collapsing_roles-certified_life_cycle_buttons.js
blob: 9e806d1ab0326b2947423e9fbe3a460f278ac1fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
import { initCommonFixtures } from "../common/init";

describe('Collapsing Roles', () => {
  beforeEach(() => {
    cy.server();
    initCommonFixtures(cy);

    cy.fixture('common/service-metadata').as('serviceMetaData');
    cy.fixture('common/vf-metadata').as('vfMetaData');
    cy.fixture('common/service-certifyResponse').as('serviceCertifyResponse');
    cy.fixture('common/dependencies').as('dependenciesResponse');
    cy.fixture('common/packages').as('packagesResponse');
  });

  it('Service - Verify UpdateServices, CheckOut, Distribute and Archive exist for a Certified Service that was not Distributed', function () {
    cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@serviceMetaData');
    cy.route('GET', '**/services/*/dependencies',[]);

    this.serviceMetaData.metadata.distributionStatus = 'DISTRIBUTION_NOT_APPROVED';

    const generalPageUrl = '#!/dashboard/workspace/' + this.serviceMetaData.metadata.uniqueId + '/service/general';
    cy.visit(generalPageUrl);

    console.log('Verify life cycle is Distribution Approved');
    cy.get('[data-tests-id="formlifecyclestate"]').should('be.visible');
    cy.get('[data-tests-id="formlifecyclestate"]').should('have.text','Waiting For Distribution');

    console.log('Verify Upgrade Services Button');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.visible');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('have.text','Update Services');

    console.log('Verify Distribute Services Button');
    cy.get('[data-tests-id="distribute"]').should('be.visible');
    cy.get('[data-tests-id="distribute"]').should('contain.text','Distribute');

    console.log('Verify Check Out Button');
    cy.get('[data-tests-id="check_out"]').should('be.visible');
    cy.get('[data-tests-id="check_out"]').should('contain.text','Check Out');

    console.log('Verify Archive Button');
    cy.get('[data-tests-id="archive-component-button"]').should('be.visible');
    cy.get('[data-tests-id="archive-component-button"]').should('have.text','Archive');

    console.log('Verify Redistribute Button Not Exist');
    cy.get('[data-tests-id="redistribute"]').should('not.be.visible');
    cy.get('[data-tests-id="redistribute"]').should('not.exist');

    console.log("Verify that Certify button does not exist")
    cy.get('[data-tests-id="certify"]').should('not.be.visible');
  });

  it('Service - Verify UpdateServices, CheckOut, Redistribute and Archive exist for a Certified Service that was Distributed', function () {
    cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@serviceMetaData');
    cy.route('GET', '**/services/*/dependencies',[]);

    this.serviceMetaData.metadata.distributionStatus = 'DISTRIBUTED';

    const generalPageUrl = '#!/dashboard/workspace/' + this.serviceMetaData.metadata.uniqueId + '/service/general';
    cy.visit(generalPageUrl);

    console.log('Verify life cycle is Distribution Approved');
    cy.get('[data-tests-id="formlifecyclestate"]').should('be.visible');
    cy.get('[data-tests-id="formlifecyclestate"]').should('have.text','Distributed');

    console.log('Verify Upgrade Services Button');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.visible');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('have.text','Update Services');

    console.log('Verify Distribute Services Button');
    cy.get('[data-tests-id="redistribute"]').should('be.visible');
    cy.get('[data-tests-id="redistribute"]').should('contain.text','Redistribute');

    console.log('Verify Check Out Button');
    cy.get('[data-tests-id="check_out"]').should('be.visible');
    cy.get('[data-tests-id="check_out"]').should('contain.text','Check Out');

    console.log('Verify Archive Button');
    cy.get('[data-tests-id="archive-component-button"]').should('be.visible');
    cy.get('[data-tests-id="archive-component-button"]').should('have.text','Archive');

    console.log('Verify Distribute Button Not Exist');
    cy.get('[data-tests-id="distribute"]').should('not.be.visible');
    cy.get('[data-tests-id="distribute"]').should('not.exist');

    console.log("Verify that Certify button does not exist")
    cy.get('[data-tests-id="certify"]').should('not.be.visible');
  });

  it('Service - Verify UpdateServices button is disabled in case there are no Dependencies for a Certified Service', function () {
    cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@serviceMetaData');
    cy.route('GET', '**/services/*/dependencies',[{dependencies: null}]);

    this.serviceMetaData.metadata.distributionStatus = 'DISTRIBUTED';

    const generalPageUrl = '#!/dashboard/workspace/' + this.serviceMetaData.metadata.uniqueId + '/service/general';
    cy.visit(generalPageUrl);

    console.log('Verify life cycle is Distribution Approved');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.visible');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.disabled');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('have.text','Update Services');

    console.log("Verify that Certify button does not exist")
    cy.get('[data-tests-id="certify"]').should('not.be.visible');
  });

  it('Service - Verify UpdateServices button is enabled in case there are Dependencies for a Certified Service', function () {
    cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@serviceMetaData');
    cy.route('GET', '**/services/*/dependencies',[{dependencies: {}}]);

    this.serviceMetaData.metadata.distributionStatus = 'DISTRIBUTED';

    const generalPageUrl = '#!/dashboard/workspace/' + this.serviceMetaData.metadata.uniqueId + '/service/general';
    cy.visit(generalPageUrl);

    console.log('Verify life cycle is Distribution Approved');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.visible');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.enabled');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('have.text','Update Services');

    console.log("Verify that Certify button does not exist")
    cy.get('[data-tests-id="certify"]').should('not.be.visible');
  });

  it('Service - Verify UpdateServices Not exist and Certify Exist in case Service is in state NOT_CERTIFIED_CHECKOUT', function () {
    cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@serviceMetaData');
    cy.route('GET', '**/services/*/dependencies',[{dependencies: {}}]);

    this.serviceMetaData.metadata.lifecycleState = 'NOT_CERTIFIED_CHECKOUT';

    const generalPageUrl = '#!/dashboard/workspace/' + this.serviceMetaData.metadata.uniqueId + '/service/general';
    cy.visit(generalPageUrl);

    console.log('Verify life cycle is Distribution Approved');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('not.be.visible');

    cy.get('[data-tests-id="certify"]').should('be.visible').click();
    cy.get('[data-tests-id="checkindialog"]').should('be.visible');
  });

  it('Service - Verify UpdateServices Not exist and Certify Exist in case Service is in state NOT_CERTIFIED_CHECKIN', function () {
    cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@serviceMetaData');
    cy.route('GET', '**/services/*/dependencies',[{dependencies: {}}]);

    this.serviceMetaData.metadata.lifecycleState = 'NOT_CERTIFIED_CHECKIN';

    const generalPageUrl = '#!/dashboard/workspace/' + this.serviceMetaData.metadata.uniqueId + '/service/general';
    cy.visit(generalPageUrl);

    cy.get('[data-tests-id="certify"]').should('be.visible').click();
    cy.get('[data-tests-id="checkindialog"]').should('be.visible');
  });


  it('Service - When Service is being Certified, and has Dependencies, Update Service modal will be opened automatically', function () {
      cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@serviceMetaData');
      cy.route('GET', '**/services/*/dependencies','@dependenciesResponse');
      cy.route('POST', '**/services/*/lifecycleState/certify','@serviceCertifyResponse');
      cy.route('GET', '**/catalog/services/validate-name/*', { isValid: true})
      this.serviceMetaData.metadata.lifecycleState = 'NOT_CERTIFIED_CHECKOUT';

      const generalPageUrl = '#!/dashboard/workspace/' + this.serviceMetaData.metadata.uniqueId + '/service/general';
      cy.visit(generalPageUrl);

      console.log('Verify life cycle is Distribution Approved');
      cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('not.be.visible');

      console.log('Click Certify');
      cy.get('[data-tests-id="certify"]').should('be.visible').click();

      console.log('Insert confirm text');
      cy.get('[data-tests-id="checkindialog"]').should('be.visible').type('Test_1234');

      console.log('Click OK');
      cy.get('[data-tests-id="confirm-modal-button-ok"]').should('be.visible').click();

      console.log('Close the Modal');
      cy.get('[data-tests-id="upgradeVspModal-button-close"]').should('be.visible').click();
  });

  it('VF - Verify Certify and Check in exist for a NOT_CERTIFIED_CHECKOUT VF', function () {
    cy.route('GET', '**/resources/*/filteredDataByParams?include=metadata', '@vfMetaData');
    cy.route('GET', '**/onboarding-api/*/vendor-software-products/packages', '@packagesResponse');

    const generalPageUrl = '#!/dashboard/workspace/' + this.vfMetaData.metadata.uniqueId + '/resource/general';
    cy.visit(generalPageUrl);

    console.log('Verify life cycle is IN DESIGN CHECK OUT');
    cy.get('[data-tests-id="formlifecyclestate"]').should('be.visible');
    cy.get('[data-tests-id="formlifecyclestate"]').should('have.text','In Design Check Out');

    console.log('Verify Certify button exist');
    cy.get('[data-tests-id="certify"]').should('be.visible').click();
    cy.get('[data-tests-id="checkindialog"]').should('be.visible');

    console.log('Verify Check in button exist');
    cy.get('[data-tests-id="check_in"]').should('be.visible');

   });

  it('VF - Verify Certify and Check out exist for a NOT_CERTIFIED_CHECKOUT VF', function () {
    cy.route('GET', '**/resources/*/filteredDataByParams?include=metadata', '@vfMetaData');
    cy.route('GET', '**/onboarding-api/*/vendor-software-products/packages', '@packagesResponse');

    this.vfMetaData.metadata.lifecycleState = 'NOT_CERTIFIED_CHECKIN';

    const generalPageUrl = '#!/dashboard/workspace/' + this.vfMetaData.metadata.uniqueId + '/resource/general';
    cy.visit(generalPageUrl);

    console.log('Verify life cycle is IN DESIGN CHECK IN');
    cy.get('[data-tests-id="formlifecyclestate"]').should('be.visible');
    cy.get('[data-tests-id="formlifecyclestate"]').should('have.text','In Design Check In');

    console.log('Verify Certify button exist');
    cy.get('[data-tests-id="certify"]').should('be.visible').click();
    cy.get('[data-tests-id="checkindialog"]').should('be.visible');

    console.log('Verify Check Out button exist');
    cy.get('[data-tests-id="check_out"]').should('be.visible');

   });

  it('VF - Verify UpgradeServices is Disabled in case there are no Dependencies for a Certified VF', function () {
      cy.route('GET', '**/resources/*/filteredDataByParams?include=metadata', '@vfMetaData');
      cy.route('GET', '**/resources/*/dependencies',[{dependencies: null}]);

        this.vfMetaData.metadata.lifecycleState = 'CERTIFIED';

      const generalPageUrl = '#!/dashboard/workspace/' + this.vfMetaData.metadata.uniqueId + '/resource/general';
      cy.visit(generalPageUrl);

        console.log('Verify life cycle is Certified');
        cy.get('[data-tests-id="formlifecyclestate"]').should('be.visible');
        cy.get('[data-tests-id="formlifecyclestate"]').should('have.text','Certified');

        console.log('Verify life cycle is Distribution Approved');
        cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.visible');
        cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.disabled');
        cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('have.text','Upgrade Services');

        console.log('Verify Check Out button exist');
        cy.get('[data-tests-id="check_out"]').should('be.visible');

        console.log('Verify Archive Button');
        cy.get('[data-tests-id="archive-component-button"]').should('be.visible');
        cy.get('[data-tests-id="archive-component-button"]').should('have.text','Archive');

    });

  it('VF - Verify UpgradeServices is Enabled and Modal is opened in case there are no Dependencies for a Certified VF', function () {
    cy.route('GET', '**/resources/*/filteredDataByParams?include=metadata', '@vfMetaData');
    cy.route('GET', '**/resources/*/dependencies',[{dependencies: {}}]);
    cy.route('GET', '**/onboarding-api/*/vendor-software-products/packages', '@packagesResponse');

    this.vfMetaData.metadata.lifecycleState = 'CERTIFIED';

    const generalPageUrl = '#!/dashboard/workspace/' + this.vfMetaData.metadata.uniqueId + '/resource/general';
    cy.visit(generalPageUrl);

    console.log('Verify life cycle is Certified');
    cy.get('[data-tests-id="formlifecyclestate"]').should('be.visible');
    cy.get('[data-tests-id="formlifecyclestate"]').should('have.text','Certified');

    console.log('Verify life cycle is Distribution Approved');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.visible');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('be.enabled');
    cy.get('[data-tests-id="open-upgrade-vsp-popup"]').should('have.text','Upgrade Services').click();
    cy.get('[class="sdc-modal__wrapper sdc-modal-type-custom"]').should('be.visible');
    cy.get('[data-tests-id="upgradeVspModal-button-close"]').should('be.enabled').click();

    console.log('Verify Check Out button exist');
    cy.get('[data-tests-id="check_out"]').should('be.visible');

    console.log('Verify Archive Button');
    cy.get('[data-tests-id="archive-component-button"]').should('be.visible');
    cy.get('[data-tests-id="archive-component-button"]').should('have.text','Archive');

  });

});