-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Roborazzi Test for Markdown Playground (#1064)
I've added a Roborazzi test for Compose Desktop support (based on the suggestions [here](https://github.com/takahirom/roborazzi?tab=readme-ov-file#experimental-feature-compose-desktop-support)). I also added the necessary dependencies for testing and compose. <!-- ⬆ Put your description above this! ⬆ Please be descriptive and detailed. Please read our [Contributing Guidelines](https://github.com/tinyspeck/foundry/blob/main/.github/CONTRIBUTING.md) and [Code of Conduct](https://slackhq.github.io/code-of-conduct). Don't worry about deleting this, it's not visible in the PR! -->
- Loading branch information
Showing
10 changed files
with
119 additions
and
3 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
gradlew linguist-generated=true | ||
gradlew.bat linguist-generated=true | ||
config/bin/* filter=lfs diff=lfs merge=lfs -text | ||
**/snapshots/**/*.png filter=lfs diff=lfs merge=lfs -text |
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 |
---|---|---|
|
@@ -22,6 +22,11 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
lfs: 'true' | ||
|
||
- name: Check LFS files | ||
uses: actionsdesk/[email protected] | ||
|
||
- name: Export JDK version | ||
shell: bash | ||
|
@@ -54,6 +59,7 @@ jobs: | |
name: reports | ||
path: | | ||
**/build/reports/** | ||
**/src/jvmTest/snapshots/**/*_compare.png | ||
publish-snapshot: | ||
name: 'Publish snapshot (main only)' | ||
|
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,8 @@ | ||
# compares files that match .gitattributes filter to those actually tracked by git-lfs | ||
diff <(git ls-files ':(attr:filter=lfs)' | sort) <(git lfs ls-files -n | sort) >/dev/null | ||
|
||
ret=$? | ||
if [[ $ret -ne 0 ]]; then | ||
echo >&2 "This remote has detected files committed without using Git LFS. Run 'brew install git-lfs && git lfs install' to install it and re-commit your files."; | ||
exit 1; | ||
fi |
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
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
48 changes: 48 additions & 0 deletions
48
...ayground/src/jvmTest/kotlin/foundry/intellij/compose/playground/MarkdownPlaygroundTest.kt
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,48 @@ | ||
/* | ||
* Copyright (C) 2024 Slack Technologies, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package foundry.intellij.compose.playground | ||
|
||
import androidx.compose.ui.test.ExperimentalTestApi | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import androidx.compose.ui.test.onRoot | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.runDesktopComposeUiTest | ||
import com.github.takahirom.roborazzi.DEFAULT_ROBORAZZI_OUTPUT_DIR_PATH | ||
import com.github.takahirom.roborazzi.ExperimentalRoborazziApi | ||
import com.github.takahirom.roborazzi.RoborazziOptions | ||
import io.github.takahirom.roborazzi.captureRoboImage | ||
import kotlin.test.Test | ||
|
||
class MarkdownPlaygroundTest { | ||
@OptIn(ExperimentalTestApi::class, ExperimentalRoborazziApi::class) | ||
@Test | ||
fun snapshot() = runDesktopComposeUiTest { | ||
setContent { MarkdownPlayground() } | ||
|
||
val roborazziOptions = | ||
RoborazziOptions( | ||
recordOptions = RoborazziOptions.RecordOptions(resizeScale = 0.5), | ||
compareOptions = | ||
RoborazziOptions.CompareOptions(outputDirectoryPath = DEFAULT_ROBORAZZI_OUTPUT_DIR_PATH), | ||
) | ||
|
||
onRoot().captureRoboImage(roborazziOptions = roborazziOptions) | ||
|
||
onNodeWithTag(TestTags.DARK_MODE_TOGGLE).performClick() | ||
|
||
onRoot().captureRoboImage(roborazziOptions = roborazziOptions) | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...hots/images/foundry.intellij.compose.playground.MarkdownPlaygroundTest.test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...ts/images/foundry.intellij.compose.playground.MarkdownPlaygroundTest.test_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.