Skip to content

Commit 66e18bf

Browse files
authored
fix: Module deletion (#3922)
* ucomment test * fix module delete * improve tests
1 parent 1c45673 commit 66e18bf

File tree

3 files changed

+45
-33
lines changed

3 files changed

+45
-33
lines changed

src/components/KymaModules/providers/KymaModuleProvider.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ export function KymaModuleContextProvider({
6969
singularName: 'Kyma',
7070
pluralKind: 'Kymas',
7171
resource: kymaResourceState,
72-
initialUnchangedResource: initialUnchangedResource,
72+
initialResource: initialUnchangedResource,
73+
updateInitialResource: setInitialUnchangedResource,
7374
createUrl: resourceUrl,
7475
afterCreatedFn: () =>
7576
notification.notifySuccess({

tests/integration/support/commands.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ Cypress.Commands.add(
168168
clearSearch = true,
169169
checkIfResourceIsRemoved = true,
170170
selectSearchResult = false,
171+
searchInPlainTableText = false,
171172
} = options;
172173

173174
cy.wait(500)
@@ -183,7 +184,15 @@ Cypress.Commands.add(
183184
.click();
184185
}
185186

186-
cy.checkItemOnGenericListLink(resourceName);
187+
if (searchInPlainTableText) {
188+
// TODO: Modules in tests are unmannaged and text is not in ui5-text component
189+
cy.get('ui5-table-row')
190+
.find('ui5-table-cell')
191+
.contains(resourceName)
192+
.should('be.visible');
193+
} else {
194+
cy.checkItemOnGenericListLink(resourceName);
195+
}
187196

188197
cy.get('ui5-button[data-testid="delete"]').click();
189198

@@ -198,19 +207,19 @@ Cypress.Commands.add(
198207
cy.contains('ui5-toast', /deleted/).should('be.visible');
199208
}
200209

201-
if (clearSearch) {
202-
cy.get('ui5-input[id="search-input"]:visible')
203-
.find('input')
204-
.wait(1000)
205-
.clear();
206-
}
207-
208210
if (checkIfResourceIsRemoved) {
209211
cy.get('ui5-table')
210212
.contains(resourceName)
211213
.should('not.exist');
212214
}
213215
}
216+
217+
if (clearSearch) {
218+
cy.get('ui5-input[id="search-input"]:visible')
219+
.find('input')
220+
.wait(1000)
221+
.clear();
222+
}
214223
},
215224
);
216225

tests/integration/tests/kyma-cluster/test-kyma-modules.spec.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -239,29 +239,31 @@ context('Test Kyma Modules views', () => {
239239
.should('not.be.exist');
240240
});
241241

242-
// Uncomment after adding local KLM
243-
// it('Test deleting Modules from List and Details', { retries: 3 }, () => {
244-
// cy.deleteFromGenericList('Module', 'eventing');
242+
it('Test deleting Modules from List and Details', { retries: 3 }, () => {
243+
cy.deleteFromGenericList('Module', 'eventing', {
244+
searchInPlainTableText: true,
245+
});
245246

246-
// cy.get('ui5-input[id="search-input"]:visible')
247-
// .find('input')
248-
// .wait(1000)
249-
// .type('api-gateway');
250-
251-
// cy.get('ui5-table-row')
252-
// .contains('api-gateway')
253-
// .click();
254-
255-
// cy.deleteInDetails('Module', 'api-gateway', true);
256-
257-
// cy.wait(20000);
258-
259-
// cy.get('ui5-input[id="search-input"]:visible')
260-
// .find('input')
261-
// .clear();
262-
263-
// cy.get('ui5-table')
264-
// .contains('ui5-illustrated-message', 'No modules')
265-
// .should('be.visible');
266-
// });
247+
// Uncomment after adding local KLM
248+
// cy.get('ui5-input[id="search-input"]:visible')
249+
// .find('input')
250+
// .wait(1000)
251+
// .type('api-gateway');
252+
//
253+
// cy.get('ui5-table-row')
254+
// .contains('api-gateway')
255+
// .click();
256+
//
257+
// cy.deleteInDetails('Module', 'api-gateway', true);
258+
//
259+
// cy.wait(20000);
260+
//
261+
// cy.get('ui5-input[id="search-input"]:visible')
262+
// .find('input')
263+
// .clear();
264+
//
265+
// cy.get('ui5-table')
266+
// .contains('ui5-illustrated-message', 'No modules')
267+
// .should('be.visible');
268+
});
267269
});

0 commit comments

Comments
 (0)