From edb82b2f65581b999191b5d7bfba043efc87c7ec Mon Sep 17 00:00:00 2001 From: Brian Hall Date: Tue, 22 Oct 2024 16:30:34 -0500 Subject: [PATCH 1/2] Support a city/state composite value --- .../integration-test/broker-protection.spec.js | 1 + .../page-objects/broker-protection.js | 14 ++++++++------ .../broker-protection/actions/fill-form.json | 4 ++++ .../test-pages/broker-protection/pages/form.html | 4 ++++ .../broker-protection/actions/fill-form.js | 8 ++++++++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/injected/integration-test/broker-protection.spec.js b/injected/integration-test/broker-protection.spec.js index 8732a1b66..111bd30ba 100644 --- a/injected/integration-test/broker-protection.spec.js +++ b/injected/integration-test/broker-protection.spec.js @@ -365,6 +365,7 @@ test.describe('Broker Protection communications', () => { await dbp.navigatesTo('form.html') await dbp.receivesAction('fill-form.json') const response = await dbp.waitForMessage('actionCompleted') + console.log(JSON.stringify(response, null, 2)) dbp.isSuccessMessage(response) await dbp.isFormFilled() }) diff --git a/injected/integration-test/page-objects/broker-protection.js b/injected/integration-test/page-objects/broker-protection.js index 0ee10d6a6..ac0f952d8 100644 --- a/injected/integration-test/page-objects/broker-protection.js +++ b/injected/integration-test/page-objects/broker-protection.js @@ -52,12 +52,12 @@ export class BrokerProtectionPage { * @return {Promise} */ async isFormFilled () { - await expect(this.page.getByLabel('First Name:')).toHaveValue('John') - await expect(this.page.getByLabel('Last Name:')).toHaveValue('Smith') - await expect(this.page.getByLabel('Phone Number:')).toHaveValue(/^\d{10}$/) - await expect(this.page.getByLabel('Street Address:')).toHaveValue(/^\d+ [A-Za-z]+(?: [A-Za-z]+)?$/) - await expect(this.page.getByLabel('State:')).toHaveValue('IL') - await expect(this.page.getByLabel('Zip Code:')).toHaveValue(/^\d{5}$/) + await expect(this.page.getByLabel('First Name:', { exact: true })).toHaveValue('John') + await expect(this.page.getByLabel('Last Name:', { exact: true })).toHaveValue('Smith') + await expect(this.page.getByLabel('Phone Number:', { exact: true })).toHaveValue(/^\d{10}$/) + await expect(this.page.getByLabel('Street Address:', { exact: true })).toHaveValue(/^\d+ [A-Za-z]+(?: [A-Za-z]+)?$/) + await expect(this.page.locator('#state')).toHaveValue('IL') + await expect(this.page.getByLabel('Zip Code:', { exact: true })).toHaveValue(/^\d{5}$/) const randomValue = await this.page.getByLabel('Random number between 5 and 15:').inputValue() const randomValueInt = parseInt(randomValue) @@ -65,6 +65,8 @@ export class BrokerProtectionPage { expect(Number.isInteger(randomValueInt)).toBe(true) expect(randomValueInt).toBeGreaterThanOrEqual(5) expect(randomValueInt).toBeLessThanOrEqual(15) + + await expect(this.page.getByLabel('City & State:', { exact: true })).toHaveValue('Chicago, IL') } /** diff --git a/injected/integration-test/test-pages/broker-protection/actions/fill-form.json b/injected/integration-test/test-pages/broker-protection/actions/fill-form.json index 7d03f83ef..711aaa31f 100644 --- a/injected/integration-test/test-pages/broker-protection/actions/fill-form.json +++ b/injected/integration-test/test-pages/broker-protection/actions/fill-form.json @@ -34,6 +34,10 @@ "selector": "#random_number", "min": "5", "max": "15" + }, + { + "type": "cityState", + "selector": "#city_state" } ] }, 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 94e8d882f..81a719c1f 100644 --- a/injected/integration-test/test-pages/broker-protection/pages/form.html +++ b/injected/integration-test/test-pages/broker-protection/pages/form.html @@ -51,6 +51,10 @@ Random number between 5 and 15: +