I’m trying to generate a UItest in Xcode. When I try to swipe UIview I get
an error:
Timestamped Event Matching Error: Failed to find matching element
error window
This also happens if I try to tap UIView.
mfaani
31.4k18 gold badges156 silver badges278 bronze badges
asked Apr 14, 2016 at 7:52
2
You should verify that the ‘Accessibility’ option is enabled for the UIView object you are swiping from, for example:
answered Aug 24, 2016 at 10:52
AmitWAmitW
7787 silver badges11 bronze badges
5
Usually this issue is observed when the parent element of the element yo want to record is set to isAccessibilityElement = true
. In general, you have to have the parent element set to false to access the child element.
For example: if you have a UILabel
inside a view, the accessibility should be set to false for the view and set to true for the UILabel
.
Bruno Bieri
9,54311 gold badges61 silver badges89 bronze badges
answered Apr 2, 2019 at 9:40
Souma PaulSouma Paul
2012 silver badges2 bronze badges
1
For recording a new test, I don’t think there’s a solution yet. But, if you use an extension forcing tap with a test that already exists, works.
Example of use:
extension XCUIElement {
func forceTapElement() {
if self.hittable {
self.tap()
}
else {
let coordinate: XCUICoordinate = self.coordinateWithNormalizedOffset(CGVectorMake(0.0, 0.0))
coordinate.tap()
}
}
}
func testSomethingWithCells() {
let app = XCUIApplication()
let cells = app.tables.cells
sleep(1)
cells.elementBoundByIndex(0).forceTapElement()
}
You can check the original post here:
Xcode UI test — UI Testing Failure — Failed to scroll to visible (by AX action) when tap on Search field «Cancel’ button
answered May 31, 2016 at 9:12
Sophy SwiczSophy Swicz
1,27211 silver badges21 bronze badges
1
I’ve been occasionally running into this problem. Delete the app’s directory from DerivedData seems to help.
answered Aug 24, 2017 at 18:42
Dave LDave L
16110 bronze badges
In Xcode 9.3, where this is apparently still a problem, what I did was:
- Quit Xcode
- Reset the Simulator’s settings (Hardware -> Erase all
contents and settings) - Quit the Simulator
- Delete the derived data for the current app
- Restart Xcode
- Try recording again — it worked this time for me.
answered Apr 24, 2018 at 16:04
commandacommanda
4,8411 gold badge25 silver badges34 bronze badges
3
A solution that worked for myself was to identify the object differently.
In Xcode 8 I was able to use the following:
XCUIApplication().tables.cells["Camera Roll"].buttons["Camera Roll"].tap()
With Xcode 9 I got the error mentioned in this question. Ended up using the following, which worked (al beit more flakey than the original option)
XCUIApplication().cells.element(boundBy: 1).tap()
answered Sep 21, 2017 at 11:15
Charlie SCharlie S
4,2526 gold badges57 silver badges93 bronze badges
1
Even if you have Accessibility enabled for the element, you have to make sure that it has a unique accessibility identifier. In my case, I had copied & pasted a UISwitch
and assigned a different outlet to it, but it kept the same accessibility ID as the original one.
answered Aug 10, 2021 at 0:04
NRitHNRitH
13.2k4 gold badges43 silver badges44 bronze badges
Содержание
- [React-Native] — Fastlane screenshots, recorder throw «Timestamped Event Matching Error. » #12748
- Comments
- Question Checklist
- Question Subject
- Question Description
- React Native: snapshot/screengrab support #13859
- Comments
- New Issue Checklist
- Issue Description — (Only tested Screenshot (iOS), not Screengrab (Android))
- Workaround
- Workaround 2 (Have not managed to get this to work myself — but suggested somewhere)
- Reason for using screenshot:
- Environment
- React Native: snapshot/screengrab support #13859
- Comments
- New Issue Checklist
- Issue Description — (Only tested Screenshot (iOS), not Screengrab (Android))
- Workaround
- Workaround 2 (Have not managed to get this to work myself — but suggested somewhere)
- Reason for using screenshot:
- Environment
- WWDC 2016 Labs Highlights
- Xcode Open Hours
- SourceKit crashes
- External Frameworks
- Swift Open Hours
- Optional Booleans
- On Demand Resources Lab
- Third party libraries
- UI Testing And Continuous Integration
- Correct workflow when using the record feature
- Accessibility labels
- Reseting the app states after (before) tests
- Timestamped Event Matching Error: Failed to find matching element
[React-Native] — Fastlane screenshots, recorder throw «Timestamped Event Matching Error. » #12748
Question Checklist
- Updated fastlane to the latest version
- I read the Contribution Guidelines
- I read docs.fastlane.tools
- I searched for existing GitHub issues
Question Subject
Question about setting up the wanted screenshots with fastlane screenshots
Question Description
Alright, I was setting up my project with fastlane in order to generate screenshots for the release on the store. When I tried to update the textExample() function in [. ]UITest.swift using the Recorder , my simulator launched well, but when I clicked on any buttons, I got this error =>
Timestamped Event Matching Error: Failed to find matching element
I found many peoples with this issue but who weren’t doing a react native project.
Do you have any ideas about how to resolve it ?
The text was updated successfully, but these errors were encountered:
It seems like you have not included the output of fastlane env
To make it easier for us help you resolve this issue, please update the issue to include the output of fastlane env 👍
@MayeuldP Heyyy 👋 This sounds like its not related to your Fastfile but instead related to your UI tests. It sounds like you are trying to specific an element by name/key in your UI tests (that control the screenshots) and the element you are specifying by name/key doesn’t exist — either because its not on screen or its not configured properly.
I think that is all that I am able to help you since I cannot do much debugging on your UI tests 😔
@joshdholtz Hello, thank for your help, indeed, it worked for few components by adding testID=»identifier» as props.
However. for others elements, even if there’s a testID props, I got this as a return, app.otherElements.matching(random stuff) instead of app.buttons[«indetifier’] for example, so then, running fastlane screenshot doesnt work, and display that No matches found for Find: . Do I do something wrong with the testID ?
By the way, every time I run fastlane screenshots the app build every time again which is taking a long time, I tried to add derived_data_path : ./fastlane/DerivedDataPath and test_without_building true but didnt work.
Succeed to make it work for components, but still have troubles to use it for my TabNavigator even if I put
tabBarTestIDProps: < accessibilityLabel: ‘navigateProject’, testID: ‘navigateProject’ >, xCode doesn t find it.
@MayeuldP I think this is sadly a side effect of using an abstraction layer such as ReactNative 😔 I also have an RN app that writing snapshot stuff for was more difficult than it probably should have been just due to the way that RN creates its views. So it sounds like you are on the right track of getting things working 🙃
And setting a derived_data_path and test_without_building should have worked for making things build faster but again, this might be an RN thing? 😬
@joshdholtz Yeah indeed I succeed to make it works, concerning derived_data_path and test_without_building .
Concerning ReactNative, I think, it’s hard to make it work properly with fastlane. Do you guys plan to integrate fastlane for react-Native ?
Else, do you suggest or know, any tools for generate all the screenshots for a react-native app for itunes connect ?
Thanks for your help.
@MayeuldP We do try to support whatever our users are using and it seems like either RN is gaining popularity 😊 I would like to add more docs for RN and possibly some better onboarding in tools and such but there is also a fine line on how to manage our resources 🙃
That being said, I would love to hear all your pain points when integrating fastlane in RN 🙏 I have an RN app that I maintain but I have fastlane working but I probably have a different view on fastlane 😇
Is your main issue on just taking screenshots with RN? Or were there some other gotchas that you found?
Would be so cool indeed.
Yeah I was planing to use fastlane only for the screenshots. Well, actually, since there’s no documentation for RN on fastlane, I needed to go search for informations here and there on internet. There’s several tutorials about how managing release and automatic deployments, but never about the screenshots, since UI tests on Xcode for RN Project is not well supported.
I succeed to manage fews components with the testID props which is supported by xcode. But nor for all of them on my RN project.
I think, it’s more a question for react-native to better manage testID and UI Tests on xcode, than fastlane to adapt himself.
Источник
React Native: snapshot/screengrab support #13859
(Issue opened by request from fastlane/docs#626)
New Issue Checklist
- Updated fastlane to the latest version
- I read the Contribution Guidelines
- I read docs.fastlane.tools
- I searched for existing GitHub issues
Issue Description — (Only tested Screenshot (iOS), not Screengrab (Android))
Setting up RN build/release lanes with existing guides works fine out of the box! 🙂 (standard guides)
Having huge issues with screenshot, which was the entire reason for looking at fastlane to begin with.
Would love it if there were to be a how-to on supporting this, without introducing invisible hacks that depends on libraries like redux and therefore also react navigation with redux (which seems to be a deprecated feature). Or removing accessible features within the app.
As stated elsewhere, i added the prop testID=» » to the elements, especially those where which i would interact with. I also tried decorating it with accessible= .
Sometimes it says «Timestamped event matching error failed to find matching element», other times it seems to capture an element, but instead of refering to the element by the testID, it seems to create its own identifier which just contains all the text.
I think this is more of a recording issue, but since it was asked to be created as an issue here by one of the contributors, i did so.
Workaround
Its mentioned elsewhere to create a nearly invisible «button» which gets tapped, and updates the redux navigation state. By doing so, you can just refer to the same element, and tap it on each screen to go to the appropriate screen afterwards.
This might work for redux users, but not all apps use redux. And i dont believe that adding the «complexity» of redux to the app, for the benefit of trying to use this feature.
React-Navigation will also stop supporting this behavior in the next version of React-Navigation:
https://reactnavigation.org/docs/en/redux-integration.html
Workaround 2 (Have not managed to get this to work myself — but suggested somewhere)
Set accessible= on elements which gives you a hard time.
Applications are actually required to be accessible in Norway (and from 1.1.2019 — The entire EU).
Hacking the app, and thereby making it less accessible is therefore not a wanted operation. Neither is making this change back and forth everytime a new screenshot is to be taken.
I can see that i would be a well invested effort in the later game of any application (adding and removing accessibilty for the sake of the screenshots) — But in the early stages of the app, screenshots might rapidly change — and therefore it would be very time consuming if we were to do this «dance» everytime.
Reason for using screenshot:
Localization of app and framing w/ localized text.
Environment
Issue is not directly related to anything fastlane, as i dont get far enough in the setup.
The text was updated successfully, but these errors were encountered:
Источник
React Native: snapshot/screengrab support #13859
(Issue opened by request from fastlane/docs#626)
New Issue Checklist
- Updated fastlane to the latest version
- I read the Contribution Guidelines
- I read docs.fastlane.tools
- I searched for existing GitHub issues
Issue Description — (Only tested Screenshot (iOS), not Screengrab (Android))
Setting up RN build/release lanes with existing guides works fine out of the box! 🙂 (standard guides)
Having huge issues with screenshot, which was the entire reason for looking at fastlane to begin with.
Would love it if there were to be a how-to on supporting this, without introducing invisible hacks that depends on libraries like redux and therefore also react navigation with redux (which seems to be a deprecated feature). Or removing accessible features within the app.
As stated elsewhere, i added the prop testID=» » to the elements, especially those where which i would interact with. I also tried decorating it with accessible= .
Sometimes it says «Timestamped event matching error failed to find matching element», other times it seems to capture an element, but instead of refering to the element by the testID, it seems to create its own identifier which just contains all the text.
I think this is more of a recording issue, but since it was asked to be created as an issue here by one of the contributors, i did so.
Workaround
Its mentioned elsewhere to create a nearly invisible «button» which gets tapped, and updates the redux navigation state. By doing so, you can just refer to the same element, and tap it on each screen to go to the appropriate screen afterwards.
This might work for redux users, but not all apps use redux. And i dont believe that adding the «complexity» of redux to the app, for the benefit of trying to use this feature.
React-Navigation will also stop supporting this behavior in the next version of React-Navigation:
https://reactnavigation.org/docs/en/redux-integration.html
Workaround 2 (Have not managed to get this to work myself — but suggested somewhere)
Set accessible= on elements which gives you a hard time.
Applications are actually required to be accessible in Norway (and from 1.1.2019 — The entire EU).
Hacking the app, and thereby making it less accessible is therefore not a wanted operation. Neither is making this change back and forth everytime a new screenshot is to be taken.
I can see that i would be a well invested effort in the later game of any application (adding and removing accessibilty for the sake of the screenshots) — But in the early stages of the app, screenshots might rapidly change — and therefore it would be very time consuming if we were to do this «dance» everytime.
Reason for using screenshot:
Localization of app and framing w/ localized text.
Environment
Issue is not directly related to anything fastlane, as i dont get far enough in the setup.
The text was updated successfully, but these errors were encountered:
Источник
WWDC 2016 Labs Highlights
Most of my time in WWDC was spent in the labs — since sessions can be downloaded and watched later. I’ve learned A LOT and I would love to share of this knowledge with you.
Notice — this post will not cover any of the new iOS 10 features or anything from the sessions I did go to. Watch them for yourself!
This post will cover only what I have learned in the labs.
Xcode Open Hours
SourceKit crashes
We have a lot of SourceKit crashes. This causes us to lose autocompletion, colors, cmd+click etc… We don’t know why and it’s annoying as hell.
I tried to understand if there’s a way we can see the crash logs.
Fortunately for us — there is.
Unfortunately for us — it sucks.
But — we’ll take what we can get…
We can’t see logs for crashes that already happened — but we can initiate a debugging session and hope that SourceKit will crash during that session. And let’s face it… It probably will…
Open Terminal and enter the following:
Replace # with the following values:
1 — For requests only
2 — For requests + responses
3 — For requests + responses + notifications
This will allow you to see all of the messages between Xcode and SourceKit. Once SourceKit will crash you should be able to see the line that caused the actual crash and hopefully will provide enough clues to how to deal with it.
External Frameworks
I initially wanted to ask about how to turn some code I’m working on into a framework we import to various apps we build. The requirements were to be able to use it on the same project as a different app (for the ease of changes) but still treat it as a separate framework. I was having some issues doing that myself.
Good thing I did that because turns out we were “doing it wrong” with another framework we were using. Our project was using a Workspace in order to include another framework’s project and add it as dependancy.
Turns out this is a workaround and not how it should be done
Leaving it this way could cause a few problems in the future (the Apple engineer claimed he could think of at least 15 potential issues) plus the chance of being rejected from the app store in some cases (yes — I found it hard to believe as well…).
Here’s the correct way to do it:
- Open your app’s project
- Drag the framework project into the app’s project
- Add the framework as Target Dependency — in the Build Phases tab
- Add the framework as Embedded Binary — in the General tab (choose from the product folder)
- Add the framework folder to the Frameworks Search Paths — in the Build Settings tab
At this point my project wouldn’t compile anymore.
I added a couple more steps which fixed everything and allowed me to use the framework in the same project without using a Workspace — the way “it should” be done:
6. Tap on the app’s in the project hierarchy and then File->Project Settings
7. Tap on Advanced and change it from Legacy to Xcode Default
You can now remove the existing build folders from the project and Xcode should continue as usual.
Swift Open Hours
Optional Booleans
I was having some issues with reading optional Bool values from Swift to Objective-C. Turns out there is no representation of a Swift optional Bool variable in Objective-C. Unlike optional NSString and NSNumber — which can be nil in Objective-C — Boolean values cannot be nil in Objective-C.
Changing to Bool to a non-optional variable solved the problem.
On Demand Resources Lab
Third party libraries
I already knew the answer — but I felt like I had to ask.
Can we use the On Demand Resources capability in order to lazy load third party libraries like Card.IO?
The answer was, obviously, “NO” — but they were interested in this use case.
They suggested we submit a feature request and it might get things moving. The more duplications in requests the better by the way..
UI Testing And Continuous Integration
Correct workflow when using the record feature
Unfortunately, the record feature is far from perfect. It gives you a nice place to start but there’s a few hours of refactoring after you complete recording a test.
I wanted to make sure I’m not doing anything wrong — and turns out I wasn’t — this is how it works.
A good practice will be to start creating known working test “actions” like “login”, “go to specific screen”, “enter text into search bar”, etc…
Then — we will only need to record very small parts of the test instead of entire flows.
Accessibility labels
We kind of suck with accessibility labels.
A lot of actions I recorded were searching for static text in order to find the UI controls instead of the preferable way — which is accessibility labels.
Adding more accessibility labels through the app will allow for easier and quicker tests creation + the added value of actually having accessibility labels for the hearing impaired.
Reseting the app states after (before) tests
When running a UI tests suit you would probably want to run a few tests that doesn’t rely on each other. Each test should start with a clean app.
That’s why I used to add “delete accounts and logout” actions to the end of tests. The problem is when one test fails in the middle — it also fails to remove the accounts and logout. So following tests will start with the changes that were made by the failing test.
I asked if there’s a way to reset the app state each time a new test starts. There’s no way to do that — but Apple engineer suggested to add a testing flag in the project settings that will be detected by the app (when loading) and will cause it remove all user data when that flag is active (via code).
Timestamped Event Matching Error: Failed to find matching element
When recording a test, selecting an already selected UITableViewCell will cause the test recording to crash with the message “Timestamped Event Matching Error: Failed to find matching element”.
Turns out Apple has an open bug with this exact issue but didn’t know the reproducing steps. So we were both very excited I know exactly how to crash the recording every time.
I still need to create a new project and see if it happens there as well — or is it specifically on my app. I really hope I would be able to help them fix the problem soon.
Источник
Вы должны убедиться, что опция «Доступность» включена для объекта UIView, из которого вы работаете, например:
AmitW
24 авг. 2016, в 11:53
Поделиться
Решение, которое работало для меня, заключалось в том, чтобы идентифицировать объект по-разному.
В Xcode 8 я смог использовать следующее:
XCUIApplication().tables.cells["Camera Roll"].buttons["Camera Roll"].tap()
С Xcode 9 я получил ошибку, упомянутую в этом вопросе. Закончилось использование следующего, которое сработало (что более похоже на исходный вариант)
XCUIApplication().cells.element(boundBy: 1).tap()
Charlie Seligman
21 сен. 2017, в 12:49
Поделиться
Я иногда сталкивался с этой проблемой. Удалить каталог приложений из DerivedData, похоже, поможет.
Dave L
24 авг. 2017, в 19:19
Поделиться
Ещё вопросы
- 0От загруженного iframe для iframe не получено сообщение vaild
- 0Попытка заменить символы в C ++ Strings, полностью застрял
- 0Php Phalcon с шаблоном Smarty
- 1Ошибка при вызове метода setRequestedOrientation ()
- 0Платежи по кредитной карте Payeezy всегда получают сообщение об ошибке «Ошибка проверки HMAC»
- 0почему эта угловая директива не обновляется
- 1Как объединить два тензора, имеющих разную форму, с TensorFlow?
- 1Ленивая оценка numpy.max
- 1Сеансы Tensorflow — сфера контекста сеанса?
- 0Оптимизировать запрос, который группирует результаты по полю из объединенной таблицы
- 1Python: Numpy объединяет массивы в списки 2×1
- 0MySQL Выбрать разные данные в одной строке в один и тот же запрос
- 0Добавьте другую функцию jQuery к каждой кнопке в том же классе
- 0несколько целей сборки в надстройке
- 0Атрибуты AngularJs против области действия в директивах
- 0Невозможно распаковать результат запроса pymysql в переменные
- 0Как получить скрипт для вставки всего пользовательского ввода в C ++
- 0JQuery удалить не работают при запуске через сопоставленный набор
- 0Создание проекта Symfony
- 1Альтернатива .Equals () при передаче нулевого значения
- 0Кто-нибудь уже использовал библиотеку Triangle / Triangle ++ в проекте C ++? (триангуляция Делоне)
- 0Allegro al_load_ttf_font не может найти файл
- 1Полимер 2.0 класса наследственно защищенных свойств
- 1показывать изображения по одному
- 0Угловая повторяющаяся группа радиокнопок в списке
- 0Страница FacebookRedirectLoginHelper — на какую страницу следует перенаправить?
- 0jquery SuperSize нужно перезагрузить страницу после воспроизведения слайдов
- 1Использование API набора данных TensorFlow приводит к зависанию процесса в деструкторе сеанса
- 0AngularJS — модульный тест с ответом заголовка
- 1Android — Настройка обнаружения коллизий растровых изображений после поворота по матрице
- 0Изменить имя базы данных таблицы в рабочей среде EER Diagram
- 0Рендеринг двух меньших текстур на большую текстуру
- 1Как найти maven зависимости, которые не используются?
- 1Диаграмма классов Visual Studio 2008 с более подробной информацией?
- 1Как встроить программу Windows в компонент Java
- 0JavaScript innerHTML связывает браузер iOS
- 0Изображения элементов списка повторяются в HTML
- 1Когда мы используем тип ссылки и тип объекта [дубликата]
- 0Изменение цвета маршрута маршрута карты Google с перемещением навигатора от одной точки к другой.
- 1Добавление WCF веб-сервиса Xamarin Studio
- 0Получить все записи из одной таблицы плюс относительную последнюю запись второй таблицы
- 0wxStreamToTextRedirector новые строки потеряны
- 1MSMQ — могу ли я запрашивать сообщения, которые в данный момент обрабатываются?
- 1Поле ввода синхронизации Vue.js
- 1Libgdx, JSON: Json.tojson (объект) продолжает возвращать {}
- 1Android — определение элементов любого макета на новом экране (действие)
- 0Использование динамического сбоя памяти программы на C ++
- 1Сомнения и предложения по поводу Юнит
- 1<form> отключил мой код JavaScript
- 0Выбор из таблиц с отношениями многие ко многим
You should verify that the ‘Accessibility’ option is enabled for the UIView object you are swiping from, for example:
Usually this issue is observed when the parent element of the element yo want to record is set to isAccessibilityElement = true
. In general, you have to have the parent element set to false to access the child element.
For example: if you have a UILabel
inside a view, the accessibility should be set to false for the view and set to true for the UILabel
.
In Xcode 9.3, where this is apparently still a problem, what I did was:
- Quit Xcode
- Reset the Simulator’s settings (Hardware -> Erase allcontents and settings)
- Quit the Simulator
- Delete the derived data for the current app
- Restart Xcode
- Try recording again — it worked this time for me.
Я пытаюсь создать UItest в Xcode. Когда я пытаюсь использовать UIview, я получаю
ошибка:
Timestamped Event Matching Error: Failed to find matching element
окно ошибки
Это также происходит, если я пытаюсь нажать UIView.
Ответ 1
Вы должны убедиться, что опция «Доступность» включена для объекта UIView, из которого вы работаете, например:
Ответ 2
Обычно эта проблема наблюдается, когда родительский элемент элемента, который вы хотите записать, имеет значение isAccessibilityElement = true. В общем случае для доступа к дочернему элементу родительский элемент должен иметь значение false. Например: если у вас есть UILabel внутри представления, доступность должна быть установлена в false для представления и установлена в true для UILabel.
Ответ 3
В Xcode 9.3, где это, по-видимому, все еще проблема, я сделал следующее:
- Выйти из Xcode
- Сброс настроек симулятора (Оборудование → Стереть все
содержание и настройки) - Выйти из симулятора
- Удалить производные данные для текущего приложения
- Перезапустите Xcode
- Попробуйте записать снова — на этот раз это сработало для меня.
Ответ 4
Для записи нового теста я пока не думаю, что есть решение. Но, если вы используете расширение для принудительного нажатия с тестом, который уже существует, работает.
Пример использования:
extension XCUIElement {
func forceTapElement() {
if self.hittable {
self.tap()
}
else {
let coordinate: XCUICoordinate = self.coordinateWithNormalizedOffset(CGVectorMake(0.0, 0.0))
coordinate.tap()
}
}
}
func testSomethingWithCells() {
let app = XCUIApplication()
let cells = app.tables.cells
sleep(1)
cells.elementBoundByIndex(0).forceTapElement()
}
Вы можете проверить исходное сообщение здесь:
Xcode UI test — Ошибка тестирования пользовательского интерфейса — Не удалось прокрутить до видимого (с помощью действия AX), если нажать на поле поиска и кнопку «Отменить»
Ответ 5
Я иногда сталкивался с этой проблемой. Удалить каталог приложений из DerivedData, похоже, поможет.
Ответ 6
Решение, которое работало для меня, заключалось в том, чтобы идентифицировать объект по-разному.
В Xcode 8 я смог использовать следующее:
XCUIApplication().tables.cells["Camera Roll"].buttons["Camera Roll"].tap()
С Xcode 9 я получил ошибку, упомянутую в этом вопросе. Закончилось использование следующего, которое сработало (что более похоже на исходный вариант)
XCUIApplication().cells.element(boundBy: 1).tap()