Conversation
| final titles = <Selector>[ | ||
| Selector(textContains: 'Would Like to Access Your Photo Library'), | ||
| Selector(textContains: 'muốn truy cập Ảnh'), | ||
| Selector(textContains: 'Thư viện ảnh'), |
There was a problem hiding this comment.
Why there is a mix of English and Vietnamese text here
It seems that we could we retrieve the label text directly from the code in other existing tests.
There was a problem hiding this comment.
The text displayed depend on language that you setting for your mobile and for some case that could be displayed like this
There was a problem hiding this comment.
So Patrol could not force the default langage of the application to English to simplify the test or any similar mechanism?
There was a problem hiding this comment.
This popup is not control by Tchat app. It is belogn navive device, I means mobile devices.
I think Patrol is a framework provides us library that helping interact with elements on mobile. If you want to control Patrol do it, you must do some action like, to go setting, choose language for the mobile device. it will take time more the way you list the text that can be displayed on some language. It will be easier and faster way
There was a problem hiding this comment.
why not base on Id, class name, or anything else? it is not idea. How about if it is French, Russian, ....
There was a problem hiding this comment.
@Insalien @hoangdat
I have updated the way to click on the Popup in the last commit. It will not depends on language
In this way:
- I use index to click on button "Allow Photo" button. PHPhotoLibrary is a system popup and we cannot use flutter inspector in inspect element on it. So, it is difficult to know what is id or class of Allow Button. Patrol document https://patrol.leancode.co/feature-guide/pick-images-from-gallery guide using await $.native2.grantPermissionWhenInUse(); to click on Allow button but this method actually base on language in English. https://github.com/leancodepl/patrol/discussions/563?utm_source=chatgpt.com That is why I choose index. Each approach has its own risks, but I think using the index is acceptable in this case because the UI of this type of popup is rarely changed.
| Selector(textContains: 'Cho phép'), | ||
| Selector(textContains: 'Toàn bộ ảnh'), | ||
| ]; | ||
|
|
There was a problem hiding this comment.
The text displayed depend on language that you setting for your mobile and for some case that could be displayed like this.
There was a problem hiding this comment.
@Insalien , I have updated with the way not depend on language, thanks!
| await $.native.waitUntilVisible(t, appId: _sb, timeout: const Duration(milliseconds: 300)); | ||
| stillVisible = true; | ||
| break; | ||
| } catch (_) { |
There was a problem hiding this comment.
why we have try catch here
There was a problem hiding this comment.
this snipe code belongs allowPhotosIfNeeded(). This method is used to click on the Photo access popup but the popup just display 1 time in the running. It means in other uploading steps in the scrips, the popup will not be shown. The spring board of popup will not shown also. So, I make try cache to ignore this case
| await $.native.waitUntilVisible(t, appId: _sb, timeout: const Duration(seconds: 6)); | ||
| visible = true; | ||
| break; | ||
| } catch (_) {} |
There was a problem hiding this comment.
why we have try catch here
There was a problem hiding this comment.
this snipe code belongs allowPhotosIfNeeded(). This method is used to click on the Photo access popup but the popup just display 1 time in the running. It means in other uploading steps in the scrips, the popup will not be shown. The title of popup will not shown also. So, I make try cache to ignore this case
There was a problem hiding this comment.
too big file, how about using smaller one?
There was a problem hiding this comment.
yes, I have replaced it by a smaller one
There was a problem hiding this comment.
yes, I have replaced it by a smaller one
| catch (_) {} | ||
| } | ||
|
|
||
| Future<void> maybeTapFirstV1(PatrolIntegrationTester $, List<Selector> opts) async { |
| } | ||
|
|
||
| Future<void> maybeTapFirstV1(PatrolIntegrationTester $, List<Selector> opts) async { | ||
| for (final s in opts) { try { await $.native.tap(s); return; } catch (_) {} } |
| set -e | ||
|
|
||
| # --- Config -------------------------------------------------------------- | ||
| UDID="DDDF0F2B-507B-43EE-AE0B-CABF4ED25D1F" |
There was a problem hiding this comment.
no hardcode this, how about other people run the tests
There was a problem hiding this comment.
if you change the file like this, this will break test for Android.
Please separate script for iOS and Android or find other way to support all platform.
| } | ||
|
|
||
| PatrolFinder getMoreMessageIcon() { | ||
| return $(ChatInputRow).$(TwakeIconButton).containing(find.byTooltip('More')); |
| await getMoreMessageIcon().tap(); | ||
| if($(PermissionTextButton).containing('Next').exists) | ||
| { | ||
| await $.waitUntilVisible($(PermissionTextButton).containing('Next')); |
| } | ||
|
|
||
| Future<void> confirmServerUrl() async { | ||
| await $.waitUntilVisible($('Continue')); |
Ticket
This ticket include code for sending a file, image, video in a chat
Resolved
Screen.Recording.2025-11-06.at.14.06.34.mov