Skip to content

Conversation

@KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented May 23, 2025

Removed commands which was not able to use via extention commands such as @driver.execute_script 'flutter:click', {text: 'Exit this screen'}. The command didn't conver to finder on the server side, so this PR removes unworked actions.

[5de40ffc][HTTP] --> POST /session/5de40ffc-558c-4563-85bc-f4fcf336d179/execute/sync {"script":"flutter:click","args":[{"text":"Exit this screen"}]}
[5de40ffc][FlutterDriver@0b16] Calling AppiumDriver.execute() with args: ["flutter:click",[{"text":"Exit this screen"}],"5de40ffc-558c-4563-85bc-f4fcf336d179"]
[5de40ffc][FlutterDriver] Executing Flutter driver command 'execute'
[5de40ffc][FlutterDriver@0b16] Encountered internal error running command: Error: Input is is expceted to be a base64-encoded string or a valid element object. {"text":"Exit this screen"} has been provided instead
    at decode (/Users/kazu/github/appium-flutter-driver/driver/lib/sessions/base64url.ts:14:11)
    at FlutterDriver.executeElementCommand (/Users/kazu/github/appium-flutter-driver/driver/lib/sessions/observatory.ts:167:58)
    at FlutterDriver.tapEl (/Users/kazu/github/appium-flutter-driver/driver/lib/commands/gesture.ts:17:21)
    at FlutterDriver.click (/Users/kazu/github/appium-flutter-driver/driver/lib/commands/gesture.ts:5:29)
    at click (/Users/kazu/github/appium-flutter-driver/driver/lib/commands/execute.ts:165:17)
    at FlutterDriver.execute (/Users/kazu/github/appium-flutter-driver/driver/lib/commands/execute.ts:193:16)
    at runCommandPromise (/Users/kazu/github/appium-flutter-driver/driver/node_modules/@appium/base-driver/lib/basedriver/driver.ts:116:20)
    at /Users/kazu/github/appium-flutter-driver/driver/node_modules/async-lock/lib/index.js:171:12
    at AsyncLock._promiseTry (/Users/kazu/github/appium-flutter-driver/driver/node_modules/async-lock/lib/index.js:306:31)
    at exec (/Users/kazu/github/appium-flutter-driver/driver/node_modules/async-lock/lib/index.js:170:9)
    at AsyncLock.acquire (/Users/kazu/github/appium-flutter-driver/driver/node_modules/async-lock/lib/index.js:189:3)
    at FlutterDriver.executeCommand (/Users/kazu/github/appium-flutter-driver/driver/node_modules/@appium/base-driver/lib/basedriver/driver.ts:160:39)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at FlutterDriver.executeCommand (/Users/kazu/github/appium-flutter-driver/driver/lib/driver.ts:245:16)
    at defaultBehavior (/Users/kazu/.nvm/versions/node/v16.20.2/lib/node_modules/appium/lib/appium.js:1135:14)
    at AppiumDriver.executeWrappedCommand (/Users/kazu/.nvm/versions/node/v16.20.2/lib/node_modules/appium/lib/appium.js:1241:16)
    at AppiumDriver.executeCommand (/Users/kazu/.nvm/versions/node/v16.20.2/lib/node_modules/appium/lib/appium.js:1147:17)
    at asyncHandler (/Users/kazu/.nvm/versions/node/v16.20.2/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:387:19)
[5de40ffc][HTTP] <-- POST /session/5de40ffc-558c-4563-85bc-f4fcf336d179/execute/sync 500 24 ms - 828
[5de40ffc][HTTP] --> DELETE /session/5de40ffc-558c-4563-85bc-f4fcf336d179 {}

Also, I have added @driver.execute_script 'flutter:assertVisible', {text: 'Tap me!'}, 10000 to run tests on CI. This change fixed the conversion error.


Summary:

  • Drops flutter:tap, flutter:click, flutter:getText and flutter:clear since the example's usage addressed in feat: New Assertions methods and better usability #797 didn't work as the above error. Maybe they need to run via JS
  • The flutter:pageBack was replaced with standard driver.back to call it via uia2/xcuitest always

@KazuCocoa KazuCocoa requested a review from Copilot May 24, 2025 22:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adjusts the implementation of Flutter driver commands by removing non-functional commands and updating related tests and documentation. Key changes include:

  • Dropping unsupported commands (flutter:tap, flutter:click, flutter:getText, flutter:clear) and updating page back handling.
  • Introducing a new driver.back method and updating test examples to call this method.
  • Revising helper functions and documentation to reflect the adjusted command APIs.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Removed dependency on appium-flutter-finder, cleaning up unused package references.
example/ruby/example_sample2.rb Updated test examples to use the new flutter:assertVisible and flutter:clickElement commands, and standardized the back navigation call.
driver/lib/driver.ts Added a new back() function to delegate back navigation to the platform driver.
driver/lib/commands/execute/scroll.ts Updated the longTap command signature, enforcing an object parameter instead of a union type.
driver/lib/commands/execute.ts Removed deprecated commands and streamlined the command mapping accordingly.
driver/lib/commands/assertions.ts Removed serialization in the finder conversion function to align with new finder usage.
README.md Adjusted documentation to reflect the removal and renaming of commands.
Comments suppressed due to low confidence (2)

driver/lib/commands/execute.ts:156

  • The removal of the 'pageBack' command from the command handlers could break client code that expects to use 'driver.execute("flutter:pageBack")'. Ensure that all clients have migrated to using the new driver.back method.
  pageBack: async (driver) =>

driver/lib/commands/assertions.ts:39

  • Replacing serializeFinder(byValueKey(input.key)) with a direct call to byValueKey(input.key) may affect downstream consumers expecting a serialized (base64-encoded) string. Ensure that all dependent modules or client code are updated to handle the new finder format.
    return byValueKey(input.key);

@KazuCocoa KazuCocoa merged commit ca9c0ba into main May 25, 2025
11 of 12 checks passed
@KazuCocoa KazuCocoa deleted the adjust branch May 25, 2025 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants