In photoshop UXP plugin is it possible to do unit test using jest framework in react UI components, like test the text fields, radio buttons, dropdown values? I tried but not working.
I tried something like this and it works
import ‘@testing-library/jest-dom’
import {render, fireEvent, screen} from ‘@testing-library/react’
import { ActionButton } from ‘./ActionButton’;
test('Action Button text is not null', () => {
const buttonText = 'Test button'
render(<ActionButton text={buttonText}/>);
const buttonElement = screen.queryByText(buttonText)
expect(buttonElement).not.toBeNull()
});
test('renders Action Button with correct text', () => {
const buttonText = 'Test button'
render(<ActionButton text={buttonText}/>);
const buttonElement = screen.queryByText(buttonText)
expect(buttonElement).toBeInTheDocument()
});