Skip to content

Commit ecd57a6

Browse files
HejdaJakubxflord
authored andcommitted
test(admin): fixing the failing E2E tests
* New path to advanced settings (and related logic) broke some tests, so it it fixed now. * Removed skip from tests which were failing due to the bug with privileges because this bug has been already fixed IMHO (I think it was related to the refreshing roles on BE where we have done some changes to avoid PrivilegeException). * Fixed some 'hidden' items covered by another item (like header).
1 parent 21ef021 commit ecd57a6

File tree

13 files changed

+157
-192
lines changed

13 files changed

+157
-192
lines changed

apps/admin-gui-e2e/src/e2e/admin/perun-admin.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe('Perun admin management with role Perun admin', () => {
188188
.get(`[data-cy=${dbServiceName2.toLowerCase()}-name-td]`)
189189
.click()
190190
.get('[data-cy=service-edit-button]')
191-
.click()
191+
.click({force: true})
192192
.get('[data-cy=service-name-input]')
193193
.clear()
194194
.type(dbServiceName2 + 'edit', {force: true})

apps/admin-gui-e2e/src/e2e/facilities/facility-admin.cy.js

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -176,63 +176,62 @@ describe('Facility management with role Facility admin', () => {
176176
.should('not.exist');
177177
});
178178

179-
it('test add facility manager', () => {
180-
cy.intercept('**/facilitiesManager/getEnrichedFacilities')
181-
.as('getEnrichedFacilities')
182-
.intercept('**/usersManager/findRichUsersWithAttributes?**')
183-
.as('findRichUsers')
184-
// .wait('@getEnrichedFacilities')
185-
.get('[data-cy=filter-input]')
186-
.type(dbFacilityName2, {force: true})
187-
.get(`[data-cy=${dbFacilityName2}]`)
188-
.click()
189-
.get('[data-cy=advanced-settings]')
190-
.click()
191-
.get('[data-cy=managers]')
192-
.click()
193-
.get('[data-cy=add-manager-button]')
194-
.click()
195-
.get('[data-cy=search-manager-input]')
196-
.type(addManagerUser, {force: true})
197-
.get('[data-cy=search-manager-button]')
198-
.click()
199-
.wait('@findRichUsers')
200-
.get(`[data-cy=${addManagerUser}-checkbox]`)
201-
.click()
202-
.get('[data-cy=add-manager-button-dialog]')
203-
.click()
204-
.intercept('**/authzResolver/getRichAdmins?**')
205-
.as('getRichAdmins')
206-
.wait('@getRichAdmins')
207-
// assert that manager was added
208-
.get(`[data-cy=${addManagerUser}-checkbox]`)
209-
.should('exist');
210-
});
179+
context('Advanced settings', () => {
211180

212-
it('test remove facility manager', () => {
213-
cy.intercept('**/facilitiesManager/getEnrichedFacilities')
214-
.as('getEnrichedFacilities')
215-
// .wait('@getEnrichedFacilities')
216-
.get('[data-cy=filter-input]')
217-
.type(dbFacilityName2, {force: true})
218-
.get(`[data-cy=${dbFacilityName2}]`)
219-
.click()
220-
.get('[data-cy=advanced-settings]')
221-
.click()
222-
.get('[data-cy=managers]')
223-
.click()
224-
.get(`[data-cy=${removeManagerUser}-checkbox]`)
225-
.click()
226-
.get('[data-cy=remove-manager-button]')
227-
.should('have.attr', 'color', 'warn') // check if the button is enabled (due to the force click below)
228-
.click({ force: true })
229-
.get('[data-cy=remove-manager-button-dialog]')
230-
.click()
231-
.intercept('**/authzResolver/getRichAdmins?**')
232-
.as('getRichAdmins')
233-
.wait('@getRichAdmins')
234-
// assert that manager doesn't exist
235-
.get(`[data-cy=${removeManagerUser}-checkbox]`)
236-
.should('not.exist');
181+
it('test add facility manager', () => {
182+
cy.intercept('**/facilitiesManager/getEnrichedFacilities')
183+
.as('getEnrichedFacilities')
184+
.intercept('**/usersManager/findRichUsersWithAttributes?**')
185+
.as('findRichUsers')
186+
// .wait('@getEnrichedFacilities')
187+
.get('[data-cy=filter-input]')
188+
.type(dbFacilityName2, {force: true})
189+
.get(`[data-cy=${dbFacilityName2}]`)
190+
.click()
191+
.get('[data-cy=managers]')
192+
.click()
193+
.get('[data-cy=add-manager-button]')
194+
.click()
195+
.get('[data-cy=search-manager-input]')
196+
.type(addManagerUser, {force: true})
197+
.get('[data-cy=search-manager-button]')
198+
.click()
199+
.wait('@findRichUsers')
200+
.get(`[data-cy=${addManagerUser}-checkbox]`)
201+
.click()
202+
.get('[data-cy=add-manager-button-dialog]')
203+
.click()
204+
.intercept('**/authzResolver/getRichAdmins?**')
205+
.as('getRichAdmins')
206+
.wait('@getRichAdmins')
207+
// assert that manager was added
208+
.get(`[data-cy=${addManagerUser}-checkbox]`)
209+
.should('exist');
210+
});
211+
212+
it('test remove facility manager', () => {
213+
cy.intercept('**/facilitiesManager/getEnrichedFacilities')
214+
.as('getEnrichedFacilities')
215+
// .wait('@getEnrichedFacilities')
216+
.get('[data-cy=filter-input]')
217+
.type(dbFacilityName2, {force: true})
218+
.get(`[data-cy=${dbFacilityName2}]`)
219+
.click()
220+
.get('[data-cy=managers]')
221+
.click()
222+
.get(`[data-cy=${removeManagerUser}-checkbox]`)
223+
.click()
224+
.get('[data-cy=remove-manager-button]')
225+
.should('have.attr', 'color', 'warn') // check if the button is enabled (due to the force click below)
226+
.click({ force: true })
227+
.get('[data-cy=remove-manager-button-dialog]')
228+
.click()
229+
.intercept('**/authzResolver/getRichAdmins?**')
230+
.as('getRichAdmins')
231+
.wait('@getRichAdmins')
232+
// assert that manager doesn't exist
233+
.get(`[data-cy=${removeManagerUser}-checkbox]`)
234+
.should('not.exist');
235+
});
237236
});
238237
});

apps/admin-gui-e2e/src/e2e/facilities/facility-observer.cy.js

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ describe('Facility management with role Facility observer', () => {
3636
.should('exist')
3737
});
3838

39-
//FIXME: same problem as in the test below
40-
it.skip('test list assigned users', () => {
39+
it('test list assigned users', () => {
4140
cy.get('[data-cy=assigned-users]')
4241
.click()
4342
.get('[data-cy=filter-input]')
@@ -49,12 +48,7 @@ describe('Facility management with role Facility observer', () => {
4948
.should('exist')
5049
});
5150

52-
//FIXME: this test often fails when it is executed from command line (but NOT from UI)
53-
// There is problem with policies - test sometimes fails with error "You are not
54-
// authorized to perform this action", but according to getPerunPrincipal() method
55-
// there should be the privilege for given facility and called method (getAllowedGroups).
56-
// For the correct run in CI this test was skipped for this moment
57-
it.skip('test list allowed groups', () => {
51+
it('test list allowed groups', () => {
5852
cy.get('[data-cy=allowed-groups]')
5953
.click()
6054
.reload()
@@ -103,23 +97,22 @@ describe('Facility management with role Facility observer', () => {
10397
.should('exist')
10498
});
10599

106-
it('test list owners', () => {
107-
cy.get('[data-cy=advanced-settings]')
108-
.click()
109-
.get('[data-cy=owners]')
110-
.click()
111-
.get('[data-cy=filter-input]')
112-
.type(dbOwnerName, {force: true})
113-
.get(`[data-cy=${dbOwnerName}]`)
114-
.should('exist')
115-
});
100+
context('Advanced settings', () => {
116101

117-
it('test list managers', () => {
118-
cy.get('[data-cy=advanced-settings]')
119-
.click()
120-
.get('[data-cy=managers]')
121-
.click()
122-
.get(`[data-cy=${dbManagerFirstName}-firstName-td]`)
123-
.should('exist')
102+
it('test list owners', () => {
103+
cy.get('[data-cy=owners]')
104+
.click()
105+
.get('[data-cy=filter-input]')
106+
.type(dbOwnerName, {force: true})
107+
.get(`[data-cy=${dbOwnerName}]`)
108+
.should('exist')
109+
});
110+
111+
it('test list managers', () => {
112+
cy.get('[data-cy=managers]')
113+
.click()
114+
.get(`[data-cy=${dbManagerFirstName}-firstName-td]`)
115+
.should('exist')
116+
});
124117
});
125118
});

apps/admin-gui-e2e/src/e2e/groups/group-admin.cy.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ describe('Group management with role Group admin', () => {
8282
.get('[data-cy=attributes]')
8383
.click()
8484
.get('[data-cy=add-attributes]')
85-
.click()
85+
.should('be.enabled')
86+
.click({force: true})
8687
.get('.mat-mdc-dialog-container')
8788
.find('[data-cy=filter-input]') // finds the data-cy attribute inside the dialog container
8889
.type('footer', {force: true})
@@ -176,13 +177,8 @@ describe('Group management with role Group admin', () => {
176177
});
177178

178179
context('Advanced settings', () => {
179-
beforeEach(() => {
180-
cy.get('[data-cy=advanced-settings]')
181-
.click();
182-
});
183180

184-
// TODO fix - randomly failing due to a bug with privileges
185-
it.skip('test create group application form item', () => {
181+
it('test create group application form item', () => {
186182
cy.intercept('**/registrarManager/updateFormItems/**')
187183
.as('addFormItem')
188184
.get('[data-cy=application-form]')
@@ -209,8 +205,7 @@ describe('Group management with role Group admin', () => {
209205
.should('exist');
210206
});
211207

212-
// TODO fix - randomly failing due to a bug with privileges
213-
it.skip('test delete group application form item', () => {
208+
it('test delete group application form item', () => {
214209
cy.intercept('**/registrarManager/updateFormItems/**')
215210
.as('deleteFormItem')
216211
.get('[data-cy=application-form]')

apps/admin-gui-e2e/src/e2e/groups/group-observer.cy.js

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,9 @@ describe('Group management with role Group observer', () => {
4242
.should('exist')
4343
});
4444

45-
it('test list managers', () => {
46-
cy.get('[data-cy=advanced-settings]')
47-
.click()
48-
.get('[data-cy=managers]')
49-
.click()
50-
.get(`[data-cy=${dbGroupAdmin}-firstName-td]`)
51-
.should('exist')
52-
});
53-
54-
it('test list extsources', () => {
55-
cy.get('[data-cy=advanced-settings]')
56-
.click()
57-
.get('[data-cy=external-sources]')
58-
.click()
59-
.get('[data-cy=filter-input]')
60-
.type(dbExtsource, {force: true})
61-
.get(`[data-cy=${dbExtsource}-name-td]`)
62-
.should('exist')
63-
});
64-
6545
it('test list vo members', () => {
6646
cy.get('[data-cy=vo-link]')
6747
.click({force: true})
68-
//FIXME: this is just a quick fix to reload the page cause there is a problem with policies otherwise
69-
// this problem occurs only during the test not in real usage of admin-gui application
70-
.reload()
7148
.get('[data-cy=members]')
7249
.click()
7350
.get('[data-cy=filter-input]')
@@ -79,15 +56,6 @@ describe('Group management with role Group observer', () => {
7956
.should('exist')
8057
});
8158

82-
it('test get application form', () => {
83-
cy.get('[data-cy=advanced-settings]')
84-
.click()
85-
.get('[data-cy=application-form]')
86-
.click()
87-
.get(`[data-cy=${dbApplicationItemTextFieldName}-shortname-td]`)
88-
.should('exist')
89-
});
90-
9159
it('test list applications', () => {
9260
cy.get('[data-cy=applications]')
9361
.click()
@@ -97,4 +65,29 @@ describe('Group management with role Group observer', () => {
9765
.should('exist')
9866
});
9967

68+
context('Advanced settings', () => {
69+
70+
it('test list managers', () => {
71+
cy.get('[data-cy=managers]')
72+
.click()
73+
.get(`[data-cy=${dbGroupAdmin}-firstName-td]`)
74+
.should('exist')
75+
});
76+
77+
it('test list extsources', () => {
78+
cy.get('[data-cy=external-sources]')
79+
.click()
80+
.get('[data-cy=filter-input]')
81+
.type(dbExtsource, {force: true})
82+
.get(`[data-cy=${dbExtsource}-name-td]`)
83+
.should('exist')
84+
});
85+
86+
it('test get application form', () => {
87+
cy.get('[data-cy=application-form]')
88+
.click()
89+
.get(`[data-cy=${dbApplicationItemTextFieldName}-shortname-td]`)
90+
.should('exist')
91+
});
92+
});
10093
});

0 commit comments

Comments
 (0)