Skip to content

Commit

Permalink
✅ [#5012] Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorvanwijk committed Jan 30, 2025
1 parent 08b8d31 commit 85cfc56
Show file tree
Hide file tree
Showing 5 changed files with 384 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,8 @@ export const ConfiguredBackends = {
service: 1,
path: 'example/endpoint',
variables: [],
requiredMetadataVariables: [],
additionalMetadataVariables: [],
},
},
],
Expand Down Expand Up @@ -1030,6 +1032,8 @@ export const JSONDump = {
service: 1,
path: 'example/endpoint',
variables: [],
requiredMetadataVariables: ['form_name'],
additionalMetadataVariables: ['auth_bsn'],
},
},
],
Expand Down Expand Up @@ -1089,7 +1093,23 @@ export const JSONDump = {
formDefinition: null,
name: 'BSN',
key: 'auth_bsn',
source: 'static',
source: '',
prefillPlugin: '',
prefillAttribute: '',
prefillIdentifierRole: '',
prefillOptions: {},
dataType: 'string',
dataFormat: '',
isSensitiveData: false,
serviceFetchConfiguration: undefined,
initialValue: '',
},
{
form: null,
formDefinition: null,
name: 'Form name',
key: 'form_name',
source: '',
prefillPlugin: '',
prefillAttribute: '',
prefillIdentifierRole: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,47 +664,93 @@ export const WithJSONDumpRegistrationBackend = {
options: {
service: 2,
path: 'test',
variables: ['aSingleFile', 'now'],
variables: ['aSingleFile'],
requiredMetadataVariables: ['public_reference'],
additionalMetadataVariables: ['now'],
},
},
],
registrationPluginsVariables: [
{
pluginIdentifier: 'json_dump',
pluginVerboseName: 'JSON dump registration',
pluginVariables: [
{
form: null,
formDefinition: null,
name: 'Public reference',
key: 'public_reference',
source: '',
prefillPlugin: '',
prefillAttribute: '',
prefillIdentifierRole: 'main',
dataType: 'string',
dataFormat: '',
isSensitiveData: false,
serviceFetchConfiguration: undefined,
initialValue: '',
},
],
},
],
},
play: async ({canvasElement, step}) => {
const canvas = within(canvasElement);

const editIcons = canvas.getAllByTitle('Registratie-instellingen bewerken');
await expect(editIcons).toHaveLength(3);

await step('formioComponent checkbox unchecked', async () => {
await step('formioComponent checkboxes unchecked', async () => {
await userEvent.click(editIcons[0]);

const checkbox = await canvas.findByRole('checkbox');
await expect(checkbox).not.toBeChecked();
const checkboxes = await canvas.getAllByRole('checkbox');
await expect(checkboxes[0]).not.toBeChecked();
await expect(checkboxes[1]).not.toBeChecked();
await expect(checkboxes[1]).toBeDisabled();

const saveButton = canvas.getByRole('button', {name: 'Opslaan'});
await userEvent.click(saveButton);
});

await step('aSingleFile checkbox checked', async () => {
await step('aSingleFile values checkbox checked and metadata checkbox unchecked', async () => {
await userEvent.click(editIcons[1]);

const checkbox = await canvas.findByRole('checkbox');
await expect(checkbox).toBeChecked();
const checkboxes = await canvas.findAllByRole('checkbox');
await expect(checkboxes[0]).toBeChecked();
await expect(checkboxes[1]).not.toBeChecked();

const saveButton = canvas.getByRole('button', {name: 'Opslaan'});
await userEvent.click(saveButton);
});

await step('now checkbox checked', async () => {
await step('now values checkbox unchecked and metadata checkbox checked', async () => {
const staticVariables = canvas.getByRole('tab', {name: 'Vaste variabelen'});
await userEvent.click(staticVariables);

const editIcon = canvas.getByTitle('Registratie-instellingen bewerken');
await userEvent.click(editIcon);

const checkbox = await canvas.findByRole('checkbox');
await expect(checkbox).toBeChecked();
const checkboxes = await canvas.findAllByRole('checkbox');
await expect(checkboxes[0]).not.toBeChecked();
await expect(checkboxes[1]).toBeChecked();
await expect(checkboxes[1]).not.toBeDisabled();
});

await step(
'public_registration values checkbox unchecked and metadata checkbox checked',
async () => {
const staticVariables = canvas.getByRole('tab', {name: 'Registratie'});
await userEvent.click(staticVariables);

const editIcon = canvas.getByTitle('Registratie-instellingen bewerken');
await userEvent.click(editIcon);

const checkboxes = await canvas.findAllByRole('checkbox');
await expect(checkboxes[0]).not.toBeChecked();
await expect(checkboxes[1]).toBeChecked();
await expect(checkboxes[1]).toBeDisabled();
}
);
},
};

Expand Down
Loading

0 comments on commit 85cfc56

Please sign in to comment.