Skip to content

Commit

Permalink
Merge pull request #65 from picimako/180
Browse files Browse the repository at this point in the history
v1.8.0
  • Loading branch information
picimako authored Jun 3, 2024
2 parents 3fe4ab6 + 5d8e6d9 commit 619fcfb
Show file tree
Hide file tree
Showing 53 changed files with 405 additions and 421 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

## [Unreleased]

## [1.7.0]
## [1.8.0]
### Changed
- New supported IDE version range: 2023.1.6-2024.2-EAP.
- Plugin configuration and dependency updates.

## [1.7.0]
### Changed
- Temporarily disable quick documentations for Terra Wdio functions in Terra spec files.

Expand Down
5 changes: 2 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ kotlin {
dependencies {
//https://kotlinlang.org/docs/reflection.html#jvm-dependency
implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.0")
//testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22")

//Testing
testImplementation("junit:junit:4.13.2")
testImplementation("org.assertj:assertj-core:3.25.2")
testImplementation("org.mockito:mockito-core:5.10.0")
testImplementation("org.assertj:assertj-core:3.26.0")
testImplementation("org.mockito:mockito-core:5.12.0")
testImplementation("org.mockito:mockito-inline:5.2.0") //for using static method mocking
}

Expand Down
13 changes: 5 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ pluginGroup = com.picimako.terra
pluginName = Terra Support
pluginRepositoryUrl = https://github.com/picimako/terra-support
# SemVer format -> https://semver.org
pluginVersion = 1.7.0
pluginVersion = 1.8.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 223.8836.41
pluginUntilBuild = 241.*
pluginSinceBuild = 231.9414.13
pluginUntilBuild = 242.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IU
platformVersion = 2022.3.3
platformVersion = 2023.1.6

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = java,JavaScript

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.5
gradleVersion = 8.7

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false
Expand All @@ -29,6 +29,3 @@ org.gradle.configuration-cache = true

# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = true

# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
systemProp.org.gradle.unsafe.kotlin.assignment = true
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# plugins
kotlin = "1.9.0"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.17.2"
lombok = "8.3"
gradleIntelliJPlugin = "1.17.3"
lombok = "8.6"

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,6 @@ private String buildDocumentation(String viewport) {
+ CONTENT_END;
}

private static final class Breakpoint {
private final String minimumValue;
private final String mediaQuery;
private final String description;

Breakpoint(String minimumValue, String mediaQuery, String description) {
this.minimumValue = minimumValue;
this.mediaQuery = mediaQuery;
this.description = description;
}
private record Breakpoint(String minimumValue, String mediaQuery, String description) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public boolean isModified() {
}

@Override
public void apply() throws ConfigurationException {
public void apply() {
var settings = TerraApplicationState.getInstance();
settings.wdioRootPaths = component.getWdioRootPaths();
settings.showConfirmationBeforeScreenshotDeletion = component.isScreenshotDeletionConfirmationCheckboxSelected();
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/picimako/terra/wdio/TerraWdioFolders.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.FilenameIndex;
import com.intellij.psi.search.GlobalSearchScope;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
Expand Down Expand Up @@ -46,6 +47,7 @@ public final class TerraWdioFolders {
private static final String LATEST_RELATIVE_PATH = "/" + SNAPSHOTS + "/" + LATEST;

//TODO: this might be problematic with multiple projects having different wdio paths
@Setter
private static String wdioTestRootPath;

/**
Expand Down Expand Up @@ -358,10 +360,6 @@ public static String diffPath() {
return wdioTestRootPath + DIFF_RELATIVE_PATH;
}

public static void setWdioTestRootPath(String path) {
wdioTestRootPath = path;
}

@TestOnly
public static String getWdioTestRootPath() {
return wdioTestRootPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class NestedTerraDescribeHelpersNotAllowedInspection extends TerraWdioIns
return new JSElementVisitor() {
@SuppressWarnings("ConstantConditions")
@Override
public void visitJSExpressionStatement(JSExpressionStatement node) {
public void visitJSExpressionStatement(@NotNull JSExpressionStatement node) {
super.visitJSExpressionStatement(node);

if (isNestedTerraDescribeHelper(node)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ public void addPropertyChangeListener(@NotNull PropertyChangeListener listener)
public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) {
}

@Override
public @Nullable FileEditorLocation getCurrentLocation() {
return null;
}

@Override
public void dispose() {
var imageEditorCache = ImageEditorCache.getInstance(project);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class ReplaceTerraItWithTerraValidatesInspection extends TerraWdioInspect

return new JSElementVisitor() {
@Override
public void visitJSExpressionStatement(JSExpressionStatement node) {
public void visitJSExpressionStatement(@NotNull JSExpressionStatement node) {
super.visitJSExpressionStatement(node);

if (isInWdioSpecFile(node) && isTerraIt(node) && node.getExpression() instanceof JSCallExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@

import java.util.Arrays;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.psi.PsiBinaryFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.util.PsiTreeUtil;
import org.intellij.images.fileTypes.impl.ImageFileType;
import org.jetbrains.annotations.NotNull;

import com.picimako.terra.resources.TerraBundle;
import com.picimako.terra.wdio.ProblemDialogs;
import com.picimako.terra.wdio.ToScreenshotUsageNavigator;

Expand All @@ -43,10 +42,6 @@
*/
public class NavigateToScreenshotUsageProjectViewAction extends AnAction {

public NavigateToScreenshotUsageProjectViewAction() {
super(TerraBundle.message("terra.wdio.project.view.screenshot.navigate.to.usage"), null, ImageFileType.INSTANCE.getIcon());
}

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
var selectedScreenshot = e.getData(CommonDataKeys.PSI_FILE);
Expand Down Expand Up @@ -80,4 +75,9 @@ public void update(@NotNull AnActionEvent e) {
&& isInSnapshotsDirectory(e.getData(CommonDataKeys.VIRTUAL_FILE))
&& e.getData(CommonDataKeys.PSI_FILE) instanceof PsiBinaryFile);
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class DuplicateScreenshotNameInspection extends TerraWdioInspectionBase {

return new JSElementVisitor() {
@Override
public void visitJSFile(JSFile file) {
public void visitJSFile(@NotNull JSFile file) {
final var duplicateNames = new HashMap<String, JSExpression>();
PsiTreeUtil.processElements(session.getFile(), JSLiteralExpression.class, element -> {
//The check and reporting is applied only to Terra.validates.element and Terra.validates.screenshot calls,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class GlobalTerraSelectorInspection extends TerraWdioInspectionBase {

return new JSElementVisitor() {
@Override
public void visitJSExpressionStatement(JSExpressionStatement node) {
public void visitJSExpressionStatement(@NotNull JSExpressionStatement node) {
super.visitJSExpressionStatement(node);

if (isTerraElementOrScreenshotValidation(node)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class InvalidTerraValidationPropertiesInspection extends TerraWdioInspect

return new JSElementVisitor() {
@Override
public void visitJSExpressionStatement(JSExpressionStatement node) {
public void visitJSExpressionStatement(@NotNull JSExpressionStatement node) {
super.visitJSExpressionStatement(node);

TerraPropertiesProvider properties = TerraResourceManager.getInstance(node.getProject()).screenshotValidationProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class MissingScreenshotInspection extends TerraWdioInspectionBase {

return new JSElementVisitor() {
@Override
public void visitJSExpressionStatement(JSExpressionStatement node) {
public void visitJSExpressionStatement(@NotNull JSExpressionStatement node) {
super.visitJSExpressionStatement(node);
if (!isTerraElementOrScreenshotValidation(node)) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class MissingScreenshotNameInspection extends TerraWdioInspectionBase {

return new JSElementVisitor() {
@Override
public void visitJSExpressionStatement(JSExpressionStatement node) {
public void visitJSExpressionStatement(@NotNull JSExpressionStatement node) {
if (isNonTerraItElementOrScreenshotValidation(node)) {
String nameArgument = getFirstArgumentAsString(getArgumentListOf(node));
if (nameArgument == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public JComponent createOptionsPanel() {

return new JSElementVisitor() {
@Override
public void visitJSExpressionStatement(JSExpressionStatement node) {
public void visitJSExpressionStatement(@NotNull JSExpressionStatement node) {
super.visitJSExpressionStatement(node);
if (!isTerraElementOrScreenshotValidation(node)) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class TerraElementValidationIsPreferredOverScreenshotInspection extends T
return new JSElementVisitor() {
@SuppressWarnings("ConstantConditions")
@Override
public void visitJSExpressionStatement(JSExpressionStatement node) {
public void visitJSExpressionStatement(@NotNull JSExpressionStatement node) {
super.visitJSExpressionStatement(node);

if (isTerraItMatchesScreenshot(node)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.ui.TreeUIHelper;
import com.intellij.ui.components.JBScrollPane;
import lombok.Getter;

import com.picimako.terra.wdio.toolwindow.event.KeyboardListeningPopupMenuInvoker;
import com.picimako.terra.wdio.toolwindow.event.MouseListeningPopupMenuInvoker;
Expand All @@ -36,6 +37,7 @@ public class TerraWdioScreenshotsPanel extends JPanel {

private static final String SCREENSHOT_ACTIONS_GROUP = "terra.wdio.toolwindow.ScreenshotActionsGroup";
private final transient Project project;
@Getter
private TerraWdioTree tree;

public TerraWdioScreenshotsPanel(Project project) {
Expand All @@ -55,10 +57,6 @@ private void buildGUI() {
TreeUIHelper.getInstance().installTreeSpeedSearch(tree);
}

public TerraWdioTree getTree() {
return tree;
}

/**
* Registers actions and listeners to the tool window tree.
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.picimako.terra.wdio.toolwindow;

import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.Project;
Expand Down Expand Up @@ -37,4 +38,9 @@ public void setSelected(@NotNull AnActionEvent e, boolean state) {
ScreenshotStatisticsProjectService.getInstance(e.getProject()).isShowStatistics = state;
updateUICallback.run();
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package com.picimako.terra.wdio.toolwindow.action;

import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformCoreDataKeys;
Expand All @@ -19,10 +20,6 @@
*/
public abstract class AbstractTerraWdioToolWindowAction extends AnAction {

protected AbstractTerraWdioToolWindowAction(String text) {
super(text);
}

public static AbstractTerraWdioToolWindowAction getAction(String actionId) {
return (AbstractTerraWdioToolWindowAction) ActionManager.getInstance().getAction(actionId);
}
Expand Down Expand Up @@ -75,6 +72,11 @@ public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(meetsPreconditions(getWdioTreeFrom(e)));
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

//Helpers

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.Nullable;

import com.picimako.terra.resources.TerraBundle;
import com.picimako.terra.wdio.imagepreview.ReferenceToLatestScreenshotsPreview;
import com.picimako.terra.wdio.toolwindow.node.TerraWdioTree;

Expand All @@ -22,10 +21,6 @@
*/
public class CompareLatestWithReferenceScreenshotsAction extends AbstractTerraWdioToolWindowAction {

public CompareLatestWithReferenceScreenshotsAction() {
super(TerraBundle.toolWindow("compare.latests.with.references"));
}

/**
* Opens a {@link com.picimako.terra.wdio.imagepreview.ReferenceToLatestScreenshotsPreview} for the
* selected screenshot.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
*/
public class DeleteScreenshotsAction extends AbstractTerraWdioToolWindowAction {

public DeleteScreenshotsAction() {
super(TerraBundle.toolWindow("delete.screenshots"));
}

/**
* Handles the action when the user clicks the Delete Screenshots menu item.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.intellij.psi.PsiManager;
import org.jetbrains.annotations.Nullable;

import com.picimako.terra.resources.TerraBundle;
import com.picimako.terra.wdio.ToScreenshotUsageNavigator;
import com.picimako.terra.wdio.toolwindow.node.TerraWdioTree;
import com.picimako.terra.wdio.toolwindow.node.TreeSpecNode;
Expand All @@ -32,15 +31,6 @@ public class NavigateToScreenshotUsageAction extends AbstractTerraWdioToolWindow

private ToScreenshotUsageNavigator navigator;

/**
* Creates a NavigateToScreenshotUsageAction instance.
* <p>
* Also registers the common Go to Declaration shortcut key for this action.
*/
public NavigateToScreenshotUsageAction() {
super(TerraBundle.toolWindow("screenshot.navigate.to.usage"));
}

/**
* Handles the action when the user clicks the Navigate to Usage menu item.
* <p>
Expand Down
Loading

0 comments on commit 619fcfb

Please sign in to comment.