Skip to content

Commit

Permalink
✅ [#4693] Add story for Objects API prefill copy button
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Oct 29, 2024
1 parent 4c409f2 commit 5332c87
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -695,22 +695,24 @@ export const ConfigurePrefillObjectsAPIWithCopyButton = {
expect(copyButton).toBeVisible();
await userEvent.click(copyButton);

// Wait until the API call to retrieve the prefillAttributes is done
const modalForm = await screen.findByTestId('modal-form');
expect(modalForm).toBeVisible();
await waitFor(async () => {
const apiGroup = await modal.findByLabelText('API-groep');
expect(apiGroup).toHaveValue(1);

const objecttype = modal.getByRole('input', {name: 'prefillOptions.objecttypeUuid'});
expect(objecttype).toHaveValue('2c77babf-a967-4057-9969-0200320d23f1');

const version = await modal.findByLabelText('Versie');
expect(version).toHaveValue('2');
expect(modalForm).toHaveFormValues({
'prefillOptions.objectsApiGroup': '1',
'prefillOptions.objecttypeUuid': '2c77babf-a967-4057-9969-0200320d23f1',
'prefillOptions.objecttypeVersion': '2',
});
});

// Wait until the API call to retrieve the prefillAttributes is done
await waitFor(async () => {
const prefillPropertySelect = await screen.findByLabelText(
'Selecteer een attribuut uit het objecttype'
);
expect(prefillPropertySelect).toBeVisible();
expect(prefillPropertySelect).toHaveValue(serializeValue(['height']));
expect(prefillPropertySelect.options[1]).toHaveValue(serializeValue(['height']));
expect(prefillPropertySelect.options[2]).toHaveValue(serializeValue(['species']));
});
});
},
Expand Down

0 comments on commit 5332c87

Please sign in to comment.