-
Notifications
You must be signed in to change notification settings - Fork 5
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
GMD recordMode not working as expected #244
Comments
It seems we're missing tests for this scenario so it might have regressed. Thank you for bringing this to our attention. We'll take a look for the next release. |
Thanks @DanielJette. Do you have a timeline for when that next release may be? Our CI/CD pipeline has really flaky tests when we use the emulator that it comes installed with so I was hoping to try and migrate to GMD for our test suite to see if there would be any improvement. Currently had to disable all our tests... 🙁 |
We don't have a schedule for the next release, but I can take a look at this issue tonight to see if it's a quick fix or not. I'll update this ticket tomorrow morning with an estimate on when you can expect a fix. |
@matthew-shin-hs I was looking at this today and I'm not sure if I'm able to correctly reproduce your issue. When you say it's not working, can you elaborate? Does it run the test correctly? |
@DanielJette I'm running It runs the test instead of recording baseline like I expect it to when I set in the
I am also expecting the test itself to pass but I see some fail, but I am guessing it is because I haven't correctly set up my device with my existing screenshot baselines. But I would only know that's the case if I were able to record a new baseline and see the diff on it which I cannot because I can't get it to record a new baseline at all. Either through the
I hope this clarifies! |
Thanks for the clarification @matthew-shin-hs I've been able to narrow down the issue to an update made to the GMD runtime. Previously, GMD tests would execute the same instrumented code path as an Android Test. This no longer appears to be the case. I'm not sure when this change happened, but the consequence of this is that the I'm going to investigate alternatives and hope to have a solution up shortly. |
Update ManifestHelper to use alternate version of getApplicationInfo
Fix is here #248 |
Update ManifestHelper to use alternate version of getApplicationInfo
@DanielJette perfect thank you! I will be on the lookout for the new version with the fix! |
Update ManifestHelper to use alternate version of getApplicationInfo
* 246: Upgrade to AGP 8.8 and Gradle 8.10.2 * 244: Fix #244 GMD recordMode not working as expected Update ManifestHelper to use alternate version of getApplicationInfo * Fix "Unresolved reference: serviceOf" * Fix "Inconsistent JVM-target compatibility detected for tasks 'compileJava' (21) and 'compileKotlin' (17)."
@matthew-shin-hs 3.2.1 has been published. Please let me know if this has addressed your issue adequately. |
@DanielJette Hey thanks for the update. I tried it out real quick but I get this error:
I have both
and
and the dependency for the test service that is outlined in the doc. I've also tried in both recordMode So I'm not sure what else I'm missing. I'll keep digging but wondering if this is also potentially a bug. |
Oh, sorry about that @matthew-shin-hs A workaround would be to drop the version of your |
@DanielJette Oh gotcha thanks for the heads up. Thank you! Always appreciate the quick response. I'll try the workaround and let you know |
@DanielJette Oh I see in the doc |
@DanielJette hmm I was able to get it to run with |
@matthew-shin-hs I'm going to try to update testify with the proper 1.5.0 dependencies tonight so hopefully I can get you a fixed release tomorrow. As for the baseline, I debugged this a little while I was working on this fix and I noticed that the GMD device has a different instrumentation runner than typical android tests and this means that the console output isn't shown on the host computer. It should be recording the baseline images, it's likely that you're just not seeing any updates. You can confirm this by checking the When I run
|
When in GMD mode, Testify isn't able to automatically update your For example:
|
We'd hoped to add native support for copying files via the |
@DanielJette ah yes thanks so much. I remember reading that with the managed outputs but had forgotten about it since I last mentioned the bug. I check that output and it's there! So that's great. With your fix for Just curious, with GMD, because it launches a new emulator each time it runs, it shouldn't depend on any VM pre installed on it, is that correct? |
Yes, my understanding is that it's fully self-contained. I have a new Mac Mini and only installed Android Studio and the single default emulator that came with it and yet it provisioned and launched the GMD device without any prompting from me. |
@DanielJette and one other question I couldn't find references to in the docs, I know we should disable animations through the emulators to minimize differences on each test run, is that the same case for GMD? Assuming that's another benefit of using GMD? So that locally or through CI/CD you don't have to manually set these emulator settings and instead can be done through gradle? |
I haven't actually noticed if the animations are enabled or not, but I would agree that it seems logically to expect that they would be. To be safe, you can also set
|
@matthew-shin-hs I just published a It'll probably take an hour or so for the artifacts to appear on Maven https://repo1.maven.org/maven2/dev/testify/testify/ |
@DanielJette Yes! It looks like that release works with the latest version of ![]() UPDATE: I've tried to run this a couple more times to get a consistent failure to reproduce it, but I can't quite figure out exactly what's causing it. Sometimes it works, sometimes it doesn't? It also seems like that sometimes even when I get that error, things still record the way I expect it to. I didn't spend too much time on it in case it is a known bug, but if you are not aware of it I can look more into the details to get a consistent reproduction tomorrow UPDATE 2: I've also tried using the |
From the doc, it says:
Doesn't this imply that it will automatically copy the recorded files to the |
@matthew-shin-hs About the error, I double-checked the code and that is a handled exception. Testify is logging it as an error, but it shouldn't be resulting in any test failures. That FileNotFound is referencing the Arguably, we could have added a |
@matthew-shin-hs That's definitely what this says, but the code definitely does not do this. The Testify library (where GMD support is implemented) can not access the host computer. It runs on the managed device/emulator only and so it's impossible for it to automatically copy files to the That's definitely incorrect information in the documentation and it will have to be updated. I've logged a bug against the documentation here: #250 |
@DanielJette perfect, I think it looks good, thanks for addressing the bug so quickly! Last thing, I'm assuming this gradle setup has to be done for each module in a project that's multi-modular instead of in like a root level build.gradle? |
@matthew-shin-hs Oh, great question. I haven't actually tried this, but I would presume those settings are per-module. |
@DanielJette @djette-st Perfect, thanks so much for your help. I'll keep a look out for the official |
Setting up GMD, followed the instructions in both the blog and the recipe section but can't seem to get the second way of recording baseline to work. By putting
recordMode true
in thebuild.gradle
file instead of through the test configure method.This issue relates to:
To Reproduce
Steps to reproduce the behavior:
Try setting the recordMode to true and record baseline
Expected behavior
New baseline are recorded and do not get failures in build with the
dev.testify.core.exception.ScreenshotIsDifferentException:
Desktop (please complete the following information):
Target Android Device (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: