Skip to content

Add core project and editor UI tests for IntelliJ IDEA 2026.2 - #9211

Draft
cj-radcliff wants to merge 1 commit into
flutter:ui-test-harness-iu262from
cj-radcliff:ui-tests-core-iu262
Draft

cj-radcliff wants to merge 1 commit into
flutter:ui-test-harness-iu262from
cj-radcliff:ui-tests-core-iu262

Conversation

@cj-radcliff

Copy link
Copy Markdown
Collaborator

Description

(Stacked on #9209 / ui-test-harness-iu262)

Adds five core IDE Starter UI tests against IntelliJ IDEA 2026.2.3 covering project creation, pubspec.yaml dependency fetching, widget test execution, refactoring, and live templates:

  • NewProjectIU262UITest:
    • Exercises the Welcome screen's New Project wizard (Flutter generator) on IntelliJ IDEA 2026.2.3, verifies the generated project opens and finishes indexing, and cleans up the project directory afterwards.
  • PubGetUITest:
    • Opens an existing Flutter project, adds http: ^1.2.0 to pubspec.yaml, invokes Flutter Pub Get (flutter.pub.get), and verifies pubspec.lock (direct main hosted dependency), .dart_tool/package_config.json, and the downloaded package in the pub cache (lib/http.dart).
  • RunWidgetTestUITest:
    • Opens test/widget_test.dart, places the caret on testWidgets, invokes RunClass from the editor, and verifies the IDE test runner reports the widget test passed.
  • ExtractWidgetUITest:
    • Opens lib/main.dart, places the caret on Text('You have pushed...'), invokes Extract Flutter Widget... (Flutter.ExtractWidget), enters CounterLabel, and verifies class CounterLabel extends StatelessWidget is extracted cleanly.
  • StatelessWidgetLiveTemplateUITest:
    • Opens lib/greeting.dart, types stless + Tab + Greeting, and verifies the live template expands into class Greeting extends StatelessWidget with const Greeting({super.key});.
  • testSrc/integration/README.md:
    • Adds the Available tests table and updates the example command to RunWidgetTestUITest.

Verification

  • Verified compileIntegrationKotlin compiles cleanly.
  • Verified all 5 UI tests pass against IntelliJ IDEA 2026.2.3 (./gradlew --no-daemon integration --tests io.flutter.integrationTest.<TestClass>).

Review the contribution guidelines below:

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
  • I've included the required information in the description above.
  • My up-to-date information is in the AUTHORS file.
  • I've updated CHANGELOG.md if appropriate.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a suite of UI integration tests for the Flutter IntelliJ plugin, covering widget extraction, project creation, running pub get, widget testing, and live templates, along with updated documentation. The feedback points out a violation of the Kotlin style guide in PubGetUITest.kt where the double-bang (!!) operator is used, and suggests replacing it with checkNotNull for better safety and error context.

println("pubspec.lock: $PACKAGE $version")
check(version.startsWith(MAJOR_VERSION)) { "Expected $PACKAGE $CONSTRAINT to resolve to a 1.x version, got $version" }

val lockEntry = lockEntry()!!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

[MUST-FIX] Avoid using the double-bang !! operator as per the Kotlin style guide. Use checkNotNull or an Elvis operator with an explicit error message instead to ensure null safety and provide better error context.

Suggested change
val lockEntry = lockEntry()!!
val lockEntry = checkNotNull(lockEntry()) { "pubspec.lock entry for $PACKAGE not found" }
References
  1. Null Safety: NEVER use the double-bang !! operator. Use ?., ?:, or if (x != null). (link)

This branch has not been deployed

No deployments
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