Skip to content

--web-launch-url option has no effect for flutter drive #118028

@alexeyinkin

Description

@alexeyinkin

According to flutter drive --help, the option --web-launch-url is

The URL to provide to the browser. Defaults to an HTTP URL with the host name of "--web-hostname", the port of "--web-port", and the path set to "/".

However, in my setting it has no effect.

Steps to Reproduce

  1. Create a new Flutter app.
  2. Replace main.dart with the attached content.
  3. Replace pubspec.yaml with the attached content.
  4. Create test_driver/integration_test.dart with the attached content.
  5. Create integration_test/root_test.dart with the attached content.
  6. Create integration_test/green_test.dart with the attached content.
  7. Start chromedriver on port 4444.
  8. Run:
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/green_test.dart -d chrome --web-port=43000 --web-launch-url='http://localhost:43000/#/green'

Expected results: The browser starts at http://localhost:43000/#/green, the green screen is shown, the test finds a widget with /green text and the test succeeds.

Actual results: The browser starts at http://localhost:43000/#/, the root screen is shown, the test fails to find a widget with /green text.

main.dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      routes: {
        '/': (context) => Scaffold(
              body: Container(
                child: Center(child: Text('root')),
              ),
            ),
        '/green': (context) => Scaffold(
              body: Container(
                color: Colors.green,
                child: Center(child: Text('/green')),
              ),
            ),
      },
    );
  }
}
pubspec.yaml
name: integration_test_test
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1

environment:
  sdk: '>=2.18.6 <3.0.0'

dependencies:
  flutter:
    sdk: flutter

dev_dependencies:
  flutter_test:
    sdk: flutter
  integration_test:
    sdk: flutter
test_driver/integration_test.dart
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
integration_test/root_test.dart
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'package:integration_test_test/main.dart' as app;

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  testWidgets('Finds text in the root screen', (tester) async {
    app.main();
    await tester.pumpAndSettle();

    await Future.delayed(const Duration(seconds: 5)); // To see the screen.

    expect(find.text('root'), findsOneWidget);
  });
}
integration_test/green_test.dart
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'package:integration_test_test/main.dart' as app;

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  testWidgets('Finds text in the green screen', (tester) async {
    app.main();
    await tester.pumpAndSettle();

    await Future.delayed(const Duration(seconds: 5)); // To see the screen.

    expect(find.text('/green'), findsOneWidget);
  });
}

Screens

Video of the test:

vokoscreen-2023-01-05_12-37-05.mp4

http://localhost:43000/#/green when running normally and typed in:

image

Context

Ubuntu: flutter doctor -v
flutter doctor -v
[✓] Flutter (Channel stable, 3.3.10, on Ubuntu 20.04.5 LTS 5.14.0-1054-oem, locale en_US.UTF-8)
    • Flutter version 3.3.10 on channel stable at /home/alexey/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (3 weeks ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/alexey/Android/Sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.2)
    • Android Studio at /home/alexey/bin/android-studio
    • Flutter plugin version 71.0.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.74.2)
    • VS Code at /usr/share/code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.5 LTS 5.14.0-1054-oem
    • Chrome (web)    • chrome • web-javascript • Google Chrome 108.0.5359.124

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
Ubuntu: chromedriver --version
ChromeDriver 108.0.5359.71 (1e0e3868ee06e91ad636a874420e3ca3ae3756ac-refs/branch-heads/5359@{#1016})
Mac: flutter doctor -v
➜  ~ flutter doctor -v
[✓] Flutter (Channel master, 3.7.0-14.0.pre.40, on macOS 12.6 21G115 darwin-x64, locale ru-RU)
    • Flutter version 3.7.0-14.0.pre.40 on channel master at /Users/dmitrijrepin/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a562fe2d8a (4 hours ago), 2023-01-04 23:53:41 -0500
    • Engine revision b9b0193ea8
    • Dart version 3.0.0 (build 3.0.0-85.0.dev)
    • DevTools version 2.20.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
    • Android SDK at /Users/dmitrijrepin/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0-rc2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2022.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.74.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.56.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 108.0.5359.124

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Metadata

Metadata

Labels

Bot is counting down the days until it unassigns the issueP3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityfound in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versiont: flutter driver"flutter driver", flutter_drive, or a driver testteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions