ci: update button accessibility labels in AgentDetail tests

This commit is contained in:
Danny Avila 2025-06-27 00:25:07 -04:00
parent fddf1196c9
commit d12122f3db
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -159,7 +159,7 @@ describe('AgentDetail', () => {
it('should render 3-dot menu button', () => { it('should render 3-dot menu button', () => {
renderWithProviders(<AgentDetail {...defaultProps} />); renderWithProviders(<AgentDetail {...defaultProps} />);
const menuButton = screen.getByRole('button', { name: 'More options' }); const menuButton = screen.getByRole('button', { name: 'com_agents_more_options' });
expect(menuButton).toBeInTheDocument(); expect(menuButton).toBeInTheDocument();
expect(menuButton).toHaveAttribute('aria-haspopup', 'menu'); expect(menuButton).toHaveAttribute('aria-haspopup', 'menu');
}); });
@ -199,7 +199,7 @@ describe('AgentDetail', () => {
const user = userEvent.setup(); const user = userEvent.setup();
renderWithProviders(<AgentDetail {...defaultProps} />); renderWithProviders(<AgentDetail {...defaultProps} />);
const menuButton = screen.getByRole('button', { name: 'More options' }); const menuButton = screen.getByRole('button', { name: 'com_agents_more_options' });
await user.click(menuButton); await user.click(menuButton);
expect(screen.getByRole('button', { name: 'com_agents_copy_link' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: 'com_agents_copy_link' })).toBeInTheDocument();
@ -210,7 +210,7 @@ describe('AgentDetail', () => {
renderWithProviders(<AgentDetail {...defaultProps} />); renderWithProviders(<AgentDetail {...defaultProps} />);
// Open dropdown // Open dropdown
const menuButton = screen.getByRole('button', { name: 'More options' }); const menuButton = screen.getByRole('button', { name: 'com_agents_more_options' });
await user.click(menuButton); await user.click(menuButton);
expect(screen.getByRole('button', { name: 'com_agents_copy_link' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: 'com_agents_copy_link' })).toBeInTheDocument();
@ -231,7 +231,7 @@ describe('AgentDetail', () => {
renderWithProviders(<AgentDetail {...defaultProps} />); renderWithProviders(<AgentDetail {...defaultProps} />);
// Open dropdown // Open dropdown
const menuButton = screen.getByRole('button', { name: 'More options' }); const menuButton = screen.getByRole('button', { name: 'com_agents_more_options' });
await user.click(menuButton); await user.click(menuButton);
// Click copy link // Click copy link
@ -247,7 +247,7 @@ describe('AgentDetail', () => {
await waitFor(() => { await waitFor(() => {
expect(mockShowToast).toHaveBeenCalledWith({ expect(mockShowToast).toHaveBeenCalledWith({
message: 'Link copied', message: 'com_agents_link_copied',
}); });
}); });
@ -266,7 +266,7 @@ describe('AgentDetail', () => {
renderWithProviders(<AgentDetail {...defaultProps} />); renderWithProviders(<AgentDetail {...defaultProps} />);
// Open dropdown and click copy link // Open dropdown and click copy link
const menuButton = screen.getByRole('button', { name: 'More options' }); const menuButton = screen.getByRole('button', { name: 'com_agents_more_options' });
await user.click(menuButton); await user.click(menuButton);
const copyLinkButton = screen.getByRole('button', { name: 'com_agents_copy_link' }); const copyLinkButton = screen.getByRole('button', { name: 'com_agents_copy_link' });
@ -299,16 +299,16 @@ describe('AgentDetail', () => {
it('should have proper ARIA attributes', () => { it('should have proper ARIA attributes', () => {
renderWithProviders(<AgentDetail {...defaultProps} />); renderWithProviders(<AgentDetail {...defaultProps} />);
const menuButton = screen.getByRole('button', { name: 'More options' }); const menuButton = screen.getByRole('button', { name: 'com_agents_more_options' });
expect(menuButton).toHaveAttribute('aria-haspopup', 'menu'); expect(menuButton).toHaveAttribute('aria-haspopup', 'menu');
expect(menuButton).toHaveAttribute('aria-label', 'More options'); expect(menuButton).toHaveAttribute('aria-label', 'com_agents_more_options');
}); });
it('should support keyboard navigation for dropdown', async () => { it('should support keyboard navigation for dropdown', async () => {
const user = userEvent.setup(); const user = userEvent.setup();
renderWithProviders(<AgentDetail {...defaultProps} />); renderWithProviders(<AgentDetail {...defaultProps} />);
const menuButton = screen.getByRole('button', { name: 'More options' }); const menuButton = screen.getByRole('button', { name: 'com_agents_more_options' });
// Focus and open with Enter key // Focus and open with Enter key
menuButton.focus(); menuButton.focus();
@ -321,7 +321,7 @@ describe('AgentDetail', () => {
const user = userEvent.setup(); const user = userEvent.setup();
renderWithProviders(<AgentDetail {...defaultProps} />); renderWithProviders(<AgentDetail {...defaultProps} />);
const menuButton = screen.getByRole('button', { name: 'More options' }); const menuButton = screen.getByRole('button', { name: 'com_agents_more_options' });
await user.click(menuButton); await user.click(menuButton);
const copyLinkButton = screen.getByRole('button', { name: 'com_agents_copy_link' }); const copyLinkButton = screen.getByRole('button', { name: 'com_agents_copy_link' });