首页 > 解决方案 > 如何在@react-native-community/datetimepicker 中选择日期,同时在 android 中使用 detox 编写 e2e 测试用例?

问题描述

我正在使用 @react-native-community/datetimepicker 并尝试使用 Detox 编写一些 e2e 测试用例。我不知道如何在calendar显示的日期选择器中选择特定日期。

我做了什么:

  1. 我已经查找了库中编写的测试用例,但他们设置了默认日期,并且他们通过使用选择了预期日期,await testElement.tapAtPoint({x: 50, y: 200});但我需要它更加动态,所以不能使用 tapAtPoint。
  2. 我还查看了 Detox 文档,他们有这种方法setDatePickerDate(dateString: string, dateFormat: string): Promise<void>;,但它仅适用于 android。

谁能帮我解决这个问题?谢谢!

标签: androidreact-nativedatetimepickerdetox

解决方案


推荐阅读