-
Notifications
You must be signed in to change notification settings - Fork 34
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
Read external resources locally when generating html report #404
Read external resources locally when generating html report #404
Conversation
oldValue = "REPORT_TEMPLATE_BODY", | ||
newValue = roborazziResults.toHtml(reportFile.parentFile.absolutePath) | ||
) | ||
) ?: "" |
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.
Perhaps error in this case?
Thanks! The code looks good. However, I'm concerned about the LICENSE. I'm not sure if it is appropriate to include these files. I'm really sorry for noticing this late. 🙇 |
That's a good concern to have. Checking the license for
For the material icons it's Apache 2 license 1. I believe we're good with this too. |
acf060b
to
525393d
Compare
I agree with you. However, we might need to include both the Apache 2.0 and MIT licenses in our documentation. This could make it look a bit strange to users. |
Oh I see. Is this to credit them? The license info are clear in the header of the minified files in case you're not aware. |
Well, it is tough, but if we separate the repository into something like html-report-resources and make sure the license for Materialize is MIT and for the font is Apache 2.0, it might work. Maven includes license information, so this could be a viable solution. |
You suggesting we create an entire separate repo to host the, the css and js files or create a new folder(to host the external files) in the same repo as this? |
525393d
to
0ce263e
Compare
I found something 👀 Could we use this..? |
That's gold. That should work. I'll look into it then. Thanks |
Locally add all JS, CSS and fonts locally to the gradle plugin
0ce263e
to
5d333ee
Compare
import org.webjars.WebJarVersionLocator | ||
import java.io.File | ||
|
||
class WebAssets private constructor(private val webJarVersionLocator: WebJarVersionLocator) { |
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.
Looks great👍
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.
Thanks. The CSS from the webjar packing seems a little old. The styling is a little off from main
Looking to see if there is a recently one published with webjar.
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 noticed it, but it's a subtle change. So I think it is ok
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.
Yeah, however not all the tabs shows. That I think needs to be fixed.
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.
Resolved it with 9864d9d. All the tabs shows now though we lost the fixed sized tabs. I believe it should be okay?
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.
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.
Looks great! Thank you for your patience in fixing this!
@@ -50,6 +52,9 @@ open class RoborazziExtension @Inject constructor(objects: ObjectFactory) { | |||
@Suppress("unused") | |||
// From Paparazzi: https://github.com/cashapp/paparazzi/blob/a76702744a7f380480f323ffda124e845f2733aa/paparazzi/paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PaparazziPlugin.kt | |||
abstract class RoborazziPlugin : Plugin<Project> { | |||
|
|||
private val webJarVersionLocator = WebJarVersionLocator() |
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 believe this can be removed now.
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.
Yes. It can be removed now. Thanks for catching it
@@ -32,6 +32,8 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests | |||
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget | |||
import org.jetbrains.kotlin.gradle.targets.native.KotlinNativeBinaryTestRun | |||
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest | |||
import org.webjars.WebJarVersionLocator |
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.
import org.webjars.WebJarVersionLocator |
|
||
private val webJarVersionLocator = WebJarVersionLocator() | ||
|
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.
private val webJarVersionLocator = WebJarVersionLocator() |
import org.webjars.WebJarVersionLocator | ||
import java.io.File | ||
|
||
class WebAssets private constructor(private val webJarVersionLocator: WebJarVersionLocator) { |
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 noticed it, but it's a subtle change. So I think it is ok
I'll merge this PR. Since I don't want to include the JS files in the repository history, I'll squash and merge. |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [io.github.takahirom.roborazzi](https://togithub.com/takahirom/roborazzi) | plugin | minor | `1.20.0` -> `1.21.0` | | [io.github.takahirom.roborazzi:roborazzi-junit-rule](https://togithub.com/takahirom/roborazzi) | dependencies | minor | `1.20.0` -> `1.21.0` | | [io.github.takahirom.roborazzi:roborazzi-compose](https://togithub.com/takahirom/roborazzi) | dependencies | minor | `1.20.0` -> `1.21.0` | | [io.github.takahirom.roborazzi:roborazzi](https://togithub.com/takahirom/roborazzi) | dependencies | minor | `1.20.0` -> `1.21.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>takahirom/roborazzi (io.github.takahirom.roborazzi)</summary> ### [`v1.21.0`](https://togithub.com/takahirom/roborazzi/releases/tag/1.21.0) [Compare Source](https://togithub.com/takahirom/roborazzi/compare/1.20.0...1.21.0) ##### Android Studio, IntelliJ IDEA Plugin is coming The Roborazzi Plugin has been released after the previous release. Please check it out. The Roborazzi plugin enhances your development workflow by automatically displaying screenshots related to Roborazzi's screenshot tests within IntelliJ IDEA. Easily view and verify visual outputs directly in your IDE, streamlining your testing and development process. https://github.com/takahirom/roborazzi/assets/1386930/bd3e8106-1971-4ec4-b764-3f1831999228 https://plugins.jetbrains.com/plugin/24561-roborazzi ##### Now, test report assets are written in the same directory as the report HTML. We are using Materialize for the HTML report generated in build/reports/roborazzi. This causes a [Content Security Policy (CSP) problem](https://togithub.com/takahirom/roborazzi/issues/295) when using iframes. As a result, we can't view the report correctly in some projects. To resolve this, we now save the assets like CSS and JS in the same directory as the report HTML. Thank you, [@​eyedol](https://togithub.com/eyedol), for tackling this difficult problem. Thank you, [@​realdadfish](https://togithub.com/realdadfish), for reporting this! ##### Bug fix In the Windows environment, the image path in the report file is not written correctly. I fixed the path separator to resolve this issue. Thank you for reporting this, [@​ben-gooding-hub](https://togithub.com/ben-gooding-hub). ##### What's Changed - \[CI] Update actions/checkout digest to [`a5ac7e5`](https://togithub.com/takahirom/roborazzi/commit/a5ac7e5) by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/384](https://togithub.com/takahirom/roborazzi/pull/384) - \[CI] Update nick-fields/retry action to v2.9.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/357](https://togithub.com/takahirom/roborazzi/pull/357) - \[CI] Update dependency io.ktor:ktor-serialization-kotlinx-xml to v2.3.11 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/360](https://togithub.com/takahirom/roborazzi/pull/360) - \[Sample] Update dependency androidx.appcompat:appcompat to v1.7.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/394](https://togithub.com/takahirom/roborazzi/pull/394) - \[Idea Plugin] Add Roborazzi Preview prototype to Idea Plugin by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/395](https://togithub.com/takahirom/roborazzi/pull/395) - \[Idea Plugin] Add empty Roborazzi idea plugin by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/367](https://togithub.com/takahirom/roborazzi/pull/367) - \[Docs] Add faq section about out of memory error by [@​sanao1006](https://togithub.com/sanao1006) in [https://github.com/takahirom/roborazzi/pull/402](https://togithub.com/takahirom/roborazzi/pull/402) - \[Idea Plugin] Fix the issue where the image is not selected as intended by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/403](https://togithub.com/takahirom/roborazzi/pull/403) - \[Idea Plugin] Add README section of idea plugin by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/405](https://togithub.com/takahirom/roborazzi/pull/405) - \[Internal (compileOnly)] Update dependency androidx.compose.ui:ui-test to v1.6.8 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/397](https://togithub.com/takahirom/roborazzi/pull/397) - \[CI] Update actions/checkout digest to [`692973e`](https://togithub.com/takahirom/roborazzi/commit/692973e) by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/406](https://togithub.com/takahirom/roborazzi/pull/406) - \[Docs] Add robolectric.pixelCopyRenderMode to README by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/409](https://togithub.com/takahirom/roborazzi/pull/409) - \[Docs] Remove unneeded " in README by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/410](https://togithub.com/takahirom/roborazzi/pull/410) - \[Feature] Read external resources locally when generating html report by [@​eyedol](https://togithub.com/eyedol) in [https://github.com/takahirom/roborazzi/pull/404](https://togithub.com/takahirom/roborazzi/pull/404) - \[CI] Update dependency gradle to v8.8 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/354](https://togithub.com/takahirom/roborazzi/pull/354) - \[Bug fix] Fix windows report relative path by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/419](https://togithub.com/takahirom/roborazzi/pull/419) **Full Changelog**: takahirom/roborazzi@1.20.0...1.21.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjIuMyIsInVwZGF0ZWRJblZlciI6IjM3LjQyMi4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [io.github.takahirom.roborazzi](https://togithub.com/takahirom/roborazzi) | `1.20.0` -> `1.21.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.takahirom.roborazzi/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.takahirom.roborazzi/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.takahirom.roborazzi/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.takahirom.roborazzi/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [io.github.takahirom.roborazzi:roborazzi-junit-rule](https://togithub.com/takahirom/roborazzi) | `1.20.0` -> `1.21.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.takahirom.roborazzi:roborazzi-junit-rule/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.takahirom.roborazzi:roborazzi-junit-rule/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.takahirom.roborazzi:roborazzi-junit-rule/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.takahirom.roborazzi:roborazzi-junit-rule/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [io.github.takahirom.roborazzi:roborazzi-compose-desktop](https://togithub.com/takahirom/roborazzi) | `1.20.0` -> `1.21.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.takahirom.roborazzi:roborazzi-compose-desktop/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.takahirom.roborazzi:roborazzi-compose-desktop/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.takahirom.roborazzi:roborazzi-compose-desktop/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.takahirom.roborazzi:roborazzi-compose-desktop/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [io.github.takahirom.roborazzi:roborazzi-compose](https://togithub.com/takahirom/roborazzi) | `1.20.0` -> `1.21.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.takahirom.roborazzi:roborazzi-compose/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.takahirom.roborazzi:roborazzi-compose/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.takahirom.roborazzi:roborazzi-compose/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.takahirom.roborazzi:roborazzi-compose/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [io.github.takahirom.roborazzi:roborazzi](https://togithub.com/takahirom/roborazzi) | `1.20.0` -> `1.21.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.takahirom.roborazzi:roborazzi/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.takahirom.roborazzi:roborazzi/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.takahirom.roborazzi:roborazzi/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.takahirom.roborazzi:roborazzi/1.20.0/1.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>takahirom/roborazzi (io.github.takahirom.roborazzi)</summary> ### [`v1.21.0`](https://togithub.com/takahirom/roborazzi/releases/tag/1.21.0) [Compare Source](https://togithub.com/takahirom/roborazzi/compare/1.20.0...1.21.0) #### Android Studio, IntelliJ IDEA Plugin is coming The Roborazzi Plugin has been released after the previous release. Please check it out. The Roborazzi plugin enhances your development workflow by automatically displaying screenshots related to Roborazzi's screenshot tests within IntelliJ IDEA. Easily view and verify visual outputs directly in your IDE, streamlining your testing and development process. https://github.com/takahirom/roborazzi/assets/1386930/bd3e8106-1971-4ec4-b764-3f1831999228 https://plugins.jetbrains.com/plugin/24561-roborazzi #### Now, test report assets are written in the same directory as the report HTML. We are using Materialize for the HTML report generated in build/reports/roborazzi. This causes a [Content Security Policy (CSP) problem](https://togithub.com/takahirom/roborazzi/issues/295) when using iframes. As a result, we can't view the report correctly in some projects. To resolve this, we now save the assets like CSS and JS in the same directory as the report HTML. Thank you, [@​eyedol](https://togithub.com/eyedol), for tackling this difficult problem. Thank you, [@​realdadfish](https://togithub.com/realdadfish), for reporting this! #### Bug fix In the Windows environment, the image path in the report file is not written correctly. I fixed the path separator to resolve this issue. Thank you for reporting this, [@​ben-gooding-hub](https://togithub.com/ben-gooding-hub). #### What's Changed - \[CI] Update actions/checkout digest to [`a5ac7e5`](https://togithub.com/takahirom/roborazzi/commit/a5ac7e5) by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/384](https://togithub.com/takahirom/roborazzi/pull/384) - \[CI] Update nick-fields/retry action to v2.9.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/357](https://togithub.com/takahirom/roborazzi/pull/357) - \[CI] Update dependency io.ktor:ktor-serialization-kotlinx-xml to v2.3.11 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/360](https://togithub.com/takahirom/roborazzi/pull/360) - \[Sample] Update dependency androidx.appcompat:appcompat to v1.7.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/394](https://togithub.com/takahirom/roborazzi/pull/394) - \[Idea Plugin] Add Roborazzi Preview prototype to Idea Plugin by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/395](https://togithub.com/takahirom/roborazzi/pull/395) - \[Idea Plugin] Add empty Roborazzi idea plugin by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/367](https://togithub.com/takahirom/roborazzi/pull/367) - \[Docs] Add faq section about out of memory error by [@​sanao1006](https://togithub.com/sanao1006) in [https://github.com/takahirom/roborazzi/pull/402](https://togithub.com/takahirom/roborazzi/pull/402) - \[Idea Plugin] Fix the issue where the image is not selected as intended by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/403](https://togithub.com/takahirom/roborazzi/pull/403) - \[Idea Plugin] Add README section of idea plugin by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/405](https://togithub.com/takahirom/roborazzi/pull/405) - \[Internal (compileOnly)] Update dependency androidx.compose.ui:ui-test to v1.6.8 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/397](https://togithub.com/takahirom/roborazzi/pull/397) - \[CI] Update actions/checkout digest to [`692973e`](https://togithub.com/takahirom/roborazzi/commit/692973e) by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/406](https://togithub.com/takahirom/roborazzi/pull/406) - \[Docs] Add robolectric.pixelCopyRenderMode to README by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/409](https://togithub.com/takahirom/roborazzi/pull/409) - \[Docs] Remove unneeded " in README by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/410](https://togithub.com/takahirom/roborazzi/pull/410) - \[Feature] Read external resources locally when generating html report by [@​eyedol](https://togithub.com/eyedol) in [https://github.com/takahirom/roborazzi/pull/404](https://togithub.com/takahirom/roborazzi/pull/404) - \[CI] Update dependency gradle to v8.8 by [@​renovate](https://togithub.com/renovate) in [https://github.com/takahirom/roborazzi/pull/354](https://togithub.com/takahirom/roborazzi/pull/354) - \[Bug fix] Fix windows report relative path by [@​takahirom](https://togithub.com/takahirom) in [https://github.com/takahirom/roborazzi/pull/419](https://togithub.com/takahirom/roborazzi/pull/419) **Full Changelog**: takahirom/roborazzi@1.20.0...1.21.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/chrisbanes/haze). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuOSIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Fixes #295
Changes:
materialize.min.css
,materialize.min.js
,material-icons
resources to the generated html report.index.html
file for easier editingindex.html
index.html
file