From afe41f977c8b6cc33dc816233012e9b64f7b8fc8 Mon Sep 17 00:00:00 2001 From: Brian Hall Date: Fri, 29 Nov 2024 09:52:34 +0100 Subject: [PATCH] Allow for optional types (#1261) * Allow for optional types * Minor rename --- .../broker-protection.spec.js | 10 ++++ .../actions/fill-form-optional.json | 59 +++++++++++++++++++ .../broker-protection/pages/form.html | 4 ++ .../broker-protection/actions/fill-form.js | 17 ++++++ 4 files changed, 90 insertions(+) create mode 100644 injected/integration-test/test-pages/broker-protection/actions/fill-form-optional.json diff --git a/injected/integration-test/broker-protection.spec.js b/injected/integration-test/broker-protection.spec.js index efe89a7e0..74988f592 100644 --- a/injected/integration-test/broker-protection.spec.js +++ b/injected/integration-test/broker-protection.spec.js @@ -353,6 +353,16 @@ test.describe('Broker Protection communications', () => { await dbp.isFormFilled(); }); + test('fillForm with optional information', async ({ page }, workerInfo) => { + const dbp = BrokerProtectionPage.create(page, workerInfo.project.use); + await dbp.enabled(); + await dbp.navigatesTo('form.html'); + await dbp.receivesAction('fill-form-optional.json'); + const response = await dbp.collector.waitForMessage('actionCompleted'); + dbp.isSuccessMessage(response); + await dbp.isFormFilled(); + }); + test('click', async ({ page }, workerInfo) => { const dbp = BrokerProtectionPage.create(page, workerInfo.project.use); await dbp.enabled(); diff --git a/injected/integration-test/test-pages/broker-protection/actions/fill-form-optional.json b/injected/integration-test/test-pages/broker-protection/actions/fill-form-optional.json new file mode 100644 index 000000000..5a3f8799f --- /dev/null +++ b/injected/integration-test/test-pages/broker-protection/actions/fill-form-optional.json @@ -0,0 +1,59 @@ +{ + "state": { + "action": { + "actionType": "fillForm", + "id": "3", + "selector": ".ahm", + "dataSource": "userProfile", + "elements": [ + { + "type": "firstName", + "selector": "#user_first_name" + }, + { + "type": "lastName", + "selector": "#user_last_name" + }, + { + "type": "$generated_phone_number$", + "selector": "#user_phone" + }, + { + "type": "$generated_street_address$", + "selector": "#user_street_address" + }, + { + "type": "state", + "selector": "#state" + }, + { + "type": "$generated_zip_code$", + "selector": "#user_zip_code" + }, + { + "type": "$generated_random_number$", + "selector": "#random_number", + "min": "5", + "max": "15" + }, + { + "type": "cityState", + "selector": "#city_state" + }, + { + "type": "middleName", + "selector": "#user_middle_name" + } + ] + }, + "data": { + "userProfile": { + "firstName": "John", + "lastName": "Smith", + "city": "Chicago", + "state": "IL" + } + } + } + } + \ No newline at end of file diff --git a/injected/integration-test/test-pages/broker-protection/pages/form.html b/injected/integration-test/test-pages/broker-protection/pages/form.html index 81a719c1f..7aee661eb 100644 --- a/injected/integration-test/test-pages/broker-protection/pages/form.html +++ b/injected/integration-test/test-pages/broker-protection/pages/form.html @@ -18,6 +18,10 @@ First Name: +