Merge pull request #13847 from Oriflame/feature/jvilimek/score-card-plugin-integration

Score-card plugin integrated to example-app
This commit is contained in:
Patrik Oldsberg
2022-10-04 14:00:48 +02:00
committed by GitHub
9 changed files with 142 additions and 6 deletions
+5
View File
@@ -138,6 +138,11 @@ techdocs:
dynatrace:
baseUrl: https://your.dynatrace.instance.com
# Score-cards sample configuration.
scorecards:
jsonDataUrl: https://raw.githubusercontent.com/Oriflame/backstage-plugins/main/plugins/score-card/sample-data/
wikiLinkTemplate: https://link-to-wiki/{id}
sentry:
organization: my-company
@@ -0,0 +1,83 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types="cypress" />
import 'os';
describe('score-card', () => {
describe('Score board', () => {
it('displays the score board based on sample data', () => {
cy.loginAsGuest();
cy.visit('/score-board');
cy.screenshot({ capture: 'viewport' });
cy.contains('System scores overview').should('be.visible');
cy.checkForErrors();
cy.get('span:contains("1-2 of 2")').should('be.visible'); // beware, there is also a hidden <P/> element
cy.contains('audio-playback').should('be.visible');
cy.contains('team-c').should('be.visible');
cy.contains('non-valid-system').should('be.visible');
cy.contains('Name').should('be.visible');
cy.contains('Date').should('be.visible');
cy.contains('Code').should('be.visible');
cy.contains('Documentation').should('be.visible');
cy.contains('Operations').should('be.visible');
cy.contains('Quality').should('be.visible');
cy.contains('Security').should('be.visible');
cy.contains('Total').should('be.visible');
cy.contains('50 %').should('be.visible');
cy.contains('75 %').should('be.visible');
cy.log('navigating to score card detail for audio-playback');
cy.get('a[data-id="audio-playback"]').should('be.visible').click();
cy.screenshot({ capture: 'viewport' });
cy.url().should(
'include',
'/catalog/default/System/audio-playback/score',
);
cy.contains('Scoring').should('be.visible');
cy.contains('Total score: 57 %').should('be.visible');
cy.contains('Code').should('be.visible');
cy.contains('90 %').should('be.visible');
cy.contains('Documentation').should('be.visible');
cy.contains('75 %').should('be.visible');
cy.contains('Operations').should('be.visible');
cy.contains('50 %').should('be.visible');
cy.contains('Quality').should('be.visible');
cy.contains('25 %').should('be.visible');
cy.contains('Security');
cy.contains('10 %').should('be.visible');
cy.checkForErrors();
cy.log(
'Clicking on button [>] that is first child of the element (td) with value=Code',
);
cy.get('[value="Code"] > button:first-child').click();
cy.checkForErrors();
cy.screenshot({ capture: 'viewport' });
cy.log('Clicking on link for Code');
cy.contains('hints: Gitflow: 100%').should('be.visible');
cy.get('a[data-id="2157"]')
.should('be.visible')
.should(
'have.attr',
'href',
'https://TBD/XXX/_wiki/wikis/XXX.wiki/2157',
);
});
});
});
+5
View File
@@ -118,3 +118,8 @@ Cypress.Commands.add('waitSectionTwoPage', () => {
Cypress.Commands.add('waitHomePage', () => {
cy.wait(['@entityMetadata', '@syncEntity', '@techdocsMetadata', '@homeHTML']);
});
Cypress.Commands.add('checkForErrors', () => {
// when an error occurs there is a <div> with an "alert" role attribute. This can change ofc => we shall add also some positive ("when error occurs") test
cy.get('div[role="alert"]').should('not.exist');
});
+5
View File
@@ -77,5 +77,10 @@ declare namespace Cypress {
* @example cy.isNotInViewport
*/
isNotInViewport(element: string): Chainable<Element>;
/**
* Check if we have not caused error by our last action
* @example cy.checkForErrors
*/
checkForErrors(): Chainable<Element>;
}
}
+1
View File
@@ -67,6 +67,7 @@
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
"@octokit/rest": "^19.0.3",
"@oriflame/backstage-plugin-score-card": "^0.5.1",
"@roadiehq/backstage-plugin-buildkite": "^2.0.8",
"@roadiehq/backstage-plugin-github-insights": "^2.0.5",
"@roadiehq/backstage-plugin-github-pull-requests": "^2.2.7",
+2
View File
@@ -106,6 +106,7 @@ import { RequirePermission } from '@backstage/plugin-permission-react';
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';
import { PlaylistIndexPage } from '@backstage/plugin-playlist';
import { TwoColumnLayout } from './components/scaffolder/customScaffolderLayouts';
import { ScoreBoardPage } from '@oriflame/backstage-plugin-score-card';
const app = createApp({
apis,
@@ -273,6 +274,7 @@ const routes = (
<Route path="/azure-pull-requests" element={<AzurePullRequestsPage />} />
<Route path="/apache-airflow" element={<ApacheAirflowPage />} />
<Route path="/playlist" element={<PlaylistIndexPage />} />
<Route path="/score-board" element={<ScoreBoardPage />} />
</FlatRoutes>
);
@@ -51,6 +51,7 @@ import {
import { MyGroupsSidebarItem } from '@backstage/plugin-org';
import GroupIcon from '@material-ui/icons/People';
import { SearchModal } from '../search/SearchModal';
import Score from '@material-ui/icons/Score';
const useSidebarLogoStyles = makeStyles({
root: {
@@ -120,6 +121,7 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
text="Cost Insights"
/>
<SidebarItem icon={GraphiQLIcon} to="graphiql" text="GraphiQL" />
<SidebarItem icon={Score} to="score-board" text="Score board" />
</SidebarScrollWrapper>
<SidebarDivider />
<Shortcuts />
@@ -144,6 +144,7 @@ import {
EntityNewRelicDashboardCard,
} from '@backstage/plugin-newrelic-dashboard';
import { EntityGoCdContent, isGoCdAvailable } from '@backstage/plugin-gocd';
import { EntityScoreCardContent } from '@oriflame/backstage-plugin-score-card';
import React, { ReactNode, useMemo, useState } from 'react';
@@ -704,6 +705,13 @@ const systemPage = (
</Grid>
</Grid>
</EntityLayout.Route>
<EntityLayout.Route path="/score" title="Score">
<Grid container spacing={3} alignItems="stretch">
<Grid item xs={12}>
<EntityScoreCardContent />
</Grid>
</Grid>
</EntityLayout.Route>
<EntityLayout.Route path="/diagram" title="Diagram">
<EntityCatalogGraphCard
variant="gridItem"
+31 -6
View File
@@ -3205,7 +3205,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/catalog-model@npm:^1.0.0, @backstage/catalog-model@npm:^1.1.1":
"@backstage/catalog-model@npm:^1.0.0, @backstage/catalog-model@npm:^1.1.0-next.2, @backstage/catalog-model@npm:^1.1.1":
version: 1.1.1
resolution: "@backstage/catalog-model@npm:1.1.1"
dependencies:
@@ -3434,7 +3434,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/config@npm:^1.0.2":
"@backstage/config@npm:^1.0.1, @backstage/config@npm:^1.0.2":
version: 1.0.2
resolution: "@backstage/config@npm:1.0.2"
dependencies:
@@ -3613,7 +3613,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/core-plugin-api@npm:^1.0.0, @backstage/core-plugin-api@npm:^1.0.6":
"@backstage/core-plugin-api@npm:^1.0.0, @backstage/core-plugin-api@npm:^1.0.3, @backstage/core-plugin-api@npm:^1.0.6":
version: 1.0.6
resolution: "@backstage/core-plugin-api@npm:1.0.6"
dependencies:
@@ -4730,7 +4730,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/plugin-catalog-common@npm:^1.0.6":
"@backstage/plugin-catalog-common@npm:^1.0.4-next.0, @backstage/plugin-catalog-common@npm:^1.0.6":
version: 1.0.6
resolution: "@backstage/plugin-catalog-common@npm:1.0.6"
dependencies:
@@ -4865,7 +4865,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/plugin-catalog-react@npm:^1.0.0, @backstage/plugin-catalog-react@npm:^1.1.4":
"@backstage/plugin-catalog-react@npm:^1.0.0, @backstage/plugin-catalog-react@npm:^1.1.2-next.2, @backstage/plugin-catalog-react@npm:^1.1.4":
version: 1.1.4
resolution: "@backstage/plugin-catalog-react@npm:1.1.4"
dependencies:
@@ -7753,7 +7753,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/theme@^0.2.16, @backstage/theme@^0.2.6, @backstage/theme@^0.2.7, @backstage/theme@^0.2.9, @backstage/theme@workspace:^, @backstage/theme@workspace:packages/theme":
"@backstage/theme@^0.2.16, @backstage/theme@^0.2.16-next.1, @backstage/theme@^0.2.6, @backstage/theme@^0.2.7, @backstage/theme@^0.2.9, @backstage/theme@workspace:^, @backstage/theme@workspace:packages/theme":
version: 0.0.0-use.local
resolution: "@backstage/theme@workspace:packages/theme"
dependencies:
@@ -11736,6 +11736,30 @@ __metadata:
languageName: node
linkType: hard
"@oriflame/backstage-plugin-score-card@npm:^0.5.1":
version: 0.5.1
resolution: "@oriflame/backstage-plugin-score-card@npm:0.5.1"
dependencies:
"@backstage/catalog-model": ^1.1.0-next.2
"@backstage/config": ^1.0.1
"@backstage/core-components": ^0.11.0
"@backstage/core-plugin-api": ^1.0.3
"@backstage/plugin-catalog-common": ^1.0.4-next.0
"@backstage/plugin-catalog-react": ^1.1.2-next.2
"@backstage/theme": ^0.2.16-next.1
"@backstage/types": ^1.0.0
"@backstage/version-bridge": ^1.0.1
"@material-ui/core": ^4.12.2
"@material-ui/icons": ^4.11.2
"@material-ui/lab": ^4.0.0-alpha.57
react-use: ^17.2.4
peerDependencies:
react: ^16.13.1 || ^17.0.0
react-dom: ^16.13.1 || ^17.0.0
checksum: 37d68f5dcd26b67d913ec07523da3c35dd6f44070eb215dc1e403500b088b2c3a9ba97f83d20937388cffba9db6cc66e754ebc361fdd736fce6398e74662a8be
languageName: node
linkType: hard
"@peculiar/asn1-schema@npm:^2.1.6":
version: 2.2.0
resolution: "@peculiar/asn1-schema@npm:2.2.0"
@@ -22039,6 +22063,7 @@ __metadata:
"@material-ui/icons": ^4.9.1
"@material-ui/lab": 4.0.0-alpha.57
"@octokit/rest": ^19.0.3
"@oriflame/backstage-plugin-score-card": ^0.5.1
"@rjsf/core": ^3.2.1
"@roadiehq/backstage-plugin-buildkite": ^2.0.8
"@roadiehq/backstage-plugin-github-insights": ^2.0.5