Test For Consent Required Using 'consentIsGiven' Command
To test a site notice, where Consent is Required, there is a flag in the site notice settings that you can use to verify this is working properly. To see whether an active user has provided consent, run the command `evidon.notice.consentIsGiven` in the devTools Console.
1) Navigate to a site with a notice that has Consent Required. Require or disable consent required using the checkbox in Step 3 of the Privacy tool. Note: On a notice where consent is not required or a country is not specified on the notice, the following tests will return `true` as the expected result.
2) Open devTools (f12) and click on Console.
3) Execute the command `evidon.notice.consentIsGiven` in console, verify it returns FALSE
3) Give consent
4) Execute the command again, verify it returns TRUE
5) Refresh the page
6) Execute the command, verify it returns TRUE (this is where it was breaking, it was intermittently returning FALSE)
If you test a site/country that doesn't have consent required, the command returns TRUE before giving consent, that's also expected since consent is not required.
If you want to take it a step further.
7) Clear our consent cookie
😎 Refresh the page, rerun the command and it then should return FALSE as you have effectively withdrawn consent