-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from takahirom/takahirom/introduce-writerside…
…-documentation/2023-12-03 Add Roborazzi documentation using Writerside
- Loading branch information
Showing
12 changed files
with
1,312 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Build documentation | ||
|
||
on: | ||
# If specified, the workflow will be triggered automatically once you push to the `main` branch. | ||
# Replace `main` with your branch’s name | ||
push: | ||
branches: ["main"] | ||
# Specify to run a workflow manually from the Actions tab on GitHub | ||
workflow_dispatch: | ||
|
||
# Gives the workflow permissions to clone the repo and create a page deployment | ||
permissions: | ||
id-token: write | ||
pages: write | ||
|
||
env: | ||
# Name of module and id separated by a slash | ||
INSTANCE: Writerside/roborazzi-docs | ||
ARTIFACT: web-roborazzi-docs-all.zip | ||
# Writerside docker image version | ||
DOCKER_VERSION: 232.10275 | ||
# Add the variable below to upload Algolia indexes | ||
# ALGOLIA_ARTIFACT: algolia-indexes-roborazzi-docs.zip | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Writerside docs using Docker | ||
uses: JetBrains/writerside-github-action@v4 | ||
with: | ||
instance: ${{ env.INSTANCE }} | ||
artifact: ${{ env.ARTIFACT }} | ||
docker-version: ${{ env.DOCKER_VERSION }} | ||
|
||
- name: Upload documentation | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: docs | ||
path: | | ||
artifacts/${{ env.ARTIFACT }} | ||
artifacts/report.json | ||
retention-days: 7 | ||
|
||
# Add the step below to upload Algolia indexes | ||
# - name: Upload algolia-indexes | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: algolia-indexes | ||
# path: artifacts/${{ env.ALGOLIA_ARTIFACT }} | ||
# retention-days: 7 | ||
|
||
# Add the job below and artifacts/report.json on Upload documentation step above if you want to fail the build when documentation contains errors | ||
test: | ||
# Requires build job results | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: docs | ||
path: artifacts | ||
|
||
- name: Test documentation | ||
uses: JetBrains/writerside-checker-action@v1 | ||
with: | ||
instance: ${{ env.INSTANCE }} | ||
|
||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
# Requires the build job results | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: docs | ||
|
||
- name: Unzip artifact | ||
uses: montudor/action-zip@v1 | ||
with: | ||
args: unzip -qq ${{ env.ARTIFACT }} -d dir | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v2 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: dir | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE categories | ||
SYSTEM "https://resources.jetbrains.com/writerside/1.0/categories.dtd"> | ||
<categories> | ||
<category id="wrs" name="Writerside documentation" order="1"/> | ||
</categories> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<buildprofiles xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<variables> | ||
<enable-browser-edits>true</enable-browser-edits> | ||
<header-logo>https://raw.githubusercontent.com/takahirom/roborazzi/main/.idea/icon.svg</header-logo> | ||
<primary-color>blueberry</primary-color> | ||
<browser-edits-url>https://github.com/takahirom/roborazzi/edit/main/docs/</browser-edits-url> | ||
</variables> | ||
</buildprofiles> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE instance-profile | ||
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd"> | ||
|
||
<instance-profile id="roborazzi-docs" | ||
name="roborazzi-docs" | ||
start-page="top.md"> | ||
|
||
<toc-element topic="top.md"/> | ||
<toc-element topic="try_it_out.md"/> | ||
<toc-element topic="how_to_use.md"/> | ||
<toc-element topic="faq.md"/> | ||
</instance-profile> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# FAQ | ||
|
||
### Q: How can I run only screenshot tests using Roborazzi? | ||
|
||
**A:** To run only screenshot tests, you can configure your project with the following: | ||
|
||
```groovy | ||
android { | ||
testOptions { | ||
unitTests { | ||
all { | ||
// -Pscreenshot to filter screenshot tests | ||
it.useJUnit { | ||
if (project.hasProperty("screenshot")) { | ||
includeCategories("io.github.takahirom.roborazzi.testing.category.ScreenshotTests") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Include the `-Pscreenshot` property, and only the screenshot tests will be run. | ||
|
||
Note: This feature is not provided in the Roborazzi library itself, to keep it simple and utilize JUnit's built-in features for test filtering. | ||
|
||
You can also annotate your tests like this: | ||
|
||
```kotlin | ||
/** | ||
* You can filter ScreenshotTests using -Pscreenshot parameter | ||
*/ | ||
interface ScreenshotTests | ||
|
||
@Test | ||
@Category(ScreenshotTests::class) | ||
fun checkLaunchShot() { | ||
onRoot().captureRoboImage(roborazziOptions = roborazziOptions) | ||
} | ||
``` | ||
|
||
This allows you to create a category of screenshot tests and filter them using the `-Pscreenshot` property, thus making it easier to run only those specific tests. | ||
|
||
### Q: How can I debug screenshot tests in Android Studio? | ||
### Q: How can I execute screenshot tests using Android Studio's Run button? | ||
|
||
A: To execute screenshot tests using Android Studio's Run button, configure your project as follows: | ||
|
||
`gradle.properties` | ||
|
||
```groovy | ||
roborazzi.test.record=true | ||
``` | ||
|
||
After that, you can execute screenshot tests using either Android Studio's Run or Debug button as you normally would. | ||
|
||
### Q: My screenshot tests are not capturing images. What could be the issue? | ||
|
||
**A:** If your screenshot tests are not capturing images, there may be several patterns that are causing this issue. Please follow these troubleshooting steps: | ||
|
||
- **Enable Debugging**: Set `ROBORAZZI_DEBUG = true` to see logs. | ||
- **Check Plugin**: Ensure that the plugin is properly applied. | ||
- **Run Task**: Verify that the `recordRoborazziDebug` task is running. | ||
- **Call Method**: Confirm that `captureRoboImage()` is being called. | ||
|
||
By following these steps, you should be able to identify and resolve the issue causing the screenshot tests to not capture images. | ||
|
||
### Q: I'm seeing an optimization warning related to Java lambdas in Gradle. What can I do? | ||
|
||
**A:** This warning may occur with Gradle 7.5. Upgrade to Gradle 7.6.2 to resolve this issue. Change the distribution URL in `gradle-wrapper.properties`: | ||
|
||
```diff | ||
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip | ||
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip | ||
``` | ||
|
||
### Q: Can I run Roborazzi with Bazel? | ||
|
||
**A:** As of now, there is no direct support for running Roborazzi with Bazel. However, it is possible to do so. Please refer to the following comment for more details: | ||
[Roborazzi Bazel Support Comment](https://github.com/takahirom/roborazzi/issues/63#issuecomment-1531990825) | ||
|
||
### Q: My tests are being skipped or, conversely, are being run when they should be skipped. How can I handle caching to address this? | ||
|
||
**A:** The behavior you are experiencing may be related to caching issues. Although it's | ||
experimental, you can set the `outputDir` parameter in your `build.gradle` file to handle caching | ||
and improve the stability of your tests. This parameter allows you to specify the output directory | ||
for your screenshots, which can help in managing the cache. Here is how you can set it up: | ||
If you use the default output directory(module/build/outputs/roborazzi), specifying the `outputDir` | ||
parameter is not necessary. For more reference, you can check | ||
out [the issue](https://github.com/takahirom/roborazzi/issues/193#issuecomment-1782073746). | ||
|
||
```gradle | ||
roborazzi { | ||
outputDir = "src/your/screenshot/folder" | ||
} | ||
``` |
Oops, something went wrong.