Skip to content

Conversation

AndriiFilippov
Copy link
Collaborator

@AndriiFilippov AndriiFilippov commented Aug 29, 2025

Description

JTAG flash process verification tests

Fixes # (IEP-1627)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • Tests

    • Added an automated UI test validating configuring and flashing an ESP‑IDF project over JTAG via Run Configurations (project creation, target selection, build, launch, console verification).
    • JTAG and serial-port flash tests now run only on Linux with harmless fallbacks on other OSes.
    • Updated default target selection to ESP32-ETHERNET-KIT [usb://1-10].
    • Added a reusable helper to assert console output with a configurable timeout.
  • Chores

    • CI workflow updated to use a newer IDF release reference.

Copy link

coderabbitai bot commented Aug 29, 2025

Walkthrough

Adds a new SWTBot JUnit test for JTAG flashing, a console-verification helper in ProjectTestOperations, a Linux-only gate in an existing serial flash test, and updates CI to check out IDF release v5.4.

Changes

Cohort / File(s) Summary of Changes
JTAG Flash UI Test
tests/com.espressif.idf.ui.test/src/.../cases/project/IDFProjectJTAGFlashTest.java
Adds IDFProjectJTAGFlashTest: SWTBot-based test that creates and builds an ESP-IDF project, edits Run Configurations to set Flash over = JTAG and select a target board, launches the run, and asserts console output indicates successful JTAG flashing. Includes lifecycle methods and a nested Fixture helper.
Project Test Operations
tests/com.espressif.idf.ui.test/src/.../operations/ProjectTestOperations.java
Adds verifyTheConsoleOutput(SWTWorkbenchBot bot, String text) which focuses the Console view and waits for specified text using a timeout fetched from the existing DEFAULT_FLASH_WAIT_PROPERTY.
Serial Flash Test OS Gate
tests/com.espressif.idf.ui.test/src/.../cases/project/NewEspressifIDFProjectFlashProcessTest.java
Wraps the serial-port flash test body with an OS check: runs full test only on Linux (SystemUtils.IS_OS_LINUX); non-Linux executes a trivial passing assertion as a temporary workaround.
CI Workflow update
.github/workflows/ci.yml
Updates the IDF release checkout ref from release/v5.1 to release/v5.4 in the workflow step that clones the IDF release (submodules enabled); other steps unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant J as JUnit Runner
  participant T as IDFProjectJTAGFlashTest
  participant F as Fixture/Helpers
  participant E as Eclipse UI
  participant RC as Run Configurations
  participant C as Console

  J->>T: beforeTestClass()
  T->>F: Load Espressif environment

  J->>T: Test: create/build & configure JTAG flash
  T->>F: Create project "NewProjectJTAGFlashTest"
  F->>E: Complete wizard & open project
  T->>F: Build project via context menu
  F->>E: Trigger build & wait

  T->>F: Edit launch config → set Flash over = JTAG
  F->>RC: Open Run Configurations, modify target board, save

  T->>E: Launch via Run Configurations
  E-->>C: Stream flashing logs
  T->>F: verifyTheConsoleOutput("** Flashing done for partition_table/partition-table.bin")
  F->>C: Wait until text appears (timeout from property)

  J->>T: afterEachTest()
  T->>F: Attempt cleanup (log errors if any)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested reviewers

  • kolipakakondal
  • alirana01

Poem

A rabbit nudged the JTAG wire,
Eclipse hummed, the LEDs inspire.
NewProject built, the console sings,
“Flashing done” — the victory brings.
Hop, hop — carrots for testers' things! 🥕

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch IEP-1627

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (1)

151-155: Be tolerant to alternative dialog titles

Depending on existing targets, clicking Edit may open “Manage Launch Targets” instead of “New ESP Target”. Consider waiting for either to appear to avoid timeouts.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 693c10c and 8e602f9.

📒 Files selected for processing (3)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (1 hunks)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (2 hunks)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/selectors/LaunchBarTargetSelector.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/common/configs/DefaultPropertyFetcher.java (1)
  • DefaultPropertyFetcher (20-90)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (4)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/common/WorkBenchSWTBot.java (1)
  • WorkBenchSWTBot (14-28)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/EnvSetupOperations.java (1)
  • EnvSetupOperations (12-85)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (1)
  • ProjectTestOperations (51-777)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/selectors/LaunchBarTargetSelector.java (1)
  • SuppressWarnings (34-124)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build
  • GitHub Check: build_macos
  • GitHub Check: precommit
🔇 Additional comments (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (1)

55-57: Config key added for flash wait — confirm defaults are sufficient

The new DEFAULT_FLASH_WAIT_PROPERTY is fine. Ensure your default config files define it (ms) for CI stability; otherwise the 120s fallback may be too short on slow runners.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (3)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (3)

59-59: Fix wizard category typo to avoid wizard navigation failure

"EspressIf" will not match the wizard item; use "Espressif".

-        Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
+        Fixture.givenNewEspressifIDFProjectIsSelected("Espressif", "Espressif IDF Project");

131-139: Make board selection robust; avoid machine-specific USB suffix and skip cleanly if board not present

Selecting by exact string with “[usb://…]” is brittle. Match by a stable prefix and gate with Assume so CI without hardware skips instead of failing.

             LaunchBarTargetSelector targetSelector = new LaunchBarTargetSelector(bot);
             targetSelector.clickEdit();
             TestWidgetWaitUtility.waitForDialogToAppear(bot, "New ESP Target", 20000);
             bot.comboBoxWithLabel("IDF Target").setSelection("esp32p4");
             TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
-            bot.comboBoxWithLabel("Board:").setSelection("ESP32-P4 chip (via builtin USB-JTAG) [usb://2-5]");
+            SWTBotCombo boardCombo = bot.comboBoxWithLabel("Board:");
+            String targetPrefix = "ESP32-P4 chip (via builtin USB-JTAG)";
+            for (String item : boardCombo.items()) {
+                if (item.startsWith(targetPrefix)) {
+                    boardCombo.setSelection(item);
+                    break;
+                }
+            }
+            Assume.assumeTrue("ESP32-P4 USB-JTAG board not found", boardCombo.selectionIndex() != -1);
             TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
-            bot.button("Finish").click();
+            bot.waitUntil(widgetIsEnabled(bot.button("Finish")), 10000);
+            bot.button("Finish").click();

Add missing imports:

@@
 import org.junit.Test;
+import org.junit.Assume;
@@
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;

80-80: Replace fixed sleep with deterministic wait

Fixed sleeps cause flakiness; wait for jobs/operations instead.

-            bot.sleep(1000);
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
🧹 Nitpick comments (4)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (4)

123-127: Wait for “OK” to be enabled after changing “Flash over”

Avoid racing the dialog; wait for enablement/state to settle before clicking.

             bot.cTabItem("Main").show();
             bot.cTabItem("Main").setFocus();
             bot.comboBoxWithLabel("Flash over:").setSelection("JTAG");
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
+            bot.waitUntil(widgetIsEnabled(bot.button("OK")), 10000);
             bot.button("OK").click();

114-116: Add a short post-Run wait for background jobs

Clicking Run often schedules jobs; wait to reduce timing flakiness.

             bot.waitUntil(widgetIsEnabled(bot.button("Run")), 5000);
             bot.button("Run").click();
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);

60-60: Use a unique project name to avoid workspace collisions across runs

Helps parallel runs and stale-workspace scenarios.

-        Fixture.givenProjectNameIs("NewProject");
+        Fixture.givenProjectNameIs("JTAGFlash_" + System.currentTimeMillis());

57-57: Nit: Fix casing in test name (“JTAGFlash”)

Improves readability and consistency.

-public void givenNewProjectCreatedWhenSelectJTAGflashWhenBuiltThenCheckFlashedSuccessfully() throws Exception
+public void givenNewProjectCreatedWhenSelectJTAGFlashWhenBuiltThenCheckFlashedSuccessfully() throws Exception
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8e602f9 and a4e52ff.

📒 Files selected for processing (1)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (4)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/common/WorkBenchSWTBot.java (1)
  • WorkBenchSWTBot (14-28)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/EnvSetupOperations.java (1)
  • EnvSetupOperations (12-85)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (1)
  • ProjectTestOperations (51-777)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/selectors/LaunchBarTargetSelector.java (1)
  • SuppressWarnings (34-124)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_macos
  • GitHub Check: build
🔇 Additional comments (2)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (2)

107-116: LGTM: Flash action is now actually triggered

Opening Run Configurations and invoking Run on the project addresses the prior gap.


141-144: Verify on the correct console and assert a stable success token

Ensure you’re on “ESP-IDF Console”, and use a deterministic success message observed on your setup.

         private static void thenVerifyJTAGflashDone() throws Exception
         {
-            ProjectTestOperations.verifyTheConsoleOutput(bot, "** Verify OK **");
+            ProjectTestOperations.viewConsole("ESP-IDF Console", bot);
+            ProjectTestOperations.verifyTheConsoleOutput(bot, "Flash complete"); // Adjust token to your actual success text
         }

Please confirm the exact success text produced by JTAG flashing on your toolchain and replace "Flash complete" accordingly.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
bundles/com.espressif.idf.core/META-INF/MANIFEST.MF (1)

19-21: Remove duplicate Require-Bundle entry for org.eclipse.jgit.

org.eclipse.jgit is listed twice; keep a single occurrence.

  org.eclipse.debug.core;visibility:=reexport,
- org.eclipse.jgit,
  org.eclipse.cdt.jsoncdb.core,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a4e52ff and 626eee5.

📒 Files selected for processing (1)
  • bundles/com.espressif.idf.core/META-INF/MANIFEST.MF (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_macos
  • GitHub Check: build
🔇 Additional comments (1)
bundles/com.espressif.idf.core/META-INF/MANIFEST.MF (1)

59-69: Replace embedded JARs with Orbit OSGi bundles
Embedding third-party JARs on Bundle-ClassPath increases maintenance overhead and risks class-space conflicts. Instead, consume the Orbit-provided OSGi bundles for commons-io, commons-lang3, etc., and declare them via Import-Package or Require-Bundle downstream.

Please verify which of these bundles (if any) are already available in your target p2/Osgi repository and update the MANIFEST accordingly.

@AndriiFilippov AndriiFilippov force-pushed the IEP-1627 branch 2 times, most recently from a9127aa to 4be6156 Compare September 3, 2025 09:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectFlashProcessTest.java (1)

66-81: Gate with assumeTrue and remove no-op else branch

This makes intent explicit, keeps reports honest (skipped vs passed), and simplifies flow.

-        if (SystemUtils.IS_OS_LINUX) //temporary solution until new ESP boards arrive
-        {
+        assumeTrue("Skipping on non-Linux (temporary until new ESP boards arrive)", SystemUtils.IS_OS_LINUX);
         Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
         Fixture.givenProjectNameIs("NewProjectFlashTest");
         Fixture.whenNewProjectIsSelected();
         Fixture.whenTurnOffOpenSerialMonitorAfterFlashingInLaunchConfig();
         Fixture.whenProjectIsBuiltUsingContextMenu();
         Fixture.whenSelectLaunchTargetSerialPort();
         Fixture.whenFlashProject();
         Fixture.thenVerifyFlashDoneSuccessfully();
-    }
-    else
-        {
-            assertTrue(true);
-        }

Optional: move the assumeTrue(...) into @BeforeClass to avoid environment setup on unsupported OS.

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

29-29: Bump to esp-idf release/v5.4: verify compatibility and consider hardening the workflow

  • Please confirm the SWTBot flash assertions (console messages, CLI flags) still match IDF v5.4 to avoid brittle test failures.
  • Optional: parameterize the IDF ref (env/vars) and upgrade actions (checkout v4, setup-python v5) with fetch-depth: 1 and caching to speed runs; also pin by SHA for supply-chain safety.
  • Nit: in “Publish Test Reports”, ensure path: is a scalar (e.g., path: tests/*/*/*/TEST-*.xml or use a block scalar with |) to avoid YAML parsing quirks.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ff04d5a and ac9fa8f.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (1 hunks)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectFlashProcessTest.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: build_macos
🔇 Additional comments (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectFlashProcessTest.java (1)

9-9: LGTM on OS detection import

Using SystemUtils.IS_OS_LINUX is fine and keeps the gate readable.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (2)

142-152: Make board selection resilient; avoid hard-coded USB path suffix

Selecting a fixed item with “[usb://X-Y]” is machine-specific. Choose by a stable prefix instead.

             SWTBotShell shell = bot.shell("New ESP Target");
-            bot.comboBoxWithLabel("Board:").setSelection("ESP32-ETHERNET-KIT [usb://1-10]");
-            TestWidgetWaitUtility.waitForOperationsInProgressToFinishSync(bot);
+            org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo boardCombo = bot.comboBoxWithLabel("Board:");
+            String targetPrefix = "ESP32-ETHERNET-KIT";
+            for (String item : boardCombo.items()) {
+                if (item.startsWith(targetPrefix)) {
+                    boardCombo.setSelection(item);
+                    break;
+                }
+            }
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishSync(bot);
             shell.setFocus();
             bot.button("Finish").click();

67-67: Probable category typo breaks wizard navigation: “EspressIf” → “Espressif”

-            Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
+            Fixture.givenNewEspressifIDFProjectIsSelected("Espressif", "Espressif IDF Project");
🧹 Nitpick comments (7)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (7)

62-80: Skip non-Linux runs instead of passing trivially

Use JUnit assumptions to mark the test as skipped on non-Linux instead of unconditionally passing via assertTrue(true). This improves reporting and avoids masking issues.

Apply:

 @Test
 public void givenNewProjectCreatedWhenSelectJTAGflashWhenBuiltThenCheckFlashedSuccessfully() throws Exception
 {
-    if (SystemUtils.IS_OS_LINUX) //temporary solution until new ESP boards arrive for Windows
-    {
-        Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
-        Fixture.givenProjectNameIs("NewProject");
-        Fixture.whenNewProjectIsSelected();
-        Fixture.whenSelectJTAGflashInLaunchConfig();
-        Fixture.whenSelectLaunchTargetBoard();
-        Fixture.whenProjectIsBuiltUsingContextMenu();
-        Fixture.whenFlashProject();
-        Fixture.thenVerifyJTAGflashDone();
-    }
-    else
-    {
-        assertTrue(true);
-    }
+    org.junit.Assume.assumeTrue("Linux-only until Windows boards arrive", SystemUtils.IS_OS_LINUX);
+    Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
+    Fixture.givenProjectNameIs("NewProject");
+    Fixture.whenNewProjectIsSelected();
+    Fixture.whenSelectJTAGflashInLaunchConfig();
+    Fixture.whenSelectLaunchTargetBoard();
+    Fixture.whenProjectIsBuiltUsingContextMenu();
+    Fixture.whenFlashProject();
+    Fixture.thenVerifyJTAGflashDone();
 }

Also add (outside this hunk):

import org.junit.Assume;

136-140: Add an explicit wait after changing “Flash over” to JTAG

Avoid a potential race by waiting for UI state to settle before clicking OK.

             bot.cTabItem("Main").setFocus();
             bot.comboBoxWithLabel("Flash over:").setSelection("JTAG");
-            bot.button("OK").click();
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
+            bot.waitUntil(widgetIsEnabled(bot.button("OK")), 10000);
+            bot.button("OK").click();

89-95: Replace fixed sleep with deterministic wait

Avoid bot.sleep(1000); wait for background jobs/operations to finish.

             EnvSetupOperations.setupEspressifEnv(bot);
-            bot.sleep(1000);
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
             ProjectTestOperations.deleteAllProjects(bot);

127-127: Increase ‘Run’ enablement wait to reduce flakiness

Five seconds can be tight on slower CI. Consider 20s or a configurable timeout.

-            bot.waitUntil(widgetIsEnabled(bot.button("Run")), 5000);
+            bot.waitUntil(widgetIsEnabled(bot.button("Run")), 20000);

31-36: Tighten Javadoc

Minor clarity tweak.

-/**
- * Test class to test JTAG Flash Process
- * 
- * @author Andrii Filippov
- *
- */
+/**
+ * Verifies JTAG-based flashing of an ESP-IDF project via SWTBot.
+ * Author: Andrii Filippov
+ */

131-140: Consistent naming: ‘JTAGFlash’ instead of ‘JTAGflash’

Purely cosmetic, but improves readability and consistency.

-        private static void whenSelectJTAGflashInLaunchConfig() throws Exception
+        private static void whenSelectJTAGFlashInLaunchConfig() throws Exception

Also update the call site (outside this hunk):

-            Fixture.whenSelectJTAGflashInLaunchConfig();
+            Fixture.whenSelectJTAGFlashInLaunchConfig();

154-157: Consistent naming: ‘JTAGFlash’

Optional rename to match the method above.

-        private static void thenVerifyJTAGflashDone() throws Exception
+        private static void thenVerifyJTAGFlashDone() throws Exception

And update its call site (outside this hunk):

-            Fixture.thenVerifyJTAGflashDone();
+            Fixture.thenVerifyJTAGFlashDone();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ac9fa8f and d9dbc0d.

📒 Files selected for processing (2)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (1 hunks)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectFlashProcessTest.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectFlashProcessTest.java
🧰 Additional context used
🧬 Code graph analysis (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (3)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/common/WorkBenchSWTBot.java (1)
  • WorkBenchSWTBot (14-28)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/EnvSetupOperations.java (1)
  • EnvSetupOperations (12-85)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (1)
  • ProjectTestOperations (51-785)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_macos
🔇 Additional comments (2)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (2)

49-60: Resolved JUnit hook issue — @after is valid here

Switching from a non-static @afterclass to @after fixes the original JUnit4 problem. Cleanup now reliably runs after each test.


120-129: Good: test actually flashes and asserts console output

You now trigger Run from “Run Configurations...” and verify a concrete “Flashing done” marker. This addresses the earlier gap.

Also applies to: 154-157

bump IDF version to 5.4 to solve board detection issue
Temporary isolate test for Linux runner only
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (4)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (4)

49-60: Cleanup hook now runs — good change

Switching from a non-static @afterclass to @after ensures the cleanup actually executes.


131-140: Wait for UI to settle after selecting "JTAG" before clicking OK

Avoids race/flakiness when the combo change triggers background work.

             bot.cTabItem("Main").setFocus();
             bot.comboBoxWithLabel("Flash over:").setSelection("JTAG");
-            bot.button("OK").click();
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
+            bot.waitUntil(widgetIsEnabled(bot.button("OK")), 5000);
+            bot.button("OK").click();

67-67: Fix wizard category typo: "EspressIf" → "Espressif"

This will break the New Project wizard tree lookup.

-            Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
+            Fixture.givenNewEspressifIDFProjectIsSelected("Espressif", "Espressif IDF Project");

142-152: Remove hard-coded USB suffix in board selection; scope Finish to the dialog

The board entry suffix [usb://X-Y] varies per machine; hard-coding will fail on other hosts. Also click the "Finish" button from the shell’s bot.

-            LaunchBarTargetSelector targetSelector = new LaunchBarTargetSelector(bot);
-            targetSelector.clickEdit();
-            TestWidgetWaitUtility.waitForDialogToAppear(bot, "New ESP Target", 20000);
-            SWTBotShell shell = bot.shell("New ESP Target");
-            bot.comboBoxWithLabel("Board:").setSelection("ESP32-ETHERNET-KIT [usb://1-10]");
-            TestWidgetWaitUtility.waitForOperationsInProgressToFinishSync(bot);
-            shell.setFocus();
-            bot.button("Finish").click();
+            LaunchBarTargetSelector targetSelector = new LaunchBarTargetSelector(bot);
+            targetSelector.clickEdit();
+            TestWidgetWaitUtility.waitForDialogToAppear(bot, "New ESP Target", 20000);
+            SWTBotShell shell = bot.shell("New ESP Target");
+            org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo boardCombo = bot.comboBoxWithLabel("Board:");
+            for (String item : boardCombo.items()) {
+                if (item.startsWith("ESP32-ETHERNET-KIT")) {
+                    boardCombo.setSelection(item);
+                    break;
+                }
+            }
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishSync(bot);
+            shell.setFocus();
+            shell.bot().button("Finish").click();
🧹 Nitpick comments (3)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (3)

65-80: Skip on non-Linux using JUnit Assume instead of a no-op assert

Cleaner semantics and shows as “skipped” rather than a misleading pass.

Add import:

+import org.junit.Assume;

Change test guard:

-        if (SystemUtils.IS_OS_LINUX) //temporary solution until new ESP boards arrive for Windows
-        {
+        Assume.assumeTrue("Linux-only until boards are available on other OSes", SystemUtils.IS_OS_LINUX);
             Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
             Fixture.givenProjectNameIs("NewProject");
             Fixture.whenNewProjectIsSelected();
             Fixture.whenSelectJTAGflashInLaunchConfig();
             Fixture.whenSelectLaunchTargetBoard();
             Fixture.whenProjectIsBuiltUsingContextMenu();
             Fixture.whenFlashProject();
             Fixture.thenVerifyJTAGflashDone();
-        }
-        else
-        {
-            assertTrue(true);
-        }

154-157: Make console assertion less brittle across IDF versions

Match a stable token to reduce false negatives.

-            ProjectTestOperations.verifyTheConsoleOutput(bot, "** Flashing done for partition_table/partition-table.bin");
+            ProjectTestOperations.verifyTheConsoleOutput(bot, "Flashing done");

89-96: Replace fixed sleep with an explicit idle/operations wait

Minimizes flakiness and speeds up the suite when the system is fast.

-            bot.sleep(1000);
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d9dbc0d and efef49c.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml (1 hunks)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (1 hunks)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectFlashProcessTest.java (2 hunks)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/ci.yml
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectFlashProcessTest.java
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java
🧰 Additional context used
🧬 Code graph analysis (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (3)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/common/WorkBenchSWTBot.java (1)
  • WorkBenchSWTBot (14-28)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/EnvSetupOperations.java (1)
  • EnvSetupOperations (12-85)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (1)
  • ProjectTestOperations (51-785)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: build_macos

@AndriiFilippov AndriiFilippov changed the title WIP: SWTBot test case: JTAG Flash Process verification SWTBot test case: JTAG Flash Process verification Sep 4, 2025
@AndriiFilippov
Copy link
Collaborator Author

hi @kolipakakondal , @alirana01
please, review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (2)

67-67: Fix category typo: “EspressIf” → “Espressif” (wizard selection will fail).

-            Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
+            Fixture.givenNewEspressifIDFProjectIsSelected("Espressif", "Espressif IDF Project");

142-152: Make board selection resilient; avoid machine-specific USB suffix.
The “[usb://X-Y]” varies per host; selecting by prefix is safer.

-            SWTBotShell shell = bot.shell("New ESP Target");
-            bot.comboBoxWithLabel("Board:").setSelection("ESP32-ETHERNET-KIT [usb://1-10]");
-            TestWidgetWaitUtility.waitForOperationsInProgressToFinishSync(bot);
-            shell.setFocus();
+            SWTBotShell shell = bot.shell("New ESP Target");
+            org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo boardCombo = bot.comboBoxWithLabel("Board:");
+            for (String item : boardCombo.items()) {
+                if (item.startsWith("ESP32-ETHERNET-KIT")) {
+                    boardCombo.setSelection(item);
+                    break;
+                }
+            }
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishSync(bot);
+            shell.setFocus();
             bot.button("Finish").click();
🧹 Nitpick comments (5)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (5)

65-80: Use Assume to skip on non-Linux instead of passing the test.
Passing masks the skip; JUnit should show “skipped”.

-        if (SystemUtils.IS_OS_LINUX) //temporary solution until new ESP boards arrive for Windows
-        {
+        org.junit.Assume.assumeTrue("Linux-only until boards arrive", SystemUtils.IS_OS_LINUX);
             Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
             Fixture.givenProjectNameIs("NewProjectJTAGFlashTest");
             Fixture.whenNewProjectIsSelected();
             Fixture.whenSelectJTAGflashInLaunchConfig();
             Fixture.whenSelectLaunchTargetBoard();
             Fixture.whenProjectIsBuiltUsingContextMenu();
             Fixture.whenFlashProject();
             Fixture.thenVerifyJTAGflashDone();
-        }
-        else
-        {
-            assertTrue(true);
-        }

Also add import (or use FQN as above):

+import org.junit.Assume;

131-140: Wait for UI state before closing the config dialog.
Avoid timing flakiness after selecting “JTAG”.

             bot.cTabItem("Main").setFocus();
             bot.comboBoxWithLabel("Flash over:").setSelection("JTAG");
-            bot.button("OK").click();
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
+            bot.waitUntil(widgetIsEnabled(bot.button("OK")), 5000);
+            bot.button("OK").click();

89-95: Replace fixed sleep with an explicit wait.
Avoid arbitrary delay after environment setup.

-            bot.sleep(1000);
+            TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);

62-64: Minor: fix method name casing (“JTAGFlash”).
Purely cosmetic, improves readability.

-    public void givenNewProjectCreatedWhenSelectJTAGflashWhenBuiltThenCheckFlashedSuccessfully() throws Exception
+    public void givenNewProjectCreatedWhenSelectJTAGFlashWhenBuiltThenCheckFlashedSuccessfully() throws Exception

16-19: Drop FixMethodOrder if not needed.
With a single test, ordering adds noise.

-import org.junit.FixMethodOrder;
-import org.junit.runners.MethodSorters;
@@
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)

Also applies to: 38-41

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between efef49c and 90adbf3.

📒 Files selected for processing (1)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (3)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/common/WorkBenchSWTBot.java (1)
  • WorkBenchSWTBot (14-28)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/EnvSetupOperations.java (1)
  • EnvSetupOperations (12-85)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectFlashProcessTest.java (3)
  • SuppressWarnings (37-170)
  • Fixture (83-169)
  • Fixture (73-159)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_macos
🔇 Additional comments (3)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectJTAGFlashTest.java (3)

49-60: Cleanup hook looks good.
Using @after ensures environment cleanup per test; previous @afterclass issue is resolved.


113-118: Build-and-wait logic is correct.
Build via context menu, then wait for completion and idle UI — solid.


154-157: No change needed; verifyTheConsoleOutput exists and is correctly named.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant