import { render, screen } from '@testing-library/react'; import App from './App'; import { logRoles } from '@testing-library/react'; test('button has correct initial color', () => { const { container } = render(<App />); logRoles(container); const colorButton = screen.getByRole('button', { name: 'Change to blue' }); const colorButton2 = screen.getByRole('button', { name: 'Change to red' }); expect(colorButton).toHaveStyle({ backgroundColor: 'red ' }); });
- 이런 식으로 console.log에 각 Role에 해당하는 목록이 보여짐