Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add Maestro session helpers

Neeraj Guptadbc1171b49a7
diff --git a/mobile/apps/photos/lib/ui/home/home_bottom_nav_bar.dart b/mobile/apps/photos/lib/ui/home/home_bottom_nav_bar.dart
index c74f8c6c6c..69e4c6e52f 100644
--- a/mobile/apps/photos/lib/ui/home/home_bottom_nav_bar.dart
+++ b/mobile/apps/photos/lib/ui/home/home_bottom_nav_bar.dart
@@ -156,21 +156,25 @@ class _HomeNavBar extends StatelessWidget {
static const _tabs = [
_HomeNavTab(
semanticLabel: 'Home',
+ semanticIdentifier: 'ente.photos.tab.home',
outlineAsset: 'assets/icons/nav_bar/home_outline.svg',
filledAsset: 'assets/icons/nav_bar/home_filled.svg',
),
_HomeNavTab(
semanticLabel: 'Albums',
+ semanticIdentifier: 'ente.photos.tab.albums',
outlineAsset: 'assets/icons/nav_bar/albums_outline.svg',
filledAsset: 'assets/icons/nav_bar/albums_filled.svg',
),
_HomeNavTab(
semanticLabel: 'Feed',
+ semanticIdentifier: 'ente.photos.tab.feed',
outlineAsset: 'assets/icons/nav_bar/feed_outline.svg',
filledAsset: 'assets/icons/nav_bar/feed_filled.svg',
),
_HomeNavTab(
semanticLabel: 'Search',
+ semanticIdentifier: 'ente.photos.tab.search',
outlineAsset: 'assets/icons/nav_bar/search_outline.svg',
filledAsset: 'assets/icons/nav_bar/search_filled.svg',
),
@@ -212,6 +216,7 @@ class _HomeNavBar extends StatelessWidget {
),
text: '',
semanticLabel: _tabs[index].semanticLabel,
+ semanticIdentifier: _tabs[index].semanticIdentifier,
leading: SizedBox.square(
dimension: IconSizes.small,
child: _HomeNavIcon(
@@ -252,11 +257,13 @@ class _HomeNavIcon extends StatelessWidget {
class _HomeNavTab {
const _HomeNavTab({
required this.semanticLabel,
+ required this.semanticIdentifier,
required this.outlineAsset,
required this.filledAsset,
});
final String semanticLabel;
+ final String semanticIdentifier;
final String outlineAsset;
final String filledAsset;
}
diff --git a/mobile/apps/photos/lib/ui/tabs/nav_bar.dart b/mobile/apps/photos/lib/ui/tabs/nav_bar.dart
index 84784f59bb..cebbe05635 100644
--- a/mobile/apps/photos/lib/ui/tabs/nav_bar.dart
+++ b/mobile/apps/photos/lib/ui/tabs/nav_bar.dart
@@ -120,6 +120,7 @@ class _GNavState extends State<GNav> {
backgroundColor: t.backgroundColor ?? widget.tabBackgroundColor,
duration: widget.duration ?? const Duration(milliseconds: 500),
semanticLabel: t.semanticLabel,
+ semanticIdentifier: t.semanticIdentifier,
onPressed: () {
widget.onTabChange!(widget.tabs!.indexOf(t));
},
@@ -158,6 +159,7 @@ class GButton extends StatefulWidget {
final Border? activeBorder;
final List<BoxShadow>? shadow;
final String? semanticLabel;
+ final String? semanticIdentifier;
const GButton({
super.key,
@@ -187,6 +189,7 @@ class GButton extends StatefulWidget {
this.activeBorder,
this.shadow,
this.semanticLabel,
+ this.semanticIdentifier,
});
@override
@@ -198,6 +201,7 @@ class _GButtonState extends State<GButton> {
Widget build(BuildContext context) {
return Semantics(
label: widget.semanticLabel ?? widget.text,
+ identifier: widget.semanticIdentifier,
child: Button(
borderRadius: widget.borderRadius,
border: widget.border,
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
index cc20206cd0..5a5efade11 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
@@ -139,6 +139,9 @@ class Gallery extends StatefulWidget {
class GalleryState extends State<Gallery> {
static const int kInitialLoadLimit = 100;
+ static final RegExp _automationIdentifierUnsafeChars = RegExp(
+ r'[^A-Za-z0-9_.-]',
+ );
late final Debouncer _debouncer;
late final Debouncer _priorityDebouncer;
double? groupHeaderExtent;
@@ -166,10 +169,14 @@ class GalleryState extends State<Gallery> {
final _swipeActiveNotifier = ValueNotifier<bool>(false);
InheritedSearchFilterData? _inheritedSearchFilterData;
InheritedGalleryBoundaries? _boundariesProvider;
+ late String _automationScrollIdentifier;
@override
void initState() {
super.initState();
+ _automationScrollIdentifier = _buildAutomationScrollIdentifier(
+ widget.tagPrefix,
+ );
// end the tag with x to avoid `.` in the end if logger name
_logTag =
"Gallery_${widget.tagPrefix}${kDebugMode ? "_" + widget.albumName! : ""}_x";
@@ -339,6 +346,11 @@ class GalleryState extends State<Gallery> {
@override
void didUpdateWidget(covariant Gallery oldWidget) {
super.didUpdateWidget(oldWidget);
+ if (oldWidget.tagPrefix != widget.tagPrefix) {
+ _automationScrollIdentifier = _buildAutomationScrollIdentifier(
+ widget.tagPrefix,
+ );
+ }
if (oldWidget.groupType != widget.groupType) {
_setGroupType();
if (mounted) {
@@ -621,6 +633,14 @@ class GalleryState extends State<Gallery> {
? const NeverScrollableScrollPhysics()
: const ExponentialBouncingScrollPhysics();
+ static String _buildAutomationScrollIdentifier(String tagPrefix) {
+ final safeTagPrefix = tagPrefix.replaceAll(
+ _automationIdentifierUnsafeChars,
+ '_',
+ );
+ return "ente.photos.gallery.$safeTagPrefix.scroll";
+ }
+
@override
Widget build(BuildContext context) {
_logger.info("Building Gallery ${widget.tagPrefix}");
@@ -811,29 +831,33 @@ class GalleryState extends State<Gallery> {
ValueListenableBuilder<bool>(
valueListenable: _swipeActiveNotifier,
builder: (context, isSwipeActive, child) {
- return CustomScrollView(
- physics: widget.disableScroll || isSwipeActive
- ? const NeverScrollableScrollPhysics()
- : const ExponentialBouncingScrollPhysics(),
- controller: _scrollController,
- slivers: [
- if (widget.appBar != null)
- widget.appBar!.buildSliver(context),
- SliverToBoxAdapter(
- child: SizeChangedLayoutNotifier(
- child: SizedBox(
- key: _headerKey,
- child:
- widget.header ??
- const SizedBox.shrink(),
+ return Semantics(
+ identifier: _automationScrollIdentifier,
+ container: true,
+ child: CustomScrollView(
+ physics: widget.disableScroll || isSwipeActive
+ ? const NeverScrollableScrollPhysics()
+ : const ExponentialBouncingScrollPhysics(),
+ controller: _scrollController,
+ slivers: [
+ if (widget.appBar != null)
+ widget.appBar!.buildSliver(context),
+ SliverToBoxAdapter(
+ child: SizeChangedLayoutNotifier(
+ child: SizedBox(
+ key: _headerKey,
+ child:
+ widget.header ??
+ const SizedBox.shrink(),
+ ),
),
),
- ),
- SectionedListSliver(
- sectionLayouts: groups.groupLayouts,
- ),
- SliverToBoxAdapter(child: widget.footer),
- ],
+ SectionedListSliver(
+ sectionLayouts: groups.groupLayouts,
+ ),
+ SliverToBoxAdapter(child: widget.footer),
+ ],
+ ),
);
},
),