-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
feat: Make it possible to consume Espresso server as a library #1020
Conversation
e3c695b
to
51cfe51
Compare
Thank you @technoir42 Please update failing integration tests and also prepare a separate document which describes in details how to use this driver as a library |
|
51cfe51
to
040ba39
Compare
040ba39
to
72969b4
Compare
@mykola-mokhnach I might've fixed functional tests, can you approve the workflow please? |
Done. Thanks. Where could I find the document that describes how to use the source as a library? |
For now, the library cannot be consumed externally, even via JitPack. I will add publishing to a Maven repository in a follow-up PR if that's fine with you. I did however verify that the solution works via a fork published to JitPack. |
It would probably make sense to increase the major version as the structure/usage changes. (it just needs to add "BREAKING CHANGES" in the commit message, so this is a note for us when we merge this thing) I'll take a look and do a bit of testing with this branch tonight or tomorrow for existing usage. For Maven, maybe we need to do similar thing to what currently does in https://github.com/appium/java-client then (name space etc) |
@KazuCocoa this shouldn't affect existing usages, so it's more of an internal structure change than a breaking change. If you notice any change in behaviour for existing users, I can revert it.
Thanks for the tip, I'll look into that. |
I also did not mention any breaking things. It would be interesting for me too see how the "library" scenario is supposed to work. Are we going to use the bundled module separately from the espresso driver or it could still be a part of the ecosystem, like in the flutter integration driver? |
Sure, I just thought this could be kind of a major version update with a new usage for the espresso driver itself, so not breaking change or small feature addition but to show this has a major usage update: current existing method to run a single server and interact with the app under test via instrument, and let users to integrate this Appium espresso server in their own espresso module to create custom espresso server by them. So, with this lib method, a user could build their own espresso server that has Appium Espresso functionality and their own something like a mock server as one package without forking this repo (with |
} | ||
|
||
dependencies { | ||
// additionalAppDependencies placeholder (don't change or delete this line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think api
is better for here than implementation
?
appium-espresso-driver/lib/server-builder.js
Line 151 in b94d758
? 'implementation' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that transitive implementation
dependencies don't get packaged into the instrumentation APK, and R8 minification fails due to missing classes. I faced this with a standalone test module. However api
dependencies get packaged as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KazuCocoa I changed the script to add additionalAppDependencies
as api
ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, overall 🚀 I did a test on my local with a couple of espresso configs, and another test suite.
BREAKING CHANGE: `appiumZipAlign` Gradle property has been removed as it didn't have any effect.
72969b4
to
5980cc8
Compare
I added BREAKING CHANGE footer about
Yep, we build and install the app and Espresso server APK ourselves, then use an Appium client with |
Here's a sample project to show this in action. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good at proceeding documentation etc after this pr merge.
For publishing, maybe starting from jitpack would be good, then maven. (I haven't checked anything to run this repo on jitkack right now tho)
https://github.com/appium/java-client
## [3.0.0](v2.44.2...v3.0.0) (2024-07-10) ### ⚠ BREAKING CHANGES * `appiumZipAlign` Gradle property has been removed as it didn't have any effect ### Features * Make it possible to consume Espresso server as a library ([#1020](#1020)) ([1bf4a92](1bf4a92))
🎉 This issue has been resolved in version 3.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Context
Espresso server has to be built with the correct versions of plugins, dependencies and signing keys that match the app it will be instrumenting. One way to do so is to build the server from this repo, passing a relatively long list of Gradle properties.
The idea
Instead, we want to consume Espresso server as a library, apply dependency constraints to align the versions of dependencies, and embed it in either androidTest component of the app or in a standalone test module under the same
Gradle project. The library only has to expose a single method for starting a server and TestRule for Compose support.
This way, the Espresso server APK will be built with the correct versions of AGP, Kotlin and dependencies automatically.
If the app is obfuscated, we can also use slackhq/keeper to infer the obfuscation rules.
Example
Standalone test module:
The test that should reside on the consumer side:
Build both the app and Espresso server: