Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions workspaces/scorecard/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@ app:
- kind: api # e.g. any API entity
- type: service # e.g. Component or System with spec.type: service

# Grid layout – enabled with metric grouping
- scorecard-layout:scorecard/scorecard-entity-layout-grid:
disabled: false
config:
groups:
security-vulnerabilities:
title: Security Vulnerabilities
description: Track security issues across your repositories
metrics:
- sonarqube.securityRating

code-quality:
title: Code Quality
description: Code quality and maintainability metrics
metrics:
- sonarqube.qualityGate
- sonarqube.codeCoverage
- sonarqube.maintainabilityRating

sonarqube-coverage:
title: SonarQube Coverage
description: SonarQube coverage metrics
metrics:
- sonarqube.openIssues
- sonarqube.securityHotspots
- sonarqube.securityRating

- home-page-layout:home/dynamic-homepage-layout:
config:
customizable: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import { Page, expect } from '@playwright/test';
import { Locator, Page, expect } from '@playwright/test';
import { waitUntilApiCallSucceeds } from '../utils/apiUtils';
import { ScorecardMessages } from '../utils/translationUtils';
import { ScorecardMessages, evaluateMessage } from '../utils/translationUtils';

export class ScorecardPage {
readonly page: Page;
Expand Down Expand Up @@ -110,4 +110,58 @@ export class ScorecardPage {
return false;
}
}

// Metric Group Card helpers

getGroupCard(title: string): Locator {
return this.page
.locator('[role="article"]')
.filter({ hasText: title })
.first();
}

getBucketTile(
card: Locator,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] type alias reuse

The threshold key union 'success' | 'warning' | 'error' is inlined in getBucketTile and getFilterPill. In HomePage.ts, the same union is extracted to a named ThresholdState type alias. Consider extracting a shared type to maintain consistency with sibling page objects.

Suggested fix: Extract a shared ThresholdState type and reference it in getBucketTile and getFilterPill.

thresholdKey: 'success' | 'warning' | 'error',
): Locator {
return card
.locator('[role="button"]')
.filter({ hasText: this.translations.thresholds[thresholdKey] });
}

async openDataSourcesDialog(card: Locator): Promise<Locator> {
await card
.getByLabel(this.translations.metricGroupCard.menuAriaLabel)
.click();
await this.page
.getByText(this.translations.metricGroupCard.viewDataSources)
.click();
const dialog = this.page.locator('[role="dialog"]');
await expect(dialog).toBeVisible({ timeout: 5000 });
return dialog;
}

async closeDialog(dialog: Locator) {
await dialog.getByText(this.translations.dataSourcesDialog.close).click();
}

getDialogTitle(groupTitle: string): string {
return evaluateMessage(
this.translations.dataSourcesDialog.title,
groupTitle,
);
}

getFilterPill(
dialog: Locator,
thresholdKey: 'success' | 'warning' | 'error',
): Locator {
return dialog
.locator('[role="button"][aria-pressed]')
.filter({ hasText: this.translations.thresholds[thresholdKey] });
}

getTableRows(dialog: Locator): Locator {
return dialog.locator('tbody [role="row"]');
}
}
Loading
Loading