Skip to content

Commit

Permalink
fix: adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OliwiaGowor committed Dec 3, 2024
1 parent 23431fc commit 388fdee
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 26 deletions.
6 changes: 5 additions & 1 deletion src/hooks/useAvailableNamespaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export function useAvailableNamespaces() {
if (showHiddenNamespaces) return true;
return !hiddenNamespaces.includes(n);
});
if (filteredNamespaces) {
if (
filteredNamespaces &&
JSON.stringify(filteredNamespaces) !== JSON.stringify(namespaces)
) {
setNamespaces(filteredNamespaces);
}
}, [
Expand All @@ -46,6 +49,7 @@ export function useAvailableNamespaces() {
hiddenNamespaces,
setNamespaces,
showHiddenNamespaces,
namespaces,
]);

return { namespaces, refetch, silentRefetch, setNamespaces };
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ Cypress.Commands.add(
Cypress.Commands.add('checkItemOnGenericListLink', resourceName => {
cy.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', resourceName)
.contains('ui5-text', resourceName)
.should('be.visible');
});

Cypress.Commands.add('clickGenericListLink', resourceName => {
cy.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', resourceName)
.contains('ui5-text', resourceName)
.click();
});

Expand Down Expand Up @@ -177,8 +177,8 @@ Cypress.Commands.add(
cy.wait(1000);

if (selectSearchResult) {
cy.get('ui5-li-suggestion-item:visible')
.contains(resourceName)
cy.get('ui5-suggestion-item:visible')
.contains('li', resourceName)
.click();
}

Expand Down Expand Up @@ -233,7 +233,7 @@ Cypress.Commands.add(

cy.get('ui5-table-row')
.find('ui5-table-cell')
.contains('span', resourceName)
.contains('ui5-text', resourceName)
.should('not.be.visible');

cy.getMidColumn()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/support/inspect-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Cypress.Commands.add('inspectList', (resourceName, hiddenButtons = false) => {
.wait(1000)
.type(`${resourceName}{enter}`);

cy.contains('span', resourceName).should('be.visible');
cy.contains('ui5-text', resourceName).should('be.visible');
});
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ context('Test Cluster configuration', () => {

cy.get('[title="Profile"]').click();

cy.get('ui5-menu-li:visible')
cy.get('ui5-menu-item:visible')
.contains('Preferences')
.click({ force: true });

Expand All @@ -77,7 +77,7 @@ context('Test Cluster configuration', () => {
.contains('20')
.click();

cy.get('ui5-list:visible')
cy.get('ui5-option:visible')
.contains('10')
.click();

Expand Down
10 changes: 7 additions & 3 deletions tests/integration/tests/cluster/test-cluster-overview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ context('Test Cluster Overview', () => {
.get('.radial-chart')
.contains('text.progress-label', '50%')
.get('.radial-chart')
.contains('span.additional-info', 'test1233456');
.contains('ui5-text.additional-info', 'test1233456');

// test injected statistical card exists and works
cy.contains(
Expand Down Expand Up @@ -93,13 +93,17 @@ context('Test Cluster Overview', () => {

cy.loginAndSelectCluster();

cy.get('[name="feedback"]').should('exist');
cy.get('ui5-shellbar')
.find('[name="feedback"]')
.should('exist');

cy.setBusolaFeature('FEEDBACK', false);

cy.loginAndSelectCluster();

cy.get('[name="feedback"]').should('not.exist');
cy.get('ui5-shellbar')
.find('[name="feedback"]')
.should('not.exist');
});

it('Go to Node details', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ context('Test Cluster Role Bindings', () => {

cy.contains('[role="combobox"]', 'User').click();

cy.get('ui5-li:visible')
cy.get('ui5-option:visible')
.contains('ServiceAccount')
.find('li')
.click({ force: true });
Expand All @@ -96,6 +96,7 @@ context('Test Cluster Role Bindings', () => {
cy.inspectTab('View');

cy.getMidColumn()
.find('ui5-table-cell')
.contains('Group')
.should('be.visible');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ context('Test Kyma Dashboard Version link', () => {
it('Check Kyma Dashboard Version link', () => {
cy.get('[title="Profile"]').click();

cy.get('.ui5-menu-rp')
.find('ui5-menu-li:visible')
cy.get('ui5-menu')
.find('ui5-menu-item:visible')
.contains('Legal Information')
.click({ force: true });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,27 @@ context('Test multiple context kubeconfig', () => {
.contains(kubeconfig['current-context'])
.click();

cy.get('ui5-li:visible').contains(kubeconfig.contexts[1].name);
cy.get('ui5-option:visible').contains(kubeconfig.contexts[1].name);

cy.get('ui5-li:visible')
cy.wait(3000);

cy.get('ui5-option:visible')
.contains('All contexts')
.click();
cy.wait(3000);

cy.contains('Next').click({ force: true });
cy.wait(3000);

cy.get('ui5-button:visible')
.contains('Next step')
.click();
cy.wait(3000);

cy.get(`[accessible-name="last-step"]:visible`)
.contains('Connect cluster')
.click({ force: true });
cy.wait(3000);

cy.contains('Cluster Details').should('exist');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ context('Test navigation features', () => {
.wait(1000)
.type('cronjob-controller');

cy.get('ui5-li-suggestion-item:visible')
.contains('cronjob-controller')
cy.get('ui5-suggestion-item:visible')
.contains('li', /cronjob-controller/)
.click();

cy.contains('cronjob-controller (SA)') // link wrapper
.contains('cronjob-controller') // link itself
cy.contains('ui5-table-cell', 'cronjob-controller (SA)')
.find('ui5-link') // link itself
.click();

cy.contains('disabled').should('exist');
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/tests/namespace/a-run-before.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ context('Create Namespace', () => {
.find('ui5-icon[accessible-name="Select Options"]')
.click();

cy.get('ui5-static-area')
cy.get('ui5-responsive-popover')
.find('ui5-li:visible')
.contains('XL (limits: 9Gi, requests: 8.4Gi)')
.find('li[role="listitem"]')
.click({ force: true });

cy.get('.create-form')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ context('Test resource validation', () => {
it('Disables resource validation via preferences', () => {
cy.get('[title="Profile"]').click();

cy.get('ui5-menu-li:visible')
cy.get('ui5-menu-item:visible')
.contains('Preferences')
.click({ force: true });

Expand Down Expand Up @@ -80,7 +80,7 @@ context('Test resource validation', () => {
it('Customize resource validation policies via preferences', () => {
cy.get('[title="Profile"]').click();

cy.get('ui5-menu-li:visible')
cy.get('ui5-menu-item:visible')
.contains('Preferences')
.click({ force: true });

Expand Down Expand Up @@ -136,7 +136,7 @@ context('Test resource validation', () => {

cy.get('[title="Profile"]').click();

cy.get('ui5-menu-li:visible')
cy.get('ui5-menu-item:visible')
.contains('Preferences')
.click({ force: true });

Expand Down

0 comments on commit 388fdee

Please sign in to comment.