Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue36749.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public Issue36749()
Text = "Test Button",
AutomationId = "Issue36749Button"
};
_button.Loaded += OnButtonLoaded;

Content = new VerticalStackLayout
{
Expand All @@ -47,10 +48,8 @@ public Issue36749()
};
}

protected override void OnAppearing()
void OnButtonLoaded(object sender, EventArgs e)
{
base.OnAppearing();

#if IOS || MACCATALYST
if (_hasRunVerification)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ public Issue35826(TestDevice device) : base(device) { }
const string PhotoPickerAvailabilityLabel = "PhotoPickerAvailabilityLabel";
const string StatusLabel = "StatusLabel";

// This test requires API 36+ because the issue reproduces only when Android strictly enforces ActivityResultLauncher ownership.
// This test belongs to the Essentials category.
// Use the SafeAreaEdges category because its device-farm lane runs on API 36+ devices.
[Test]
[Category(UITestCategories.Essentials)]
[Category(UITestCategories.SafeAreaEdges)]
public void PickPhotosAsyncShouldReturnFromChildActivity()
{
OpenChildActivityAndRequirePhotoPicker();
Expand All @@ -30,10 +33,6 @@ public void PickPhotosAsyncShouldReturnFromChildActivity()
// (the guard in ActivityForResultRequest.Register() blocked it), so the task hung
// indefinitely and the result label stayed on "Picking...".
App.Tap(ChildActivityPickButton);

// Cancel the system photo picker by pressing Back.
// After the fix each activity has its own launcher entry so the result is delivered.
WaitForPhotoPicker();
App.Back();

// If the bug is present WaitForTextToBePresentInElement times out because the
Expand All @@ -60,15 +59,17 @@ public void PickPhotosAsyncShouldReturnFromChildActivity()
App.Back();
App.WaitForElement(OpenChildActivityButton);
}


// This test requires API 36+ because the issue reproduces only when Android strictly enforces ActivityResultLauncher ownership.
// This test belongs to the Essentials category.
// Use the SafeAreaEdges category because its device-farm lane runs on API 36+ devices.
[Test]
[Category(UITestCategories.Essentials)]
[Category(UITestCategories.SafeAreaEdges)]
public void OverlappingPhotoPickerRequestsAreRejected()
{
OpenChildActivityAndRequirePhotoPicker();

App.Tap(ChildActivityOverlapButton);
WaitForPhotoPicker();
App.Back();

var rejected = App.WaitForTextToBePresentInElement(
Expand All @@ -83,15 +84,17 @@ public void OverlappingPhotoPickerRequestsAreRejected()
App.Back();
App.WaitForElement(OpenChildActivityButton);
}


// This test requires API 36+ because the issue reproduces only when Android strictly enforces ActivityResultLauncher ownership.
// This test belongs to the Essentials category.
// Use the SafeAreaEdges category because its device-farm lane runs on API 36+ devices.
[Test]
[Category(UITestCategories.Essentials)]
[Category(UITestCategories.SafeAreaEdges)]
public void FinishingLaunchingActivityCancelsPendingPhotoPicker()
{
OpenChildActivityAndRequirePhotoPicker();

App.Tap(ChildActivityFinishWhilePickingButton);
WaitForPhotoPicker();
App.Back();

App.WaitForElement(StatusLabel);
Expand Down Expand Up @@ -122,8 +125,5 @@ void OpenChildActivityAndRequirePhotoPicker()
Assert.That(availability, Is.EqualTo("Photo Picker: Available"),
"The regression test must exercise the AndroidX Photo Picker launcher path changed by this PR.");
}

void WaitForPhotoPicker() =>
App.WaitForElement(AppiumQuery.ByXPath("//android.widget.ImageButton[@content-desc='Cancel']"));
}
#endif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading