gpt4 book ai didi

ios - 在 iOS 上点击行为与 disableSynchroniztion 不一致

转载 作者:行者123 更新时间:2023-11-28 21:37:20 25 4
gpt4 key购买 nike

我有一个使用 WebView 登录应用程序的测试(通过使用带有按钮的文本输入 + injectedJavaScript 以一种 hacky 的方式完成,因为不支持 WebView 检测)。

问题的出现是因为 WebView 中的登录操作异步发生并破坏了 Detox 同步,所以我必须自己使用 disableSynchronizationenableSynchronization 手动管理它。登录后,我有一个到新屏幕的堆栈过渡动画(来自 react 导航),我需要按下该屏幕上的按钮才能继续。但是 Detox 仍然无法与该屏幕同步,因此我使用点击来按下禁用同步的按钮。

这就是问题所在,tap 并不总是有效,并且在 50% 的时间里,在 disableSynchronization 调用之后执行的任何操作都会超时而失败。这使得测试不稳定并且几乎没有用

谁能推荐解决方法或知道问题出在哪里?

环境排毒:12.10.3。 react native :0.59.8节点:v11.7.0设备:iOS 模拟器 (iPhone 8)操作系统:iOS

我尝试在点击按钮之前和之后禁用和启用同步,但它没有帮助,实际上导致测试失败并超时。

我的登录方法代码:

export const loginAs = async (userID) => {
await element(by.id('introLoginBtn')).tap();
await expect(element(by.id('loginScreen'))).toBeVisible();

const userIdInput = element(by.id('testUserIdInput'));
await userIdInput.tap();
await userIdInput.typeText(userID);
await element(by.id('testLoginBtn')).tap();

// NOTE: WebView login breaks synchronization see
// https://github.com/wix/Detox/blob/master/docs/Troubleshooting.Synchronization.md
await device.disableSynchronization();

// Waiting for the element to be visible
await waitFor(element(by.id('acceptTermsBtn'))).toBeVisible().withTimeout(9000);

// This does not work consistently
await element(by.id('acceptTermsBtn')).tap();

await device.enableSynchronization();
};

当我使用 --debug-synchronization 200 进入调试控制台时:

detox[33941] INFO:  [actions.js] Sync Timer: Tracking Timer <__NSCFTimer: 0x600003e6de00>
detox[33941] INFO: [actions.js] Sync Timed: performSelector @selector(removeInactiveFingerTips) on DTXTouchVisualizerWindow
detox[33941] INFO: [actions.js] Sync Timed: animateWithDuration:delay:options:animations:completion:
detox[33941] INFO: [actions.js] Sync JavaScript Timers: Javascript Timers
detox[33941] INFO: [actions.js] Sync App State: undefined
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync Timed: performSelector @selector(removeFromSuperview) on COSTouchSpotView
detox[33941] INFO: [actions.js] Sync Timed: animateWithDuration:delay:options:animations:completion:
detox[33941] INFO: [actions.js] Sync Timed: performSelector @selector(removeInactiveFingerTips) on DTXTouchVisualizerWindow
detox[33941] INFO: [actions.js] Sync Timed: animateWithDuration:delay:options:animations:completion:
detox[33941] INFO: [actions.js] Sync JavaScript Timers: Javascript Timers
detox[33941] INFO: [actions.js] Sync App State: undefined
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync Timed: performSelector @selector(removeInactiveFingerTips) on DTXTouchVisualizerWindow
detox[33941] INFO: [actions.js] Sync Timed: performSelector @selector(removeFromSuperview) on COSTouchSpotView
detox[33941] INFO: [actions.js] Sync Timed: animateWithDuration:delay:options:animations:completion:
detox[33941] INFO: [actions.js] Sync JavaScript Timers: Javascript Timers
detox[33941] INFO: [actions.js] Sync App State: undefined
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync Timed: performSelector @selector(removeInactiveFingerTips) on DTXTouchVisualizerWindow
detox[33941] INFO: [actions.js] Sync Timed: performSelector @selector(removeFromSuperview) on COSTouchSpotView
detox[33941] INFO: [actions.js] Sync WXAnimatedDisplayLinkIdlingResource: undefined
detox[33941] INFO: [actions.js] Sync App State: undefined
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync Timed: performSelector @selector(removeInactiveFingerTips) on DTXTouchVisualizerWindow
detox[33941] INFO: [actions.js] Sync WXAnimatedDisplayLinkIdlingResource: undefined
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync WXAnimatedDisplayLinkIdlingResource: undefined
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync JavaScript Timers: Javascript Timers
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync JavaScript Timers: Javascript Timers
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync JavaScript Timers: Javascript Timers
detox[33941] INFO: [actions.js] Sync Dispatch Queue: com.apple.main-thread
detox[33941] INFO: [actions.js] Sync JavaScript Timers: Javascript Timers

重复最后 3 行,直到测试超时。

并在使用launchArgs: { 'detoxPrintBusyIdleResources': 'YES' } 启动并运行 xcrun simctl spawn booted log stream --level debug --style compact --predicate "category= ='EarlGreyStatistics'":

Error from getpwuid_r: 0 (Undefined error: 0)
Filtering the log data using "category == "EarlGreyStatistics""

最佳答案

我遇到的问题确实是由无限循环运行的动画引起的 Leo Nathan提到。

我有一个屏幕安装在 react-navigation 的堆栈导航器中的当前屏幕下方。使用 reset 卸载堆栈(以及无休止的动画屏幕)解决了这个问题。

关于ios - 在 iOS 上点击行为与 disableSynchroniztion 不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56857716/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com