diff --git a/.github/workflows/uitests.yml b/.github/workflows/uitests.yml index 580447f58..1e3cb8e49 100644 --- a/.github/workflows/uitests.yml +++ b/.github/workflows/uitests.yml @@ -69,17 +69,16 @@ jobs: ./gradlew test -PexcludeTests="**/reference/**,**/linemarker/**,**/inspections/**,**/completion/**,**/actions/**" # Uncomment if investigation is needed: - +# # - name: Capture Test Artifacts on Failure -# if: failure() && matrix.os == 'windows-latest' +# if: failure() && matrix.os == 'ubuntu-latest' # run: tar -cvzf video.tgz ./video # shell: bash # # - name: Upload Test Video Artifact -# if: failure() && matrix.os == 'windows-latest' +# if: failure() && matrix.os == 'ubuntu-latest' # uses: actions/upload-artifact@v4 # with: # name: latest-test-video # path: video.tgz # overwrite: true - diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f3dd4858..cbb5bac18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0). +## 2025.1.1 + +### Fixed + +- The themes select is empty [#2527](https://github.com/magento/magento2-phpstorm-plugin/pull/2527) +- PS.MarkRootGroup isn't registered so the action won't be added to it [#2527](https://github.com/magento/magento2-phpstorm-plugin/pull/2527) + ## 2025.1.0 ### Added diff --git a/README.md b/README.md index 85a5ae4ef..288c9d783 100644 --- a/README.md +++ b/README.md @@ -12,36 +12,8 @@ PhpStorm IDE Plugin for a better Magento 2 development workflow. - - - Version 2025.0.0 - Contributors - - - - - - Yevhen Zvieriev -
- Yevhen Zvieriev -
- - - - Mykola Silin -
- Mykola Silin -
- - - - Vitalii Boiko -
- Vitalii Boiko -
- - diff --git a/gradle.properties b/gradle.properties index 934860abb..c14a88efe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ pluginGroup = com.magento.idea.magento2plugin pluginName = Magento PhpStorm pluginRepositoryUrl = https://github.com/magento/magento2-phpstorm-plugin -pluginVersion = 2025.1.0 +pluginVersion = 2025.1.1 pluginSinceBuild = 243.3 pluginUntilBuild = 258.* platformType = PS diff --git a/src/main/java/com/magento/idea/magento2plugin/magento/packages/Package.java b/src/main/java/com/magento/idea/magento2plugin/magento/packages/Package.java index 9ed340294..d031f591f 100644 --- a/src/main/java/com/magento/idea/magento2plugin/magento/packages/Package.java +++ b/src/main/java/com/magento/idea/magento2plugin/magento/packages/Package.java @@ -8,6 +8,7 @@ public class Package { //NOPMD public static final String V_FILE_SEPARATOR = "/"; public static String packagesRoot = "app/code"; + public static String packagesDesignRoot = "app/design"; public static String libWebRoot = "lib/web"; public static String frameworkRootComposer = "vendor/magento/framework"; public static String frameworkRootGit = "lib/internal/Magento/Framework"; diff --git a/src/main/java/com/magento/idea/magento2plugin/util/magento/IsFileInEditableModuleUtil.java b/src/main/java/com/magento/idea/magento2plugin/util/magento/IsFileInEditableModuleUtil.java index a9f789fef..bdd996976 100644 --- a/src/main/java/com/magento/idea/magento2plugin/util/magento/IsFileInEditableModuleUtil.java +++ b/src/main/java/com/magento/idea/magento2plugin/util/magento/IsFileInEditableModuleUtil.java @@ -9,6 +9,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.magento.idea.magento2plugin.project.Settings; +import java.util.ArrayList; import java.util.List; public final class IsFileInEditableModuleUtil { @@ -29,37 +30,33 @@ public static boolean execute(final PsiFile file) { } /** - * Validates if a given virtual file is located within editable paths defined by Magento project structure. + * Validates if a given virtual file is located within editable paths. * * @param project the current project containing the virtual file * @param virtualFile the file to check against editable module directories * @return true if the file is in an editable module directory, false otherwise */ public static boolean execute(final Project project, final VirtualFile virtualFile) { - final Settings settings = Settings.getInstance(project); - List magentoToFolders = settings.getMagentoFolders(); - final String magentoPathUrl = MagentoPathUrlUtil.execute(project); - if (magentoPathUrl != null) { - if (magentoToFolders == null) { - magentoToFolders = List.of( - magentoPathUrl - ); - } else { - magentoToFolders.add( - magentoPathUrl - ); - } + final String magentoRootPath = MagentoPathUrlUtil.execute(project); + if (magentoRootPath == null) { + return false; } + final Settings settings = Settings.getInstance(project); + List editablePaths = settings.getMagentoFolders(); + if (editablePaths == null) { + editablePaths = new ArrayList<>(); + } - - if (magentoToFolders == null) { - return false; + editablePaths.add(magentoRootPath); + final String magentoDesignPath = MagentoPathUrlUtil.getDesignPath(project); + if (magentoDesignPath != null) { + editablePaths.add(magentoDesignPath); } - final String filePath = virtualFile.getUrl(); - for (final String editablePath : magentoToFolders) { - if (normalizeUrl(filePath).startsWith(normalizeUrl(editablePath))) { + final String currentFilePath = virtualFile.getUrl(); + for (final String editablePath : editablePaths) { + if (normalizeUrl(currentFilePath).startsWith(normalizeUrl(editablePath))) { return true; } } diff --git a/src/main/java/com/magento/idea/magento2plugin/util/magento/MagentoPathUrlUtil.java b/src/main/java/com/magento/idea/magento2plugin/util/magento/MagentoPathUrlUtil.java index bc808c2c2..41327833e 100644 --- a/src/main/java/com/magento/idea/magento2plugin/util/magento/MagentoPathUrlUtil.java +++ b/src/main/java/com/magento/idea/magento2plugin/util/magento/MagentoPathUrlUtil.java @@ -11,15 +11,22 @@ import com.magento.idea.magento2plugin.magento.packages.Package; import com.magento.idea.magento2plugin.project.Settings; -public class MagentoPathUrlUtil { +public final class MagentoPathUrlUtil { + + /** + * Private constructor to prevent instantiation of utility class. + */ + private MagentoPathUrlUtil() { + } + /** * Constructs a file URL for the Magento packages root, based on the project settings. * * @param project the project instance * @return the constructed file URL */ - public static String execute(Project project) { - String magentoPath = Settings.getMagentoPath(project); + public static String execute(final Project project) { + final String magentoPath = Settings.getMagentoPath(project); if (magentoPath != null) { return VirtualFileManager.constructUrl( "file", @@ -31,4 +38,24 @@ public static String execute(Project project) { return null; } + + /** + * Constructs a file URL for the Magento packages root, based on the project settings. + * + * @param project the project instance + * @return the constructed file URL + */ + public static String getDesignPath(final Project project) { + final String magentoPath = Settings.getMagentoPath(project); + if (magentoPath != null) { + return VirtualFileManager.constructUrl( + "file", + magentoPath + + File.separator + + Package.packagesDesignRoot + ); + } + + return null; + } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index ac35da6e7..2011ea5f0 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -7,7 +7,7 @@ com.magento.idea.magento2plugin Magento PhpStorm - 2025.1.0 + 2025.1.1 Magento Inc. - + - + diff --git a/src/test/kotlin/com/magento/idea/magento2plugin/pages/IdeaFrame.kt b/src/test/kotlin/com/magento/idea/magento2plugin/pages/IdeaFrame.kt index 6a14a83d6..adf3af637 100644 --- a/src/test/kotlin/com/magento/idea/magento2plugin/pages/IdeaFrame.kt +++ b/src/test/kotlin/com/magento/idea/magento2plugin/pages/IdeaFrame.kt @@ -9,6 +9,9 @@ import com.intellij.remoterobot.RemoteRobot import com.intellij.remoterobot.data.RemoteComponent import com.intellij.remoterobot.fixtures.* import com.intellij.remoterobot.search.locators.byXpath +import com.intellij.remoterobot.utils.keyboard +import java.awt.event.KeyEvent.VK_ALT +import java.awt.event.KeyEvent.VK_1 import java.time.Duration @@ -25,7 +28,14 @@ class IdeaFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) : get() = actionLink(byXpath("//div[@accessiblename='Enable Magento support for this project?' and @class='JEditorPane']")) val projectViewTree - get() = find(byXpath("//div[@class='ProjectViewTree']")) + get() = try { + find(byXpath("//div[@class='ProjectViewTree']")) + } catch (e: Exception) { + keyboard { + hotKey(VK_ALT, VK_1) + } + find(byXpath("//div[@class='ProjectViewTree']")) + } fun isProjectViewVisible(): Boolean { return try { diff --git a/src/test/kotlin/com/magento/idea/magento2plugin/steps/SharedSteps.kt b/src/test/kotlin/com/magento/idea/magento2plugin/steps/SharedSteps.kt index 414109ffc..3c7286ed0 100644 --- a/src/test/kotlin/com/magento/idea/magento2plugin/steps/SharedSteps.kt +++ b/src/test/kotlin/com/magento/idea/magento2plugin/steps/SharedSteps.kt @@ -115,6 +115,7 @@ class SharedSteps(private val remoteRobot: RemoteRobot) { DialogFixture::class.java, byXpath("//div[@class='MyDialog']") ) dialog.button("Close").click() + closeBrowser() try { Thread.sleep(10000) @@ -122,9 +123,8 @@ class SharedSteps(private val remoteRobot: RemoteRobot) { Thread.currentThread().interrupt() throw RuntimeException(e) } - - closeBrowser() } else { + closeBrowser() val dialog = remoteRobot.find( DialogFixture::class.java, byXpath("//div[@class='MyDialog']") ) @@ -196,6 +196,7 @@ class SharedSteps(private val remoteRobot: RemoteRobot) { } else if (os.contains("nix") || os.contains("nux")) { // For Linux-based systems: Kill typical browser processes Runtime.getRuntime().exec("killall -9 firefox") + Runtime.getRuntime().exec("killall -9 chrome") } } catch (e: IOException) { e.printStackTrace()