Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commands interface in v9 missing command name/info & args #2219

Open
vaind opened this issue Aug 12, 2024 · 4 comments
Open

Commands interface in v9 missing command name/info & args #2219

vaind opened this issue Aug 12, 2024 · 4 comments

Comments

@vaind
Copy link

vaind commented Aug 12, 2024

Description

In previous versions of Appium, I've been able to collect timings of executed commands. After update to v9, the commands interface no longer contains the name of the executed command (nor any other information to use in filtering).

Environment

  • Java client build version or git revision if you use some snapshot: 9.3.0
  • Appium server version or git revision if you use some snapshot: 2.11.2
  • Desktop OS/version used to run Appium if necessary: macOS
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: v22.4.1
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: simulator

Details

Please provide more details, if necessary.
The code that worked previously:

driver.activateApp(app.name)

// or following, the result is the same:
// driver.executeScript("mobile:launchApp", ImmutableMap.of("bundleId", app.name));

driver.events.commands.filter { it.name == "activateApp" }

Currently, the commands interface doesn't have any useful identifier for commands triggered by drivers:

"commands": [
    {
      "cmd": "getLogEvents",
      "startTime": 1723451304905,
      "endTime": 1723451304905
    },
    {
      "cmd": "execute",
      "startTime": 1723451304936,
      "endTime": 1723451312314
    }
  ],
@mykola-mokhnach
Copy link
Contributor

Sorry, I am confused.

driver.events.commands.filter { it.name == "activateApp" }

The above code snippet does not look like it is a java code

"commands": [
    {
      "cmd": "getLogEvents",
      "startTime": 1723451304905,
      "endTime": 1723451304905
    },
    {
      "cmd": "execute",
      "startTime": 1723451304936,
      "endTime": 1723451312314
    }
  ],

Not sure what is expected to be in this list. As far as I can see the type of a single event was always like that and did not change on the server side: https://github.com/appium/appium/blob/622b245ea38793280d9785a59a0416ce025862fe/packages/types/lib/driver.ts#L571

@vaind
Copy link
Author

vaind commented Aug 12, 2024

Before update (i.e. with appium java client v8.1.1), the output of print(driver.events) was:

ServerEvents(commands=[CommandEvent(name=activateApp, startTimestamp=1723462917787, endTimestamp=1723462921607)], events=[TimedEvent(name=xcodeDetailsRetrieved, occurrences=[1723462914342]), TimedEvent(name=appConfigured, occurrences=[1723462914342]), TimedEvent(name=resetStarted, occurrences=[1723462914342]), TimedEvent(name=resetComplete, occurrences=[1723462914342]), TimedEvent(name=logCaptureStarted, occurrences=[1723462914694]), TimedEvent(name=simStarted, occurrences=[1723462914942]), TimedEvent(name=wdaStartAttempted, occurrences=[1723462916628]), TimedEvent(name=wdaSessionAttempted, occurrences=[1723462916633]), TimedEvent(name=wdaSessionStarted, occurrences=[1723462916640]), TimedEvent(name=wdaStarted, occurrences=[1723462916640])], jsonData={

so it was possible to filter by the actual command name.

@vaind
Copy link
Author

vaind commented Aug 12, 2024

Note: I've had to update drivers too so maybe it has something to do with those as well?

@mykola-mokhnach
Copy link
Contributor

yes, it might be a result of a bugfix. activateApp is not a "real" command. It is just a value of the script argument in /execute API. That is why the presence of execute command is expected and correct. Having this argument reflected in the events history would be a separate feature.

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

No branches or pull requests

2 participants