admin管理员组文章数量:1310099
Currently using the Compose Preview Screenshot Testing
library successfully to a certain degree.
The version I am currently using is 0.0.1-alpha08
The app is a multi-modular app with the following module structure:
:app
simply launches the feature screens:feature:chat
contains the full feature code, including composables and respective previews- also includes the
feature\chat\src\screenshotTest\...\PreviewScreenshotCode.kt
- also includes the
:core
contains files used to display rich content in previews, such asjson
andtext
files which are read throughcontext.resources.assets.open(...)
To recap: all normal (non-screenshot code) previews in :feature:chat
work perfectly fine, and they do display all the data pulled from :core
to used in the UI without any issues.
The screenshots taken by the library are also working almost fine, except that any data they need to use from :core
is never used, it's like it does not exist at all.
I have a suspicion that this might be related to different context environments between the code running in screenshotTest
vs what is available in :core
assets folder, maybe these files cannot be accessed from the context of a screenshotTestImplementation
so for all intents there are no files to read as a result.
I tried exploring multiple different ways to work around this, to use core test libraries to explicitly change the context used, but with no success.
Plan A:
Is there a way to make the screenshot library able to access the assets from the other module?
Plan B:
Less ideal, but would be acceptable. Is there a way that I can automatically generate a structured Object.kt
file that contains the contents of all json
or text
files located inside the assets folder so it can be directly accessed without having to use context? These would have to be automatically generated based on the files and their contents because they are numerous, and the manual process would be prohibitive.
本文标签:
版权声明:本文标题:android - How to read assets outside the screenshotTest context to create Compose Preview Screenshot Testing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741856481a2401371.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论