Skip to content

Commit

Permalink
Merge pull request #61 from picimako/140
Browse files Browse the repository at this point in the history
v1.4.0
  • Loading branch information
picimako authored Jul 5, 2023
2 parents 3e2f8f2 + d1e4cae commit 31ef430
Show file tree
Hide file tree
Showing 36 changed files with 276 additions and 295 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## [Unreleased]

## [1.4.0]

### Added
- Offer this plugin when a project has dependency on the `@cerner/terra-functional-testing` npm package.

### Changed
- Spec and screenshot nodes are now marked with a dedicated diff icon, instead of bold text, when they have a diff image. This was necessary because the font setting is not being applied by the IDE.
- Updated a few URL for the quick documentation popups.
- Plugin configuration updates.

## [1.3.1]

### Changed
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ coding issues, including but not limited to:
- Additional navigation options and visual clues for screenshot validation.
- Added and extended Quick Documentation popup contents.

The part that focuses on the [Terra UI components](https://engineering.cerner.com/terra-ui/home/terra-ui/index") adds
The part that focuses on the [Terra UI components](https://engineering.cerner.com/terra-ui/home/terra-ui/index) adds
external documentation URLs to UI component React tags for easier navigation to related documentation.
<!-- Plugin description end -->

Expand All @@ -27,7 +27,7 @@ The followings are a summary of the features incorporated into this plugin:
can be triggered via Ctrl+Q (on Windows) or F1 (on Mac). It shows a popup with some rendered information about the element in question.
- **References**: The feature called References provides a way to navigate from a reference of an element to the definition of it,
just like when you jump to the definition of a function from the usage of that.
- **Tool Window**: There is a [Tool Window called Terra Wdio](/docs/terra_wdio_tool_window.md) available to work with Terra screenshots.
- **Tool Window**: There is a [Tool Window called Terra Wdio](docs/terra_wdio_tool_window.md) available to work with Terra screenshots.
- **Inlay Hints**: These are small labels injected into the code, that provide extra (often otherwise invisible) information about the code.
The [current Inlay Hints](docs/terra_helpers.md#inlay-hints) include displaying screenshot names and global Terra CSS selectors.

Expand All @@ -46,7 +46,7 @@ To get started with the development of this project you can find some details in

## Cerner Terra resources

- Terra Toolkit: [GitHub repository](https://github.com/cerner/terra-toolkit-boneyard), [Documentation](https://github.com/cerner/terra-toolkit-boneyard/blob/main/docs/Wdio_Utility.md)
- Terra Toolkit: [GitHub repository](https://github.com/cerner/terra-toolkit)
- Terra Functional Testing: [GitHub repository](https://github.com/cerner/terra-toolkit/tree/main/packages/terra-functional-testing), [Changelog](https://github.com/cerner/terra-toolkit/blob/main/packages/terra-functional-testing/CHANGELOG.md),
[Documentation](https://engineering.cerner.com/terra-ui/dev_tools/cerner-terra-toolkit-docs/terra-functional-testing/about)

Expand Down
95 changes: 40 additions & 55 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun properties(key: String) = project.findProperty(key).toString()
fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)

plugins {
// Java support
id("java")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.8.0"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij") version "1.13.3"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "2.0.0"
//Lombok
id("io.freefair.lombok") version "6.5.0.3"
id("java") // Java support
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.lombok) // Lombok
}

group = properties("pluginGroup")
version = properties("pluginVersion")
group = properties("pluginGroup").get()
version = properties("pluginVersion").get()

// Configure project's dependencies
repositories {
mavenCentral()
}

// Set the JVM language level used to compile sources and generate files - Java 11 is required since 2020.3
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain(11)
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
//https://kotlinlang.org/docs/reflection.html#jvm-dependency
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.0")
//testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.22")
//testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22")

//Testing
testImplementation("junit:junit:4.13.2")
Expand All @@ -44,60 +40,49 @@ dependencies {

// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
pluginName = properties("pluginName")
version = properties("platformVersion")
type = properties("platformType")

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
}

tasks {
// Set the JVM compatibility versions
properties("javaVersion").let {
withType<JavaCompile> {
sourceCompatibility = it
targetCompatibility = it
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = it
//https://kotlinlang.org/docs/whatsnew15.html#deprecation-of-jvmdefault-and-old-xjvm-default-modes
//https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-default/
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all")
}
}

wrapper {
gradleVersion = properties("gradleVersion")
gradleVersion = properties("gradleVersion").get()
}

patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription.set(
projectDir.resolve("README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end))
}.joinToString("\n").run { markdownToHTML(this) }
)
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with (it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes.set(provider {
changeNotes = properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
getOrNull(properties("pluginVersion")) ?: getLatest(),
Changelog.OutputType.HTML,
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
})
}
}

test {
Expand All @@ -109,6 +94,6 @@ tasks {
}

// runPluginVerifier {
// ideVersions.set(listOf(//"IU-2022.1", "IU-2022.2", "IU-2022.3", "IU-2023.1", "IU-2023.2"))
// ideVersions.set(listOf("IU-2023.2"))
// }
}
Binary file modified docs/assets/terra_diff_preview.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/terra_reference_latest_preview.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/terra_wdio_tool_window.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/terra_wdio_tool_window_highlighted_nodes.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/terra_wdio_tool_window_screenshot_actions_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/terra_wdio_tool_window_unused_screenshots.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/terra_wdio_tool_window_without_stats.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions docs/terra_helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ It handles both terra-toolkit and terra-functional-testing specific properties b

**Valid properties**

| Helpers | terra-toolkit | terra-functional-testing |
|---|---|---|
| `Terra.it.matchesScreenshot`/`validates.screenshot` | `misMatchTolerance`, `selector`, `viewports` | `mismatchTolerance`, `selector` |
| `Terra.it.validatesElement`/`validates.element` | `misMatchTolerance`, `selector`, `axeRules` | `mismatchTolerance`, `selector`, `rules` |
| `Terra.it.isAccessible`/`validates.accessibility` | `axeRules` | `rules` |
| Helpers | terra-toolkit | terra-functional-testing |
|-----------------------------------------------------|----------------------------------------------|------------------------------------------|
| `Terra.it.matchesScreenshot`/`validates.screenshot` | `misMatchTolerance`, `selector`, `viewports` | `mismatchTolerance`, `selector` |
| `Terra.it.validatesElement`/`validates.element` | `misMatchTolerance`, `selector`, `axeRules` | `mismatchTolerance`, `selector`, `rules` |
| `Terra.it.isAccessible`/`validates.accessibility` | `axeRules` | `rules` |

### Convert Terra.it helpers to Terra.validates

Expand All @@ -153,6 +153,7 @@ to their Terra.validates forms.
This inspection reports usages of `Terra.it` helpers, and provides various quick fixes to replace them.

#### Without a preceding before hook

In its simplest form, if there is no `before` hook **directly** before the particular Terra.it helper, there is only one quick fix suggested, called
![replate_terra_it_quick_fix_simple](assets/replate_terra_it_quick_fix_simple.png). The conversion would be as follows:

Expand Down
Loading

0 comments on commit 31ef430

Please sign in to comment.