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 31, 2025
1 parent a3a6bea commit 1965c0b
Show file tree
Hide file tree
Showing 19 changed files with 655 additions and 294 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 registrationVariables = canvas.getByRole('tab', {name: /Registratie/});
await userEvent.click(registrationVariables);

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
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
interactions:
- request:
body: '"{\"values\": {\"auth_bsn\": \"123456789\", \"firstName\": \"We Are\"},
\"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"auth_bsn\": {\"title\": \"BSN\", \"description\":
\"Uniquely identifies the authenticated person. This value follows the rules
for Dutch social security numbers.\", \"type\": \"string\", \"pattern\": \"^\\\\d{9}$\",
\"format\": \"nl-bsn\"}, \"firstName\": {\"title\": \"Firstname\", \"type\":
\"string\"}}, \"required\": [\"firstName\", \"auth_bsn\"], \"additionalProperties\":
false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDYsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.yOsfPLV9PeMal-KDFPCGvOKbOCO_3R_2SdMpSNFKj8s
Connection:
- keep-alive
Content-Length:
- '575'
- '779'
Content-Type:
- application/json
User-Agent:
Expand Down Expand Up @@ -47,7 +49,7 @@ interactions:
Content-Type:
- text/html; charset=utf-8
Date:
- Mon, 27 Jan 2025 11:59:48 GMT
- Thu, 30 Jan 2025 15:45:46 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
interactions:
- request:
body: '"{\"values\": {}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
false}, \"metadata\": {\"auth_type\": \"bsn\", \"public_reference\": \"OF-ABC123\",
\"form_version\": \"Version 1.0\", \"registration_timestamp\": \"2025-01-30T13:05:00Z\"},
\"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"auth_type\": {\"title\": \"Authentication
type\", \"type\": \"string\", \"enum\": [\"bsn\", \"kvk\", \"pseudo\", \"employee_id\",
\"\"]}, \"public_reference\": {\"title\": \"Public reference\", \"type\": \"string\"},
\"form_version\": {\"title\": \"Form version\", \"type\": \"string\"}, \"registration_timestamp\":
{\"title\": \"Registration timestamp\", \"type\": \"string\", \"format\": \"date-time\"}},
\"required\": [\"form_version\", \"public_reference\", \"registration_timestamp\",
\"auth_type\"], \"additionalProperties\": false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNDIzMDAsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.47tdIv_fK-NTZyUtsVeNdZ4fAQvFuFvJcjYELMjeb8U
Connection:
- keep-alive
Content-Length:
- '1027'
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.2
method: POST
uri: http://localhost/json_plugin
response:
body:
string: "{\n \"data\": {\n \"metadata\": {\n \"auth_type\": \"bsn\",\n
\ \"form_version\": \"Version 1.0\",\n \"public_reference\": \"OF-ABC123\",\n
\ \"registration_timestamp\": \"2025-01-30T13:05:00Z\"\n },\n \"metadata_schema\":
{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"auth_type\":
{\n \"enum\": [\n \"bsn\",\n \"kvk\",\n \"pseudo\",\n
\ \"employee_id\",\n \"\"\n ],\n \"title\":
\"Authentication type\",\n \"type\": \"string\"\n },\n \"form_version\":
{\n \"title\": \"Form version\",\n \"type\": \"string\"\n
\ },\n \"public_reference\": {\n \"title\": \"Public
reference\",\n \"type\": \"string\"\n },\n \"registration_timestamp\":
{\n \"format\": \"date-time\",\n \"title\": \"Registration
timestamp\",\n \"type\": \"string\"\n }\n },\n \"required\":
[\n \"form_version\",\n \"public_reference\",\n \"registration_timestamp\",\n
\ \"auth_type\"\n ],\n \"type\": \"object\"\n },\n \"values\":
{},\n \"values_schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {},\n \"required\":
[],\n \"type\": \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- '1368'
Content-Type:
- application/json
Date:
- Thu, 30 Jan 2025 15:45:46 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
code: 201
message: CREATED
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@ interactions:
- request:
body: '"{\"values\": {\"file\": [{\"file_name\": \"file1.txt\", \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\"},
{\"file_name\": \"file2.txt\", \"content\": \"Q29udGVudCBleGFtcGxlIGlzIHRoaXMu\"}]},
\"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"file\": {\"title\": \"File\", \"type\":
\"array\", \"items\": {\"type\": \"object\", \"properties\": {\"file_name\":
{\"type\": \"string\"}, \"content\": {\"type\": \"string\", \"format\": \"base64\"}},
\"required\": [\"file_name\", \"content\"], \"additionalProperties\": false}}},
\"required\": [\"file\"], \"additionalProperties\": false}}"'
\"required\": [\"file\"], \"additionalProperties\": false}, \"metadata\": {},
\"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDYsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.yOsfPLV9PeMal-KDFPCGvOKbOCO_3R_2SdMpSNFKj8s
Connection:
- keep-alive
Content-Length:
- '654'
- '858'
Content-Type:
- application/json
User-Agent:
Expand All @@ -27,7 +30,14 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
\ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
false,\n \"properties\": {},\n \"required\": [],\n \"type\":
\"object\"\n },\n \"values\": {\n \"file\": [\n {\n \"content\":
\"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n \"file_name\": \"file1.txt\"\n
\ },\n {\n \"content\": \"Q29udGVudCBleGFtcGxlIGlzIHRoaXMu\",\n
\ \"file_name\": \"file2.txt\"\n }\n ]\n },\n \"values_schema\":
{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"file\":
{\n \"items\": {\n \"additionalProperties\": false,\n
\ \"properties\": {\n \"content\": {\n \"format\":
Expand All @@ -36,20 +46,17 @@ interactions:
\ \"required\": [\n \"file_name\",\n \"content\"\n
\ ],\n \"type\": \"object\"\n },\n \"title\":
\"File\",\n \"type\": \"array\"\n }\n },\n \"required\":
[\n \"file\"\n ],\n \"type\": \"object\"\n },\n \"values\":
{\n \"file\": [\n {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n
\ \"file_name\": \"file1.txt\"\n },\n {\n \"content\":
\"Q29udGVudCBleGFtcGxlIGlzIHRoaXMu\",\n \"file_name\": \"file2.txt\"\n
\ }\n ]\n }\n },\n \"message\": \"Data received\"\n}\n"
[\n \"file\"\n ],\n \"type\": \"object\"\n }\n },\n \"message\":
\"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- '1057'
- '1287'
Content-Type:
- application/json
Date:
- Mon, 27 Jan 2025 11:59:48 GMT
- Thu, 30 Jan 2025 15:45:46 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
interactions:
- request:
body: '"{\"values\": {}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
body: '"{\"values\": {}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"foo.bar\": {\"title\": \"Nested key\",
\"type\": \"string\"}}, \"required\": [\"foo.bar\"], \"additionalProperties\":
false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- '261'
- '465'
Content-Type:
- application/json
User-Agent:
Expand All @@ -23,21 +25,24 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"foo.bar\":
{\n \"title\": \"Nested key\",\n \"type\": \"string\"\n
\ }\n },\n \"required\": [\n \"foo.bar\"\n ],\n
\ \"type\": \"object\"\n },\n \"values\": {}\n },\n \"message\":
\"Data received\"\n}\n"
string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
\ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
false,\n \"properties\": {},\n \"required\": [],\n \"type\":
\"object\"\n },\n \"values\": {},\n \"values_schema\": {\n \"$schema\":
\"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
false,\n \"properties\": {\n \"foo.bar\": {\n \"title\":
\"Nested key\",\n \"type\": \"string\"\n }\n },\n \"required\":
[\n \"foo.bar\"\n ],\n \"type\": \"object\"\n }\n },\n
\ \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- '384'
- '614'
Content-Type:
- application/json
Date:
- Mon, 27 Jan 2025 11:59:48 GMT
- Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
Expand Down
Loading

0 comments on commit 1965c0b

Please sign in to comment.