diff --git a/injected/integration-test/broker-protection.spec.js b/injected/integration-test/broker-protection.spec.js index 74988f5921..ec86d25282 100644 --- a/injected/integration-test/broker-protection.spec.js +++ b/injected/integration-test/broker-protection.spec.js @@ -469,6 +469,46 @@ test.describe('Broker Protection communications', () => { await page.waitForURL((url) => url.hash === '#no', { timeout: 2000 }); }); + test('clicking selectors that do not exists should fail', async ({ page }, workerInfo) => { + const dbp = BrokerProtectionPage.create(page, workerInfo.project.use); + await dbp.enabled(); + await dbp.navigatesTo('clicks.html'); + await dbp.receivesAction('click-nonexistent-selector.json'); + const response = await dbp.collector.waitForMessage('actionCompleted'); + + dbp.isErrorMessage(response); + }); + + test('clicking buttons that are disabled should fail', async ({ page }, workerInfo) => { + const dbp = BrokerProtectionPage.create(page, workerInfo.project.use); + await dbp.enabled(); + await dbp.navigatesTo('clicks.html'); + await dbp.receivesAction('click-disabled-button.json'); + const response = await dbp.collector.waitForMessage('actionCompleted'); + + dbp.isErrorMessage(response); + }); + + test('clicking selectors that do not exist when failSilently is enabled should not fail', async ({ page }, workerInfo) => { + const dbp = BrokerProtectionPage.create(page, workerInfo.project.use); + await dbp.enabled(); + await dbp.navigatesTo('clicks.html'); + await dbp.receivesAction('click-nonexistent-selector-failSilently.json'); + const response = await dbp.collector.waitForMessage('actionCompleted'); + + dbp.isSuccessMessage(response); + }); + + test('clicking buttons that are disabled when failSilently is enabled should not fail', async ({ page }, workerInfo) => { + const dbp = BrokerProtectionPage.create(page, workerInfo.project.use); + await dbp.enabled(); + await dbp.navigatesTo('clicks.html'); + await dbp.receivesAction('click-disabled-button-failSilently.json'); + const response = await dbp.collector.waitForMessage('actionCompleted'); + + dbp.isSuccessMessage(response); + }); + test('getCaptchaInfo', 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/click-disabled-button-failSilently.json b/injected/integration-test/test-pages/broker-protection/actions/click-disabled-button-failSilently.json new file mode 100644 index 0000000000..d83e149475 --- /dev/null +++ b/injected/integration-test/test-pages/broker-protection/actions/click-disabled-button-failSilently.json @@ -0,0 +1,16 @@ +{ + "state": { + "action": { + "actionType": "click", + "id": "1", + "elements": [ + { + "type": "button", + "selector": ".btn", + "failSilently": true + } + ] + } + } + } + \ No newline at end of file diff --git a/injected/integration-test/test-pages/broker-protection/actions/click-disabled-button.json b/injected/integration-test/test-pages/broker-protection/actions/click-disabled-button.json new file mode 100644 index 0000000000..b13e87c312 --- /dev/null +++ b/injected/integration-test/test-pages/broker-protection/actions/click-disabled-button.json @@ -0,0 +1,15 @@ +{ + "state": { + "action": { + "actionType": "click", + "id": "1", + "elements": [ + { + "type": "button", + "selector": ".btn" + } + ] + } + } + } + \ No newline at end of file diff --git a/injected/integration-test/test-pages/broker-protection/actions/click-nonexistent-selector-failSilently.json b/injected/integration-test/test-pages/broker-protection/actions/click-nonexistent-selector-failSilently.json new file mode 100644 index 0000000000..2d77354350 --- /dev/null +++ b/injected/integration-test/test-pages/broker-protection/actions/click-nonexistent-selector-failSilently.json @@ -0,0 +1,16 @@ +{ + "state": { + "action": { + "actionType": "click", + "id": "1", + "elements": [ + { + "type": "button", + "selector": ".test", + "failSilently": true + } + ] + } + } + } + \ No newline at end of file diff --git a/injected/integration-test/test-pages/broker-protection/actions/click-nonexistent-selector.json b/injected/integration-test/test-pages/broker-protection/actions/click-nonexistent-selector.json new file mode 100644 index 0000000000..8aa7698e15 --- /dev/null +++ b/injected/integration-test/test-pages/broker-protection/actions/click-nonexistent-selector.json @@ -0,0 +1,15 @@ +{ + "state": { + "action": { + "actionType": "click", + "id": "1", + "elements": [ + { + "type": "button", + "selector": ".test" + } + ] + } + } + } + \ No newline at end of file diff --git a/injected/integration-test/test-pages/broker-protection/pages/clicks.html b/injected/integration-test/test-pages/broker-protection/pages/clicks.html new file mode 100644 index 0000000000..13d06d3b00 --- /dev/null +++ b/injected/integration-test/test-pages/broker-protection/pages/clicks.html @@ -0,0 +1,20 @@ + + +
+ + +