Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for conditional clicking (#3623)
Task/Issue URL: https://app.asana.com/0/1199230911884351/1208647902506360/f Tech Design URL: CC: **Description**: Adds support for conditional clicking of elements by adding “choices” and “default” keys to the click action. **Optional E2E tests**: - [x] Run PIR E2E tests Check this to run the Personal Information Removal end to end tests. If updating CCF, or any PIR related code, tick this. **Steps to test this PR**: The easiest way to test whether the decoding is working is to setup one of the test files from the C-S-S integration tests as a fake broker: 1. Download [this file](https://github.com/duckduckgo/content-scope-scripts/blob/main/injected/integration-test/test-pages/broker-protection/pages/expectation-actions.html) on your local machine. Open it to copy the file path, should start with `file://` 2. Download [this JSON](https://gist.github.com/brianhall/969d81b04b8d4fff4e21c9c6b48164b9) and update the url to the file path you copied in 1. 3. Save the JSON file in the macos-browser repo under `LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Resources/JSON` 4. Build the browser (no need for any special dependencies, just build `main`), then open the debug version of PIR: Debug Menu -> Personal Information Removal -> Run Personal Information Removal in Debug Mode. 5. In Birth Year enter `1965`, then select **Test Broker** in the list of brokers and click the Run button. 6. After about 30 seconds, right click the webview and Inspect Element, then click the console tab and type `window.location.href` and hit enter. You should see a url that ends with `#1`, which means that the user was older than 45. 7. Do steps 5-6 again, but for birth year enter `1990`, when you do `window.location.href` you should get a url that ends with `#2` instead, indicating that the user is < 45. 8. Edit the mybrokertest.com.json file, copy/paste the contents of [this gist](https://gist.github.com/brianhall/ebac912c56c5e904ec86c05e3fa3ab30) in and save. This just sets the default case at the bottom to `null`. _Now re-build the browser to load the updated JSON._ 9. Run steps 5-7 again, this time `window.location.href` should return a url with `#1` for step 5, and a url with no `#` at the end for step 7, meaning that nothing was clicked and no error was triggered. 10. Edit the mybrokertest.com.json file again and remove line 45 (and the comma above on line 44) and then rebuild the browser to update the JSON. Finally steps 5-7 again - step 5 should return no errors (and have a `#1` hash at the end of the url), and step 7 should not return an error, but also not have any hash (e.g. `#1`) at the end of the url. **Definition of Done**: * [ ] Does this PR satisfy our [Definition of Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)? — ###### Internal references: [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f)
- Loading branch information