Skip to content

Send media and file#2654

Open
thuyenh1081 wants to merge 16 commits intomainfrom
sendMediaAndFile
Open

Send media and file#2654
thuyenh1081 wants to merge 16 commits intomainfrom
sendMediaAndFile

Conversation

@thuyenh1081
Copy link
Collaborator

@thuyenh1081 thuyenh1081 commented Nov 6, 2025

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

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'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

@thuyenh1081 thuyenh1081 Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text displayed depend on language that you setting for your mobile and for some case that could be displayed like this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Patrol could not force the default langage of the application to English to simplify the test or any similar mechanism?

Copy link
Collaborator Author

@thuyenh1081 thuyenh1081 Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not base on Id, class name, or anything else? it is not idea. How about if it is French, Russian, ....

Copy link
Collaborator Author

@thuyenh1081 thuyenh1081 Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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:

Selector(textContains: 'Cho phép'),
Selector(textContains: 'Toàn bộ ảnh'),
];

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text displayed depend on language that you setting for your mobile and for some case that could be displayed like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 (_) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we have try catch here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (_) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we have try catch here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too big file, how about using smaller one?

Copy link
Collaborator Author

@thuyenh1081 thuyenh1081 Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I have replaced it by a smaller one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I have replaced it by a smaller one

catch (_) {}
}

Future<void> maybeTapFirstV1(PatrolIntegrationTester $, List<Selector> opts) async {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is FirstV1?

}

Future<void> maybeTapFirstV1(PatrolIntegrationTester $, List<Selector> opts) async {
for (final s in opts) { try { await $.native.tap(s); return; } catch (_) {} }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please not write like it

set -e

# --- Config --------------------------------------------------------------
UDID="DDDF0F2B-507B-43EE-AE0B-CABF4ED25D1F"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no hardcode this, how about other people run the tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no text selector

await getMoreMessageIcon().tap();
if($(PermissionTextButton).containing('Next').exists)
{
await $.waitUntilVisible($(PermissionTextButton).containing('Next'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

}

Future<void> confirmServerUrl() async {
await $.waitUntilVisible($('Continue'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants