-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Description
Target:
I am writing a module where I need to hide input elements based on some conditions. I need to select an option of material select input.
Problem:
Unable to test it, the test assertion throws error.
TestingLibraryElementError: Value "Partnership" not found in options
Reproduction:
- I am loading mat options using *ngFor (below are my options)
[
{
value: 'Public Limited Company',
label: 'Public Limited Company',
},
{
value: 'Private Limited Company',
label: 'Private Limited Company',
},
{
value: 'Partnership',
label: 'Partnership',
},
{
value: 'Limited Liability Partnership',
label: 'Limited Liability Partnership',
}
]
- Below is my assertion code.
const firmType = screen.queryByLabelText(/Firm Type/i);
const isGstPresent = screen.queryByLabelText(/Is Gst Available/i);
const gstNumber = screen.queryByLabelText(/GST Number/i);
userEvent.selectOptions(firmType, 'Partnership');
await waitFor(() => {
expect(isGstPresent).toBeInTheDocument();
expect(taxPayerType).not.toBeInTheDocument();
});
Any help is appreciated.
Metadata
Metadata
Assignees
Labels
No labels