Skip to content
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

Add settings panel for configuring Roborazzi tasks explanation #537

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,11 @@ android {
It is discussed in [this issue](https://github.com/takahirom/roborazzi/issues/272).
Additionally, it might be worth trying to run your tests with VisualVM to monitor memory usage and identify potential leaks.

### Q: Roborazzi's Gradle task is not displayed.

**A:** It is discussed in [this issue](https://github.com/takahirom/roborazzi/issues/493).
To enable the display of Roborazzi tasks, please enable ***Configure all Gradle tasks during Gradle Sync (this can make Gradle Sync slower)*** in the settings.
<img src="/docs/images/roborazzi_gradle_task_setting.png" width="800" />
</div>

### LICENSE
Expand Down
Binary file added docs/images/roborazzi_gradle_task_setting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/topics/ai_powered_image_assertion.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ val roborazziRule = RoborazziRule(
compareOptions = RoborazziOptions.CompareOptions(
aiAssertionOptions = AiAssertionOptions(
aiAssertionModel = GeminiAiAssertionModel(
// DO NOT HARDCODE your API key in your code.
// This is an example passing API Key through unitTests.all{ environment(key, value) }
apiKey = System.getenv("gemini_api_key") ?: ""
),
)
Expand Down
6 changes: 6 additions & 0 deletions docs/topics/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,9 @@ android {
```
It is discussed in [this issue](https://github.com/takahirom/roborazzi/issues/272).
Additionally, it might be worth trying to run your tests with VisualVM to monitor memory usage and identify potential leaks.

### Q: Roborazzi's Gradle task is not displayed.

**A:** It is discussed in [this issue](https://github.com/takahirom/roborazzi/issues/493).
To enable the display of Roborazzi tasks, please enable ***Configure all Gradle tasks during Gradle Sync (this can make Gradle Sync slower)*** in the settings.
<img src="/docs/images/roborazzi_gradle_task_setting.png" width="800" />
sanao1006 marked this conversation as resolved.
Show resolved Hide resolved
sanao1006 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,44 @@ package com.github.takahirom.roborazzi.idea.settings
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBTextField
import com.intellij.util.ui.FormBuilder
import javax.swing.Box
import javax.swing.BoxLayout
import javax.swing.JComponent
import javax.swing.JLabel
import javax.swing.JPanel
import javax.swing.JSeparator

/**
* Supports creating and managing a [JPanel] for the Settings Dialog.
*/
class AppSettingsComponent {
private val myMainPanel: JPanel
private val imagesPathFromModuleText: JBTextField = JBTextField()

init {
myMainPanel = FormBuilder.createFormBuilder()
.addLabeledComponent(JBLabel("Enter images directory path from module: "), imagesPathFromModuleText, 1, false)
.addComponentFillVertically(JPanel(), 0)
.getPanel()
}
private val myMainPanel: JPanel
private val imagesPathFromModuleText: JBTextField = JBTextField()

private val descriptionText = """
<html>To enable the display of Roborazzi tasks, please enable<br>
<b>Configure all Gradle tasks during Gradle Sync (this can make Gradle Sync slower)</b> in the settings.</html>
sanao1006 marked this conversation as resolved.
Show resolved Hide resolved
""".trimIndent()
sanao1006 marked this conversation as resolved.
Show resolved Hide resolved

init {
myMainPanel = FormBuilder.createFormBuilder()
.addLabeledComponent(
JBLabel("Enter images directory path from module: "),
imagesPathFromModuleText,
1,
false
)
// adjust margin between components
.addComponent(JPanel().apply {
add(Box.createVerticalStrut(8))
})
.addComponent(createNoteSection())
.addComponent(JBLabel(descriptionText))
.addComponentFillVertically(JPanel(), 0)
.panel
}
val panel: JPanel
get() = myMainPanel

val preferredFocusedComponent: JComponent
get() = imagesPathFromModuleText

Expand All @@ -31,4 +49,20 @@ class AppSettingsComponent {
set(newText) {
imagesPathFromModuleText.setText(newText)
}

private fun createNoteSection(): JPanel {
val panel = JPanel()
panel.layout = BoxLayout(panel, BoxLayout.X_AXIS)

val label = JLabel("Note")
val separator = JSeparator().apply {
alignmentY = 0f
}

panel.add(label)
panel.add(Box.createHorizontalStrut(8))
panel.add(separator)

return panel
}
}
Loading