mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.88k stars 281 forks source link

Expanded swipe to support from: -> to: #2117

Open NorseGaud opened 3 weeks ago

NorseGaud commented 3 weeks ago

Proposed changes

In https://github.com/mobile-dev-inc/maestro/issues/1203, we realized all I needed to do was expand swipe a bit to support swiping on a picker wheel. Here is an example video showing how it works.

https://github.com/user-attachments/assets/3d2a3103-de30-49bd-9f27-39145e1f903d

(we're writing a test suite for https://memlane.app)

This change adds to: for from: definitions, allowing users to be a bit more precise (move a wheel picker by 1) since direction is far too much of a swipe for my needs.

Testing

See video. Can devs recommend where we should add tests for this?

Documentation

https://github.com/mobile-dev-inc/maestro-docs/pull/97

Fishbowler commented 3 weeks ago

Thanks @NorseGaud! This looks really handy! Any chance of some tests for the new capabilities?

You could certainly do an integration test, and perhaps some of the maths is unit testable? I don't know if there's a suitable place for an e2e test (i.e. I don't know if there's a suitable element to swipe on to see an effect to test against). Lemme know if you need a hand!

NorseGaud commented 3 weeks ago

Hey @Fishbowler I found the docs for testing. I spent a few hours trying to get an IntegrationTest, but failed to do so. it seems like override fun swipe(start: Point, end: Point, durationMs: Long) { conflicts with an override I add for from: to:

e: file:///Users/norsegaud/maestro/maestro-test/src/main/kotlin/maestro/test/drivers/FakeDriver.kt:177:5 Conflicting overloads: public open fun swipe(start: Point, end: Point, durationMs: Long): Unit defined in maestro.test.drivers.FakeDriver, public open fun swipe(elementPoint: Point, to: Point, durationMs: Long): Unit defined in maestro.test.drivers.FakeDriver

Can you recommend the approach I can take for this? Also, apologies but my developer wrote all of this new code and I can't afford to have him write tests too. I'm just not good enough at Kotlin to understand how to get this test written :(