diff --git a/plugins/kiali/dev/__fixtures__/general/istioValidations.json b/plugins/kiali/dev/__fixtures__/general/istioValidations.json index 2e03262db2f..612b8f42d74 100644 --- a/plugins/kiali/dev/__fixtures__/general/istioValidations.json +++ b/plugins/kiali/dev/__fixtures__/general/istioValidations.json @@ -32,8 +32,8 @@ }, "travel-control": { "errors": 0, - "objectCount": 0, - "warnings": 0 + "objectCount": 1, + "warnings": 1 }, "travel-portal": { "errors": 0, diff --git a/plugins/kiali/dev/__fixtures__/namespaces/travel-agency/health/app.json b/plugins/kiali/dev/__fixtures__/namespaces/travel-agency/health/app.json index 84a00bf3c8f..a73a7af6612 100644 --- a/plugins/kiali/dev/__fixtures__/namespaces/travel-agency/health/app.json +++ b/plugins/kiali/dev/__fixtures__/namespaces/travel-agency/health/app.json @@ -50,7 +50,7 @@ "desiredReplicas": 1, "currentReplicas": 1, "availableReplicas": 1, - "syncedProxies": 1 + "syncedProxies": 0 } ], "requests": { diff --git a/plugins/kiali/dev/__fixtures__/namespaces/travel-control/health/app.json b/plugins/kiali/dev/__fixtures__/namespaces/travel-control/health/app.json index 2800f2b95ae..79a6902cd0e 100644 --- a/plugins/kiali/dev/__fixtures__/namespaces/travel-control/health/app.json +++ b/plugins/kiali/dev/__fixtures__/namespaces/travel-control/health/app.json @@ -4,7 +4,7 @@ { "name": "control", "desiredReplicas": 1, - "currentReplicas": 1, + "currentReplicas": 0, "availableReplicas": 1, "syncedProxies": 1 } diff --git a/plugins/kiali/src/components/Validations/ValidationSummary.tsx b/plugins/kiali/src/components/Validations/ValidationSummary.tsx index 573d43988c2..80953a5cb87 100644 --- a/plugins/kiali/src/components/Validations/ValidationSummary.tsx +++ b/plugins/kiali/src/components/Validations/ValidationSummary.tsx @@ -128,6 +128,7 @@ export const ValidationSummary = (props: Props) => { return ( diff --git a/plugins/kiali/src/pages/Overview/OverviewCard/OverviewCard.tsx b/plugins/kiali/src/pages/Overview/OverviewCard/OverviewCard.tsx index 0963de75b78..5cf016eb0d6 100644 --- a/plugins/kiali/src/pages/Overview/OverviewCard/OverviewCard.tsx +++ b/plugins/kiali/src/pages/Overview/OverviewCard/OverviewCard.tsx @@ -106,6 +106,7 @@ export const OverviewCard = (props: OverviewCardProps) => { errors={validations.errors} warnings={validations.warnings} objectCount={validations.objectCount} + data-test={'validation-summary'} /> ); }; diff --git a/plugins/kiali/src/pages/Overview/OverviewStatus.tsx b/plugins/kiali/src/pages/Overview/OverviewStatus.tsx index 30218ad873e..c92d06253cd 100644 --- a/plugins/kiali/src/pages/Overview/OverviewStatus.tsx +++ b/plugins/kiali/src/pages/Overview/OverviewStatus.tsx @@ -43,8 +43,10 @@ export class OverviewStatus extends React.Component { items.push(`and ${length - items.length} more...`); } const tooltipContent = ( -
- {this.props.status.name} +
+ + {this.props.status.name} + {items.map((app, idx) => { return (
{ + const ns_card = await page.locator(`data-test=overview-card-${ns}`); + await page.click('[aria-label="Health for"]'); + await page.click(`[data-value=${type}]`); + + const icon = await ns_card.locator('data-test=overview-app-health'); + await icon.hover(); + let list = await page.locator('data-test=overview-status'); + + // Wait for the list to appear + await page.waitForSelector('data-test=overview-status'); + + let i = 0; + for (const object of Object.entries(objects)) { + if (i == 5) { + break; + } + await icon.hover({ force: true }).then(async () => { + await expect(list).toContainText(`${object[1].name}`); + }); + i++; + } + let expected = type == 'app' ? 'application' : type; + await expect( + ns_card.locator(`data-test=overview-type-${type}`), + ).toContainText(`${Object.entries(objects).length} ${expected}s`); +} function filterByIstioInjectionEnabled(jsonArray: any): any { return jsonArray.filter( @@ -188,5 +224,80 @@ test.describe('Kiali page', () => { `${Object.entries(ns.labels).length} labels`, ); }); + + test('Apps should be reported in the namespace card', async () => { + const ns = BOOKINFO_APPS.namespace.name; + await checkReportedItems('app', ns, BOOKINFO_APPS.applications, page); + }); + + test('Services should be reported in the namespace card', async () => { + const ns = BOOKINFO_SERVICES.namespace.name; + await checkReportedItems('service', ns, BOOKINFO_SERVICES.services, page); + }); + + test('Workloads should be reported in the namespace card', async () => { + const ns = BOOKINFO_WORKLOADS.namespace.name; + await checkReportedItems( + 'workload', + ns, + BOOKINFO_WORKLOADS.workloads, + page, + ); + }); + + test('Healthy apps should be reported in the namespace card', async () => { + const ns_card = await page.locator(`data-test=overview-card-bookinfo`); + const icon = await ns_card.locator('data-test=overview-app-health'); + await icon.hover(); + await page.waitForSelector('data-test=overview-status'); + await expect(ns_card.locator('data-test=Healthy-status')).toBeDefined(); + }); + + test('Degraded apps should be reported in the namespace card', async () => { + const ns_card = await page.locator( + `data-test=overview-card-travel-agency`, + ); + const icon = await ns_card + .locator('[aria-label="Overview status"]') + .first(); + await icon.hover(); + await page.waitForSelector('data-test=overview-status'); + await expect(ns_card.locator('data-test=Degraded-status')).toBeDefined(); + }); + + test('Failed apps should be reported in the namespace card', async () => { + const ns_card = await page.locator( + `data-test=overview-card-travel-control`, + ); + const icon = await ns_card.locator('[aria-label="Overview status"]'); + await icon.hover(); + await page.waitForSelector('data-test=overview-status'); + await expect(ns_card.locator('data-test=Failure-status')).toBeDefined(); + }); + + test('Istio config with success should be reported in the namespace card', async () => { + const ns_card = await page.locator( + `data-test=overview-card-travel-agency`, + ); + await expect( + ns_card.locator('data-test=validation-icon-correct'), + ).toBeVisible(); + }); + + test('Istio config with warning should be reported in the namespace card', async () => { + const ns_card = await page.locator( + `data-test=overview-card-travel-control`, + ); + await expect( + ns_card.locator('data-test=validation-icon-warning'), + ).toBeVisible(); + }); + + test('Istio config with error should be reported in the namespace card', async () => { + const ns_card = await page.locator(`data-test=overview-card-bookinfo`); + await expect( + ns_card.locator('data-test=validation-icon-error'), + ).toBeVisible(); + }); }); });