superlistapp / super_native_extensions

Native drag & drop, clipboard access and context menu.
MIT License
452 stars 81 forks source link

[super_context_menu] How can I widget test a ContextMenu? #346

Open BuyMyBeard opened 6 months ago

BuyMyBeard commented 6 months ago

I am trying to setup some widget tests that open the context menu to access options. I tried with tester.longPress and dragGestures, and also tried pumping multiple delays.

I also attempted looking up how the gesture detector works for the ContextMenuWidget works, but didn't find an answer.

Basically long press and drag gestures don't open the context menu. Any pointers?

knopp commented 6 months ago

What target operating system is your test running on? The gesture is only handled on Android or Web.

BuyMyBeard commented 6 months ago

For mobile

knopp commented 6 months ago

It should be possible to widget test context menu, but only when target platform is android. On iOS the gesture is driven by the operating system through platform channel. Alternatively the widget could always fallback to Flutter codepath when widget tester is detected.

BuyMyBeard commented 6 months ago

I've tried declaring debugDefaultTargetPlatformOverride = TargetPlatform.android; at the start of my widget test, but the context menu isn't rendering at all. The target platform during my widget test is Windows, since I'm running the test on my windows machine, but it doesn't seem like something I can change manually