-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hello to everyone,
I would like to ask if it could be possible to add a new parameter to add the availability to pass test ID's on the UI elements of the Didomi notice.
Context
Currently, I am working on a react-native project which uses Didomi as consent management solution.
We have an OnBoarding process where we display the Didomi consent notice (with the Didomi.setupUI() function) and the user can accept or deny the cookies.
I am now working on the implementation of E2E tests (with detox), and my team would like to make a complete test case scenario for the OnBoarding process
Current researches
From what I looked in the documentation, there is no way to pass testID's to any part of the notice UI generated by the Didomi.setupUI.
I have looked all the other functions documentation, but it doesn't seem to exist.
iOS
For iOS, I managed to extract some native ID's using the XCode Layout Inspector and by using them in my E2E test, I was able to target and validate the existence of the UI element (both for accepting and rejecting the cookies)👍
// Part of Detox E2E test
await expect(element(by.id('notice_agree_button'))).toBeVisible();
await element(by.id('notice_agree_button')).tap();But these are ID's on which I have no control 🙁 if in a new update of this package, there is a change, I would have to start again
Android
Here is the limitation, even when using the Android Studio Layout Inspector, I was not able to find any ID that could work with my E2E test.
I could only find the native ID of the button (ex: @id/button_notice_header_disagree_link) but detox is not able to target it as the by.id function is limited to ID's given by the testID prop of react-native
Current workaround
Currently, I am using the text of the button's, it works but it could be great if I could have control on the test ID's for iOS and Android 🙂
Feature request
Could it be possible to add some parameter for example on the setupUI function to pass some test ID's ? 🙂
We could have an object who could have a specific key for each UI element and give us the oppportunity to pass them when running Didomi.setupUI
Example :
await Didomi.setupUI({
noticeTestIds: {
acceptAll: 'acceptAllCookiesButton',
rejectAll: 'rejectAllCookiesButton',
knowMore: 'learnMoreButton',
// ...
},
});I would be more than happy to contribute to this package if needed and implement this feature 🙂
Thank you very much for reading this post
Best regards