From 5793305fa33850eaa54e46ffde179ccd0129b822 Mon Sep 17 00:00:00 2001 From: troZee <12766071+troZee@users.noreply.github.com> Date: Fri, 14 Aug 2026 20:13:40 +0200 Subject: [PATCH 1/8] improve tests --- .maestro/README.md | 12 +- .maestro/flows/basic-pager/ensure-ltr.yaml | 22 ++++ .maestro/flows/basic-pager/ensure-rtl.yaml | 22 ++++ .maestro/flows/basic-pager/open.yaml | 12 ++ .../flows/basic-pager/verify-controls.yaml | 52 ++++++++ .../verify-horizontal-ltr-swipe.yaml | 29 +++++ .../verify-horizontal-rtl-swipe.yaml | 29 +++++ .../basic-pager/verify-vertical-swipe.yaml | 27 ++++ .maestro/setup/pager_basic_example_setup.yaml | 7 -- .../pager_vertical_basic_example_setup.yaml | 7 -- .maestro/smoke-test.yaml | 6 +- .maestro/tests/pager_basic_example.yaml | 55 ++------- .maestro/tests/pager_rtl_example.yaml | 12 ++ .../tests/pager_vertical_basic_example.yaml | 53 ++------ .../tests/rtl/pager_basic_example_rtl.yaml | 115 ------------------ .../rtl/pager_vertical_basic_example_rtl.yaml | 113 ----------------- example/src/App.tsx | 19 ++- example/src/BasicPagerViewExample.tsx | 5 +- scripts/run-maestro-tests.sh | 1 - 19 files changed, 255 insertions(+), 343 deletions(-) create mode 100644 .maestro/flows/basic-pager/ensure-ltr.yaml create mode 100644 .maestro/flows/basic-pager/ensure-rtl.yaml create mode 100644 .maestro/flows/basic-pager/open.yaml create mode 100644 .maestro/flows/basic-pager/verify-controls.yaml create mode 100644 .maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml create mode 100644 .maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml create mode 100644 .maestro/flows/basic-pager/verify-vertical-swipe.yaml delete mode 100644 .maestro/setup/pager_basic_example_setup.yaml delete mode 100644 .maestro/setup/pager_vertical_basic_example_setup.yaml create mode 100644 .maestro/tests/pager_rtl_example.yaml delete mode 100644 .maestro/tests/rtl/pager_basic_example_rtl.yaml delete mode 100644 .maestro/tests/rtl/pager_vertical_basic_example_rtl.yaml diff --git a/.maestro/README.md b/.maestro/README.md index 33abb1e4..8660c71d 100644 --- a/.maestro/README.md +++ b/.maestro/README.md @@ -19,6 +19,12 @@ bun run maestro:test:android Use `bun run maestro:smoke` to run only the smoke flow. `maestro:debug` writes failure artifacts to `.maestro/debug-output`. -The smoke flow targets the example app ID `com.pagerviewexample` and verifies the Basic Example pager using stable `testID` selectors. -Additional Basic Example regression flows live in `.maestro/basic_example`. -Nested PagerView regression flows live in `.maestro/nested_pager_view_example`. +The smoke flow targets the example app ID `com.pagerviewexample` and verifies the horizontal pager using stable `testID` selectors. + +Basic PagerView regression coverage is split into three deterministic flows: + +- `tests/pager_basic_example.yaml` verifies horizontal paging in LTR. +- `tests/pager_vertical_basic_example.yaml` verifies vertical paging in LTR. +- `tests/pager_rtl_example.yaml` switches to RTL before verifying the reversed horizontal gesture. + +Shared setup and assertions live in `flows/basic-pager`. Each flow resets the app to the required layout direction, so a failed RTL run cannot affect the next test. diff --git a/.maestro/flows/basic-pager/ensure-ltr.yaml b/.maestro/flows/basic-pager/ensure-ltr.yaml new file mode 100644 index 00000000..a60a4670 --- /dev/null +++ b/.maestro/flows/basic-pager/ensure-ltr.yaml @@ -0,0 +1,22 @@ +appId: com.pagerviewexample +--- +- launchApp: + stopApp: true + +- extendedWaitUntil: + visible: + text: 'PagerView Example' + timeout: 15000 + +- runFlow: + when: + visible: + id: 'layout-direction-rtl' + commands: + - tapOn: + id: 'layout-direction-rtl' + +- extendedWaitUntil: + visible: + id: 'layout-direction-ltr' + timeout: 15000 diff --git a/.maestro/flows/basic-pager/ensure-rtl.yaml b/.maestro/flows/basic-pager/ensure-rtl.yaml new file mode 100644 index 00000000..7b02ea68 --- /dev/null +++ b/.maestro/flows/basic-pager/ensure-rtl.yaml @@ -0,0 +1,22 @@ +appId: com.pagerviewexample +--- +- launchApp: + stopApp: true + +- extendedWaitUntil: + visible: + text: 'PagerView Example' + timeout: 15000 + +- runFlow: + when: + visible: + id: 'layout-direction-ltr' + commands: + - tapOn: + id: 'layout-direction-ltr' + +- extendedWaitUntil: + visible: + id: 'layout-direction-rtl' + timeout: 15000 diff --git a/.maestro/flows/basic-pager/open.yaml b/.maestro/flows/basic-pager/open.yaml new file mode 100644 index 00000000..da9d4350 --- /dev/null +++ b/.maestro/flows/basic-pager/open.yaml @@ -0,0 +1,12 @@ +appId: com.pagerviewexample +--- +- tapOn: + id: ${EXAMPLE_ID} + +- extendedWaitUntil: + visible: + id: ${PAGER_ID} + timeout: 10000 + +- assertVisible: + id: 'pageNumber0' diff --git a/.maestro/flows/basic-pager/verify-controls.yaml b/.maestro/flows/basic-pager/verify-controls.yaml new file mode 100644 index 00000000..1fcad56e --- /dev/null +++ b/.maestro/flows/basic-pager/verify-controls.yaml @@ -0,0 +1,52 @@ +appId: com.pagerviewexample +--- +- tapOn: + id: 'next-page-button' + +- extendedWaitUntil: + visible: + id: 'pageNumber2' + timeout: 5000 + +- tapOn: + id: 'prev-page-button' + +- extendedWaitUntil: + visible: + id: 'pageNumber1' + timeout: 5000 + +- tapOn: + id: 'start-page-button' + +- extendedWaitUntil: + visible: + id: 'pageNumber0' + timeout: 5000 + +- tapOn: + id: 'last-page-button' + +- extendedWaitUntil: + visible: + id: 'pageNumber9' + timeout: 5000 + +- tapOn: + id: 'remove-page-button' + +- extendedWaitUntil: + visible: + id: 'pageNumber8' + timeout: 5000 + +- tapOn: + id: 'add-page-button' + +- tapOn: + id: 'next-page-button' + +- extendedWaitUntil: + visible: + id: 'pageNumber9' + timeout: 5000 diff --git a/.maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml b/.maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml new file mode 100644 index 00000000..22fc19da --- /dev/null +++ b/.maestro/flows/basic-pager/verify-horizontal-ltr-swipe.yaml @@ -0,0 +1,29 @@ +appId: com.pagerviewexample +--- +- tapOn: + id: 'scroll-enabled-button' + +- swipe: + from: + id: 'pager-view-horizontal' + start: 90%, 50% + end: 10%, 50% + duration: 100 + +- assertVisible: + id: 'pageNumber0' + +- tapOn: + id: 'scroll-enabled-button' + +- swipe: + from: + id: 'pager-view-horizontal' + start: 90%, 50% + end: 10%, 50% + duration: 100 + +- extendedWaitUntil: + visible: + id: 'pageNumber1' + timeout: 5000 diff --git a/.maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml b/.maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml new file mode 100644 index 00000000..fd8aa15d --- /dev/null +++ b/.maestro/flows/basic-pager/verify-horizontal-rtl-swipe.yaml @@ -0,0 +1,29 @@ +appId: com.pagerviewexample +--- +- tapOn: + id: 'scroll-enabled-button' + +- swipe: + from: + id: 'pager-view-horizontal' + start: 10%, 50% + end: 90%, 50% + duration: 100 + +- assertVisible: + id: 'pageNumber0' + +- tapOn: + id: 'scroll-enabled-button' + +- swipe: + from: + id: 'pager-view-horizontal' + start: 10%, 50% + end: 90%, 50% + duration: 100 + +- extendedWaitUntil: + visible: + id: 'pageNumber1' + timeout: 5000 diff --git a/.maestro/flows/basic-pager/verify-vertical-swipe.yaml b/.maestro/flows/basic-pager/verify-vertical-swipe.yaml new file mode 100644 index 00000000..a160d576 --- /dev/null +++ b/.maestro/flows/basic-pager/verify-vertical-swipe.yaml @@ -0,0 +1,27 @@ +appId: com.pagerviewexample +--- +- tapOn: + id: 'scroll-enabled-button' + +- swipe: + from: + id: 'pager-view-vertical' + direction: UP + duration: 100 + +- assertVisible: + id: 'pageNumber0' + +- tapOn: + id: 'scroll-enabled-button' + +- swipe: + from: + id: 'pager-view-vertical' + direction: UP + duration: 100 + +- extendedWaitUntil: + visible: + id: 'pageNumber1' + timeout: 5000 diff --git a/.maestro/setup/pager_basic_example_setup.yaml b/.maestro/setup/pager_basic_example_setup.yaml deleted file mode 100644 index 1389cdce..00000000 --- a/.maestro/setup/pager_basic_example_setup.yaml +++ /dev/null @@ -1,7 +0,0 @@ -appId: ${APP_ID} -# Nest PagerView Example tab is active and accessible ---- -- launchApp -- assertVisible: 'PagerView Example' -- tapOn: 'Basic Example' -- assertVisible: '7 likes' diff --git a/.maestro/setup/pager_vertical_basic_example_setup.yaml b/.maestro/setup/pager_vertical_basic_example_setup.yaml deleted file mode 100644 index 2d6ad62e..00000000 --- a/.maestro/setup/pager_vertical_basic_example_setup.yaml +++ /dev/null @@ -1,7 +0,0 @@ -appId: ${APP_ID} -# Vertical Basic Example tab is active and accessible ---- -- launchApp -- assertVisible: 'PagerView Example' -- tapOn: 'Vertical Basic Example' -- assertVisible: '7 likes' diff --git a/.maestro/smoke-test.yaml b/.maestro/smoke-test.yaml index 3a162642..62cb0f67 100644 --- a/.maestro/smoke-test.yaml +++ b/.maestro/smoke-test.yaml @@ -10,15 +10,15 @@ tags: - extendedWaitUntil: visible: - id: 'Basic Example' + id: 'example-basic-horizontal' timeout: 15000 - tapOn: - id: 'Basic Example' + id: 'example-basic-horizontal' - extendedWaitUntil: visible: - id: 'pager-view' + id: 'pager-view-horizontal' timeout: 10000 - assertVisible: diff --git a/.maestro/tests/pager_basic_example.yaml b/.maestro/tests/pager_basic_example.yaml index 16b4faa0..d6bdc1c9 100644 --- a/.maestro/tests/pager_basic_example.yaml +++ b/.maestro/tests/pager_basic_example.yaml @@ -1,47 +1,12 @@ appId: com.pagerviewexample --- -- runFlow: ../setup/pager_basic_example_setup.yaml -- tapOn: 'Scroll Enabled' -- swipe: - from: - id: 'pager-view' - start: 90%, 50% - end: 10%, 50% - duration: 100 -- assertVisible: - text: 'page number 0' -- tapOn: 'Scroll Disabled' -- swipe: - from: - id: 'pager-view' - start: 90%, 50% - end: 10%, 50% - duration: 100 -- assertVisible: - text: 'page number 1' -- tapOn: - id: 'next-page-button' -- assertVisible: - text: 'page number 2' -- tapOn: - id: 'prev-page-button' -- assertVisible: - text: 'page number 1' -- tapOn: - id: 'start-page-button' -- assertVisible: - text: 'page number 0' -- tapOn: - id: 'last-page-button' -- assertVisible: - text: 'page number 9' -- tapOn: - id: 'remove-page-button' -- assertVisible: - text: 'page number 8' -- tapOn: - id: 'add-page-button' -- tapOn: - id: 'next-page-button' -- assertVisible: - text: 'page number 9' +- runFlow: ../flows/basic-pager/ensure-ltr.yaml + +- runFlow: + file: ../flows/basic-pager/open.yaml + env: + EXAMPLE_ID: 'example-basic-horizontal' + PAGER_ID: 'pager-view-horizontal' + +- runFlow: ../flows/basic-pager/verify-horizontal-ltr-swipe.yaml +- runFlow: ../flows/basic-pager/verify-controls.yaml diff --git a/.maestro/tests/pager_rtl_example.yaml b/.maestro/tests/pager_rtl_example.yaml new file mode 100644 index 00000000..7448acd1 --- /dev/null +++ b/.maestro/tests/pager_rtl_example.yaml @@ -0,0 +1,12 @@ +appId: com.pagerviewexample +--- +- runFlow: ../flows/basic-pager/ensure-rtl.yaml + +- runFlow: + file: ../flows/basic-pager/open.yaml + env: + EXAMPLE_ID: 'example-basic-horizontal' + PAGER_ID: 'pager-view-horizontal' + +- runFlow: ../flows/basic-pager/verify-horizontal-rtl-swipe.yaml +- runFlow: ../flows/basic-pager/verify-controls.yaml diff --git a/.maestro/tests/pager_vertical_basic_example.yaml b/.maestro/tests/pager_vertical_basic_example.yaml index b8907646..2e02b221 100644 --- a/.maestro/tests/pager_vertical_basic_example.yaml +++ b/.maestro/tests/pager_vertical_basic_example.yaml @@ -1,45 +1,12 @@ appId: com.pagerviewexample --- -- runFlow: ../setup/pager_vertical_basic_example_setup.yaml -- tapOn: 'Scroll Enabled' -- swipe: - from: - id: 'pager-view' - direction: UP - duration: 100 -- assertVisible: - text: 'page number 0' -- tapOn: 'Scroll Disabled' -- swipe: - from: - id: 'pager-view' - direction: UP - duration: 100 -- assertVisible: - text: 'page number 1' -- tapOn: - id: 'next-page-button' -- assertVisible: - text: 'page number 2' -- tapOn: - id: 'prev-page-button' -- assertVisible: - text: 'page number 1' -- tapOn: - id: 'start-page-button' -- assertVisible: - text: 'page number 0' -- tapOn: - id: 'last-page-button' -- assertVisible: - text: 'page number 9' -- tapOn: - id: 'remove-page-button' -- assertVisible: - text: 'page number 8' -- tapOn: - id: 'add-page-button' -- tapOn: - id: 'next-page-button' -- assertVisible: - text: 'page number 9' +- runFlow: ../flows/basic-pager/ensure-ltr.yaml + +- runFlow: + file: ../flows/basic-pager/open.yaml + env: + EXAMPLE_ID: 'example-basic-vertical' + PAGER_ID: 'pager-view-vertical' + +- runFlow: ../flows/basic-pager/verify-vertical-swipe.yaml +- runFlow: ../flows/basic-pager/verify-controls.yaml diff --git a/.maestro/tests/rtl/pager_basic_example_rtl.yaml b/.maestro/tests/rtl/pager_basic_example_rtl.yaml deleted file mode 100644 index 933adb73..00000000 --- a/.maestro/tests/rtl/pager_basic_example_rtl.yaml +++ /dev/null @@ -1,115 +0,0 @@ -appId: com.pagerviewexample ---- -- launchApp - -- extendedWaitUntil: - visible: - text: 'PagerView Example' - timeout: 15000 - -- runFlow: - when: - visible: 'LTR' - commands: - - tapOn: 'LTR' - -- extendedWaitUntil: - visible: - text: 'PagerView Example' - timeout: 15000 - -- extendedWaitUntil: - visible: - text: 'RTL' - timeout: 15000 - -- tapOn: 'Basic Example' - -- extendedWaitUntil: - visible: - id: 'pager-view' - timeout: 10000 - -- assertVisible: '7 likes' - -- tapOn: 'Scroll Enabled' - -- swipe: - from: - id: 'pager-view' - start: 10%, 50% - end: 90%, 50% - duration: 100 - -- assertVisible: - text: 'page number 0' - -- tapOn: 'Scroll Disabled' - -- swipe: - from: - id: 'pager-view' - start: 10%, 50% - end: 90%, 50% - duration: 100 - -- assertVisible: - text: 'page number 1' - -- tapOn: - id: 'next-page-button' - -- assertVisible: - text: 'page number 2' - -- tapOn: - id: 'prev-page-button' - -- assertVisible: - text: 'page number 1' - -- tapOn: - id: 'start-page-button' - -- assertVisible: - text: 'page number 0' - -- tapOn: - id: 'last-page-button' - -- assertVisible: - text: 'page number 9' - -- tapOn: - id: 'remove-page-button' - -- assertVisible: - text: 'page number 8' - -- tapOn: - id: 'add-page-button' - -- tapOn: - id: 'next-page-button' - -- assertVisible: - text: 'page number 9' - -- tapOn: 'Navigate up' - -- extendedWaitUntil: - visible: - text: 'PagerView Example' - timeout: 10000 - -- tapOn: 'RTL' - -- extendedWaitUntil: - visible: - text: 'PagerView Example' - timeout: 15000 - -- extendedWaitUntil: - visible: - text: 'LTR' - timeout: 15000 diff --git a/.maestro/tests/rtl/pager_vertical_basic_example_rtl.yaml b/.maestro/tests/rtl/pager_vertical_basic_example_rtl.yaml deleted file mode 100644 index d75a47ee..00000000 --- a/.maestro/tests/rtl/pager_vertical_basic_example_rtl.yaml +++ /dev/null @@ -1,113 +0,0 @@ -appId: com.pagerviewexample ---- -- launchApp - -- extendedWaitUntil: - visible: - text: 'PagerView Example' - timeout: 15000 - -- runFlow: - when: - visible: 'LTR' - commands: - - tapOn: 'LTR' - -- extendedWaitUntil: - visible: - text: 'PagerView Example' - timeout: 15000 - -- extendedWaitUntil: - visible: - text: 'RTL' - timeout: 15000 - -- tapOn: 'Vertical Basic Example' - -- extendedWaitUntil: - visible: - id: 'pager-view' - timeout: 10000 - -- assertVisible: '7 likes' - -- tapOn: 'Scroll Enabled' - -- swipe: - from: - id: 'pager-view' - direction: UP - duration: 100 - -- assertVisible: - text: 'page number 0' - -- tapOn: 'Scroll Disabled' - -- swipe: - from: - id: 'pager-view' - direction: UP - duration: 100 - -- assertVisible: - text: 'page number 1' - -- tapOn: - id: 'next-page-button' - -- assertVisible: - text: 'page number 2' - -- tapOn: - id: 'prev-page-button' - -- assertVisible: - text: 'page number 1' - -- tapOn: - id: 'start-page-button' - -- assertVisible: - text: 'page number 0' - -- tapOn: - id: 'last-page-button' - -- assertVisible: - text: 'page number 9' - -- tapOn: - id: 'remove-page-button' - -- assertVisible: - text: 'page number 8' - -- tapOn: - id: 'add-page-button' - -- tapOn: - id: 'next-page-button' - -- assertVisible: - text: 'page number 9' - -- tapOn: 'Navigate up' - -- extendedWaitUntil: - visible: - text: 'PagerView Example' - timeout: 10000 - -- tapOn: 'RTL' - -- extendedWaitUntil: - visible: - text: 'PagerView Example' - timeout: 15000 - -- extendedWaitUntil: - visible: - text: 'LTR' - timeout: 15000 diff --git a/example/src/App.tsx b/example/src/App.tsx index 5883964c..b3e8491d 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -43,14 +43,22 @@ function VerticalBasicPagerViewExampleScreen() { return ; } -const examples = [ +type Example = { + component: React.ComponentType; + name: string; + testID?: string; +}; + +const examples: Example[] = [ { component: BasicPagerViewExampleScreen, name: 'Basic Example', + testID: 'example-basic-horizontal', }, { component: VerticalBasicPagerViewExampleScreen, name: 'Vertical Basic Example', + testID: 'example-basic-vertical', }, { component: OnPageScrollExample, name: 'OnPageScroll Example' }, @@ -80,14 +88,14 @@ const examples = [ }, ]; -const tabViewExamples = [ +const tabViewExamples: Example[] = [ { component: MaterialTopBarExample, name: 'MaterialTopBarExample' }, { component: TabBarIconExample, name: 'TabBarIconExample' }, { component: CustomTabBarExample, name: 'CustomTabBarExample' }, { component: CoverflowExample, name: 'CoverflowExample' }, ]; -const additionalExamples = [ +const additionalExamples: Example[] = [ { component: PagerHookExample, name: 'Pager Hook Example' }, { component: KeyboardExample, name: 'Keyboard Example' }, { component: HeadphonesCarouselExample, name: 'Headphones Carousel Example' }, @@ -108,7 +116,7 @@ function App() { {examples.map((example) => ( { //@ts-ignore @@ -192,6 +200,9 @@ export function Navigation() {