diff --git a/packages/core-components/api-report.md b/packages/core-components/api-report.md
index 248b9e227c..9ed964db44 100644
--- a/packages/core-components/api-report.md
+++ b/packages/core-components/api-report.md
@@ -52,10 +52,10 @@ import { Theme } from '@material-ui/core/styles';
import { TooltipProps } from '@material-ui/core/Tooltip';
import { WithStyles } from '@material-ui/core/styles';
-// @public (undocumented)
+// @public
export function AlertDisplay(props: AlertDisplayProps): JSX.Element | null;
-// @public
+// @public (undocumented)
export type AlertDisplayProps = {
anchorOrigin?: {
vertical: 'top' | 'bottom';
diff --git a/packages/core-components/src/components/Avatar/Avatar.test.tsx b/packages/core-components/src/components/Avatar/Avatar.test.tsx
index d7bbf712fe..4c726eb785 100644
--- a/packages/core-components/src/components/Avatar/Avatar.test.tsx
+++ b/packages/core-components/src/components/Avatar/Avatar.test.tsx
@@ -29,7 +29,9 @@ describe('', () => {
it('generates a background color', async () => {
const bgcolor = stringToColor('John Doe');
const { getByText } = render();
- expect(getByText('JD')).toHaveStyle(`background-color: ${bgcolor}`);
+ expect(getByText('JD').parentElement).toHaveStyle(
+ `background-color: ${bgcolor}`,
+ );
});
it('does not generate a background color when a picture is given', async () => {
diff --git a/packages/core-components/src/components/StructuredMetadataTable/MetadataTable.tsx b/packages/core-components/src/components/StructuredMetadataTable/MetadataTable.tsx
index 207354fe4b..6fb759b340 100644
--- a/packages/core-components/src/components/StructuredMetadataTable/MetadataTable.tsx
+++ b/packages/core-components/src/components/StructuredMetadataTable/MetadataTable.tsx
@@ -63,7 +63,6 @@ export type MetadataTableListItemClassKey = 'root' | 'random';
const listItemStyles = (theme: Theme) =>
createStyles({
root: {
- gutters: 0,
padding: theme.spacing(0, 0, 1, 0),
},
random: {},
diff --git a/packages/test-utils/api-report.md b/packages/test-utils/api-report.md
index 1b0aa44fc6..e11072f5a6 100644
--- a/packages/test-utils/api-report.md
+++ b/packages/test-utils/api-report.md
@@ -23,6 +23,7 @@ import { FetchApi } from '@backstage/core-plugin-api';
import { IdentityApi } from '@backstage/core-plugin-api';
import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
+import { MatcherFunction } from '@testing-library/react';
import { Observable } from '@backstage/types';
import { PermissionApi } from '@backstage/plugin-permission-react';
import { PropsWithChildren } from 'react';
@@ -241,6 +242,9 @@ export type TestAppOptions = {
};
};
+// @public
+export const textContentMatcher: (text: string) => MatcherFunction;
+
// @public
export function withLogCollector(
callback: AsyncLogCollector,
diff --git a/packages/test-utils/src/testUtils/appWrappers.tsx b/packages/test-utils/src/testUtils/appWrappers.tsx
index 3d2b5a0212..a19fe53301 100644
--- a/packages/test-utils/src/testUtils/appWrappers.tsx
+++ b/packages/test-utils/src/testUtils/appWrappers.tsx
@@ -29,7 +29,7 @@ import {
attachComponentData,
createRouteRef,
} from '@backstage/core-plugin-api';
-import { RenderResult } from '@testing-library/react';
+import { MatcherFunction, RenderResult } from '@testing-library/react';
import { renderWithEffects } from './testingLibrary';
import { defaultApis } from './defaultApis';
import { mockApis } from './mockApis';
@@ -242,3 +242,24 @@ export async function renderInTestApp(
wrapper: createTestAppWrapper(options),
});
}
+
+/**
+ * Returns a `@testing-library/react` valid MatcherFunction for supplied text
+ *
+ * @param string - text Text to match by element's textContent
+ *
+ * @public
+ */
+export const textContentMatcher =
+ (text: string): MatcherFunction =>
+ (_, node) => {
+ if (!node) {
+ return false;
+ }
+
+ const hasText = (textNode: Element) => textNode?.textContent === text;
+ const childrenDontHaveText = (containerNode: Element) =>
+ Array.from(containerNode?.children).every(child => !hasText(child));
+
+ return hasText(node) && childrenDontHaveText(node);
+ };
diff --git a/packages/test-utils/src/testUtils/index.tsx b/packages/test-utils/src/testUtils/index.tsx
index 1df236d92c..8fc1395eb8 100644
--- a/packages/test-utils/src/testUtils/index.tsx
+++ b/packages/test-utils/src/testUtils/index.tsx
@@ -19,6 +19,7 @@ export { default as mockBreakpoint } from './mockBreakpoint';
export {
wrapInTestApp,
renderInTestApp,
+ textContentMatcher,
createTestAppWrapper,
} from './appWrappers';
export type { TestAppOptions } from './appWrappers';
diff --git a/plugins/git-release-manager/src/features/Features.test.tsx b/plugins/git-release-manager/src/features/Features.test.tsx
index a77dcfe9fc..f3a70c2bda 100644
--- a/plugins/git-release-manager/src/features/Features.test.tsx
+++ b/plugins/git-release-manager/src/features/Features.test.tsx
@@ -55,7 +55,7 @@ describe('Features', () => {
expect(getByTestId(TEST_IDS.info.info)).toMatchInlineSnapshot(`