Skip to content

Commit e072358

Browse files
committed
fix tests for Menu
1 parent 44aed58 commit e072358

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

superset-frontend/src/features/home/Menu.test.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,26 @@ test('should render the About section and version_string, sha or build_number wh
492492
});
493493
userEvent.hover(screen.getByText('Settings'));
494494
const about = await screen.findByText('About');
495-
const version = await screen.findAllByText(`Version: ${version_string}`);
496-
const sha = await screen.findAllByText(`SHA: ${version_sha}`);
497-
const build = await screen.findAllByText(`Build: ${build_number}`);
495+
496+
// The version information is rendered as combined text in a single element
497+
// Use getAllByText to get all matching elements and check the first one
498+
const versionTexts = await screen.findAllByText(
499+
(_, element) =>
500+
element?.textContent?.includes(`Version: ${version_string}`) ?? false,
501+
);
502+
const shaTexts = await screen.findAllByText(
503+
(_, element) =>
504+
element?.textContent?.includes(`SHA: ${version_sha}`) ?? false,
505+
);
506+
const buildTexts = await screen.findAllByText(
507+
(_, element) =>
508+
element?.textContent?.includes(`Build: ${build_number}`) ?? false,
509+
);
510+
498511
expect(about).toBeInTheDocument();
499-
expect(version[0]).toBeInTheDocument();
500-
expect(sha[0]).toBeInTheDocument();
501-
expect(build[0]).toBeInTheDocument();
512+
expect(versionTexts[0]).toBeInTheDocument();
513+
expect(shaTexts[0]).toBeInTheDocument();
514+
expect(buildTexts[0]).toBeInTheDocument();
502515
});
503516

504517
test('should render the Documentation link when available', async () => {

0 commit comments

Comments
 (0)