From 12386177707b2145ccac113aa807f62ac2871b85 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Thu, 23 Apr 2026 16:40:30 -0700 Subject: [PATCH 01/13] chore(demo): add AutomationIds for Appium E2E tests --- examples/demo/.env.example | 3 +++ .../demo/Controls/MultiPairDialogHelper.cs | 15 ++++++----- .../Controls/Sections/AliasesSection.xaml | 5 ++-- .../Controls/Sections/AliasesSection.xaml.cs | 17 +++++++----- .../demo/Controls/Sections/AppSection.xaml | 8 +++--- .../demo/Controls/Sections/EmailsSection.xaml | 5 ++-- .../Controls/Sections/EmailsSection.xaml.cs | 2 ++ .../demo/Controls/Sections/InAppSection.xaml | 5 ++-- .../Sections/LiveActivitiesSection.xaml | 5 ++-- .../Controls/Sections/LocationSection.xaml | 11 ++++++-- .../Controls/Sections/LocationSection.xaml.cs | 12 +++++++++ .../Controls/Sections/OutcomesSection.xaml | 3 ++- .../Controls/Sections/OutcomesSection.xaml.cs | 23 +++++++++++++--- .../demo/Controls/Sections/PushSection.xaml | 7 ++--- .../Controls/Sections/SendIamSection.xaml | 11 ++++---- .../Controls/Sections/SendIamSection.xaml.cs | 24 +++++++---------- .../Controls/Sections/SendPushSection.xaml | 11 ++++---- .../demo/Controls/Sections/SmsSection.xaml | 5 ++-- .../demo/Controls/Sections/SmsSection.xaml.cs | 2 ++ .../demo/Controls/Sections/TagsSection.xaml | 7 ++--- .../Controls/Sections/TagsSection.xaml.cs | 14 ++++++++-- .../Controls/Sections/TrackEventSection.xaml | 5 ++-- .../Sections/TrackEventSection.xaml.cs | 6 ++--- .../Controls/Sections/TriggersSection.xaml | 9 ++++--- .../Controls/Sections/TriggersSection.xaml.cs | 14 ++++++++-- .../demo/Controls/Sections/UserSection.xaml | 10 +++---- examples/demo/Controls/TooltipDialogHelper.cs | 10 +++++-- examples/demo/MauiProgram.cs | 13 +++++++--- examples/demo/Pages/MainPage.xaml | 2 +- examples/demo/Pages/MainPage.xaml.cs | 14 +++++++--- examples/demo/Services/PreferencesService.cs | 9 ------- examples/demo/ViewModels/AppViewModel.cs | 26 ++++++++++++++----- 32 files changed, 204 insertions(+), 109 deletions(-) diff --git a/examples/demo/.env.example b/examples/demo/.env.example index 674a938f..b0c98cee 100644 --- a/examples/demo/.env.example +++ b/examples/demo/.env.example @@ -1 +1,4 @@ +# Default App ID (used when ONESIGNAL_APP_ID is empty or missing): 77e32082-ea27-42e3-a898-c72e141824ef +ONESIGNAL_APP_ID=your-onesignal-app-id ONESIGNAL_API_KEY=your_rest_api_key +E2E_MODE=false diff --git a/examples/demo/Controls/MultiPairDialogHelper.cs b/examples/demo/Controls/MultiPairDialogHelper.cs index 2c77804a..01469b52 100644 --- a/examples/demo/Controls/MultiPairDialogHelper.cs +++ b/examples/demo/Controls/MultiPairDialogHelper.cs @@ -32,12 +32,12 @@ void AddRow() var keyEntry = new Entry { Placeholder = keyPlaceholder, - AutomationId = $"multi_pair_key_{rows.Count}", + AutomationId = $"multipair_key_{rows.Count}", }; var valueEntry = new Entry { Placeholder = valuePlaceholder, - AutomationId = $"multi_pair_value_{rows.Count}", + AutomationId = $"multipair_value_{rows.Count}", }; var capturedRow = (keyEntry, valueEntry); rows.Add(capturedRow); @@ -93,10 +93,11 @@ void AddRow() TextColor = Color.FromArgb("#E54B4D"), HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 8), + AutomationId = "multipair_add_row_button", }; - var cancelButton = DialogInputHelper.ActionButton("Cancel", "multi_pair_cancel_button"); - var addAllButton = DialogInputHelper.ActionButton("Add All", "multi_pair_add_all_button"); + var cancelButton = DialogInputHelper.ActionButton("Cancel", "multipair_cancel_button"); + var addAllButton = DialogInputHelper.ActionButton("Add All", "multipair_confirm_button"); addRowButton.Clicked += (s, e) => AddRow(); cancelButton.Clicked += async (s, e) => await parentPage.ClosePopupAsync(); @@ -160,7 +161,7 @@ IEnumerable keys { var cb = new CheckBox { Color = Color.FromArgb("#E54B4D") }; checkboxes.Add((cb, key)); - var row = new HorizontalStackLayout { Spacing = 8 }; + var row = new HorizontalStackLayout { Spacing = 8, AutomationId = $"remove_checkbox_{key}" }; row.Children.Add(cb); row.Children.Add( new Label @@ -173,10 +174,10 @@ IEnumerable keys itemsLayout.Children.Add(row); } - var cancelButton = DialogInputHelper.ActionButton("Cancel", "multi_select_cancel_button"); + var cancelButton = DialogInputHelper.ActionButton("Cancel", "multiselect_cancel_button"); var removeButton = DialogInputHelper.ActionButtonDisabled( "Remove (0)", - "multi_select_remove_button" + "multiselect_confirm_button" ); void UpdateButton() diff --git a/examples/demo/Controls/Sections/AliasesSection.xaml b/examples/demo/Controls/Sections/AliasesSection.xaml index 89c9d5bb..c3bc9386 100644 --- a/examples/demo/Controls/Sections/AliasesSection.xaml +++ b/examples/demo/Controls/Sections/AliasesSection.xaml @@ -5,7 +5,7 @@ xmlns:mi="http://www.aathifmahir.com/dotnet/2022/maui/icons" x:Class="OneSignalDemo.Controls.Sections.AliasesSection" > - + @@ -31,7 +32,7 @@ Text="No aliases added" Style="{StaticResource EmptyStateStyle}" Padding="16" - AutomationId="aliases_empty_label" + AutomationId="aliases_empty" /> diff --git a/examples/demo/Controls/Sections/AliasesSection.xaml.cs b/examples/demo/Controls/Sections/AliasesSection.xaml.cs index 177135ce..813f9569 100644 --- a/examples/demo/Controls/Sections/AliasesSection.xaml.cs +++ b/examples/demo/Controls/Sections/AliasesSection.xaml.cs @@ -1,6 +1,4 @@ using System.Collections.Specialized; -using CommunityToolkit.Maui.Alerts; -using CommunityToolkit.Maui.Core; using OneSignalDemo.Controls; using OneSignalDemo.ViewModels; @@ -55,13 +53,21 @@ private void RebuildList() first = false; var row = new VerticalStackLayout { Padding = new Thickness(12, 4), Spacing = 2 }; - row.Children.Add(new Label { Text = alias.Key, FontSize = 14 }); + row.Children.Add( + new Label + { + Text = alias.Key, + FontSize = 14, + AutomationId = $"aliases_pair_key_{alias.Key}", + } + ); row.Children.Add( new Label { Text = alias.Value, FontSize = 12, TextColor = Color.FromArgb("#757575"), + AutomationId = $"aliases_pair_value_{alias.Key}", } ); @@ -89,7 +95,8 @@ private async void OnAddClicked(object? sender, EventArgs e) Placeholder = "ID", AutomationId = "alias_id_input", }, - "Add" + "Add", + "alias_confirm_button" ); if ( @@ -102,7 +109,6 @@ private async void OnAddClicked(object? sender, EventArgs e) return; _viewModel.AddAlias(new KeyValuePair(label, id)); - await Toast.Make($"Alias added: {label}", ToastDuration.Short).Show(); } private async void OnAddMultipleClicked(object? sender, EventArgs e) @@ -114,7 +120,6 @@ private async void OnAddMultipleClicked(object? sender, EventArgs e) return; _viewModel.AddAliases(pairs); - await Toast.Make($"{pairs.Count} alias(es) added", ToastDuration.Short).Show(); } private async Task?> ShowMultiPairDialog( diff --git a/examples/demo/Controls/Sections/AppSection.xaml b/examples/demo/Controls/Sections/AppSection.xaml index d3b9326e..84bb839e 100644 --- a/examples/demo/Controls/Sections/AppSection.xaml +++ b/examples/demo/Controls/Sections/AppSection.xaml @@ -5,7 +5,7 @@ x:Class="OneSignalDemo.Controls.Sections.AppSection" x:Name="root" > - + diff --git a/examples/demo/Controls/Sections/EmailsSection.xaml b/examples/demo/Controls/Sections/EmailsSection.xaml index 23b468cb..c12c591b 100644 --- a/examples/demo/Controls/Sections/EmailsSection.xaml +++ b/examples/demo/Controls/Sections/EmailsSection.xaml @@ -5,7 +5,7 @@ xmlns:mi="http://www.aathifmahir.com/dotnet/2022/maui/icons" x:Class="OneSignalDemo.Controls.Sections.EmailsSection" > - + @@ -31,7 +32,7 @@ Text="No emails added" Style="{StaticResource EmptyStateStyle}" Padding="16" - AutomationId="emails_empty_label" + AutomationId="emails_empty" /> diff --git a/examples/demo/Controls/Sections/EmailsSection.xaml.cs b/examples/demo/Controls/Sections/EmailsSection.xaml.cs index dc867d7b..ddca77e0 100644 --- a/examples/demo/Controls/Sections/EmailsSection.xaml.cs +++ b/examples/demo/Controls/Sections/EmailsSection.xaml.cs @@ -72,6 +72,7 @@ private void RebuildList() Text = email, FontSize = 14, VerticalOptions = LayoutOptions.Center, + AutomationId = $"emails_value_{email}", } ); @@ -83,6 +84,7 @@ private void RebuildList() Padding = new Thickness(8, 0), FontSize = 18, HeightRequest = 40, + AutomationId = $"emails_remove_{email}", }; deleteBtn.Clicked += (s, e) => _viewModel?.RemoveEmail(captured); Grid.SetColumn(deleteBtn, 1); diff --git a/examples/demo/Controls/Sections/InAppSection.xaml b/examples/demo/Controls/Sections/InAppSection.xaml index 455267a8..385536a8 100644 --- a/examples/demo/Controls/Sections/InAppSection.xaml +++ b/examples/demo/Controls/Sections/InAppSection.xaml @@ -5,7 +5,7 @@ xmlns:mi="http://www.aathifmahir.com/dotnet/2022/maui/icons" x:Class="OneSignalDemo.Controls.Sections.InAppSection" > - + @@ -35,7 +36,7 @@ x:Name="IamPausedSwitch" IsToggled="False" Toggled="OnIamPausedToggled" - AutomationId="iam_paused_switch" + AutomationId="pause_iam_toggle" /> diff --git a/examples/demo/Controls/Sections/LiveActivitiesSection.xaml b/examples/demo/Controls/Sections/LiveActivitiesSection.xaml index b08979a8..b730be25 100644 --- a/examples/demo/Controls/Sections/LiveActivitiesSection.xaml +++ b/examples/demo/Controls/Sections/LiveActivitiesSection.xaml @@ -5,7 +5,7 @@ xmlns:mi="http://www.aathifmahir.com/dotnet/2022/maui/icons" x:Class="OneSignalDemo.Controls.Sections.LiveActivitiesSection" > - + @@ -63,7 +64,7 @@ BackgroundColor="Transparent" TextColor="#212121" FontSize="14" - AutomationId="live_activity_order_input" + AutomationId="live_activity_order_number_input" TextChanged="OnOrderNumberChanged" /> diff --git a/examples/demo/Controls/Sections/LocationSection.xaml b/examples/demo/Controls/Sections/LocationSection.xaml index 0a7618cb..d29f46a0 100644 --- a/examples/demo/Controls/Sections/LocationSection.xaml +++ b/examples/demo/Controls/Sections/LocationSection.xaml @@ -5,7 +5,7 @@ xmlns:mi="http://www.aathifmahir.com/dotnet/2022/maui/icons" x:Class="OneSignalDemo.Controls.Sections.LocationSection" > - + @@ -38,7 +39,7 @@ x:Name="LocationSharedSwitch" IsToggled="False" Toggled="OnLocationSharedToggled" - AutomationId="location_shared_switch" + AutomationId="location_shared_toggle" /> @@ -49,5 +50,11 @@ Clicked="OnPromptLocationClicked" AutomationId="prompt_location_button" /> +