Merge pull request #5675 from ayshiff/feature/techdocs-e2e

Feature/techdocs e2e
This commit is contained in:
Patrik Oldsberg
2021-09-29 13:46:13 +02:00
committed by GitHub
27 changed files with 864 additions and 20 deletions
@@ -62,6 +62,7 @@ export const DocsCardGrid = ({
name: toLowerMaybe(entity.metadata.name),
})}
color="primary"
data-testid="read_docs"
>
Read Docs
</Button>
@@ -108,7 +108,7 @@ const CustomPanel = ({
) : null}
</ContentHeader>
<div className={classes.panelContainer}>
<Panel entities={shownEntities} />
<Panel data-testid="techdocs-custom-panel" entities={shownEntities} />
</div>
</>
);
@@ -182,7 +182,7 @@ export const TechDocsCustomHome = ({
label,
}))}
/>
<Content>
<Content data-testid="techdocs-content">
{currentTabConfig.panels.map((config, index) => (
<CustomPanel
key={index}
@@ -19,6 +19,7 @@ import { useParams } from 'react-router-dom';
import { useAsync } from 'react-use';
import { techdocsApiRef } from '../../api';
import { Reader } from './Reader';
import { TechDocsNotFound } from './TechDocsNotFound';
import { TechDocsPageHeader } from './TechDocsPageHeader';
import { Content, Page } from '@backstage/core-components';
@@ -38,14 +39,19 @@ export const TechDocsPage = () => {
return Promise.resolve(undefined);
}, [kind, namespace, name, techdocsApi, documentReady]);
const { value: entityMetadataValue } = useAsync(() => {
return techdocsApi.getEntityMetadata({ kind, namespace, name });
}, [kind, namespace, name, techdocsApi]);
const { value: entityMetadataValue, error: entityMetadataError } =
useAsync(() => {
return techdocsApi.getEntityMetadata({ kind, namespace, name });
}, [kind, namespace, name, techdocsApi]);
const onReady = useCallback(() => {
setDocumentReady(true);
}, [setDocumentReady]);
if (entityMetadataError) {
return <TechDocsNotFound errorMessage={entityMetadataError.message} />;
}
return (
<Page themeId="documentation">
<TechDocsPageHeader