You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2023/01/18 08:16:44 UTC

[GitHub] [beam] Malarg commented on a diff in pull request #25034: Test loading URLs

Malarg commented on code in PR #25034:
URL: https://github.com/apache/beam/pull/25034#discussion_r1073112162


##########
playground/frontend/build.gradle:
##########
@@ -183,10 +183,17 @@ ext.deleteFilesByRegExp = { re ->
 }
 
 tasks.register("integrationTest") {
+  dependsOn("integrationTest_initial_urls")
   dependsOn("integrationTest_standalone_change_example_sdk_run")
   dependsOn("integrationTest_standalone_miscellaneous_ui")
 }
 
+tasks.register("integrationTest_initial_urls") {

Review Comment:
   will we add `standalone` to naming? Suggest add or remove from all tests



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:highlight/languages/go.dart';
+import 'package:highlight/languages/java.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:playground_components/playground_components.dart';
+import 'package:playground_components_dev/playground_components_dev.dart';
+
+import 'common/common.dart';
+
+// This test loads the app with most of the startup URL combinations.
+// They cannot be tested directly due to a Flutter bug:
+//     https://github.com/flutter/flutter/issues/118028
+// So the test performs in-app navigation to these URLs.
+// Many state objects are re-created this way, but not all,
+// so the test is not clean.
+
+void main() {
+  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+  testWidgets('Initial URLs', (WidgetTester wt) async {
+    await init(wt);
+
+    await _testEmbeddedRoot(wt);
+    await _testStandaloneRoot(wt);
+
+    await _testEmbeddedSdkOnly(wt);
+    await _testStandaloneSdkOnly(wt);
+
+    await _testCatalogDefaultExampleLoader(wt);
+    await _testContentExampleLoader(wt);
+    await _testEmptyExampleLoader(wt);
+    await _testHttpExampleLoader(wt);
+    await _testStandardExampleLoader(wt);
+    await _testUserSharedExampleLoader(wt);
+
+    await _testMultipleExamples(wt);
+  });
+}
+
+const _embeddedPath = '/embedded';

Review Comment:
   Suggest take from embedded playground path file



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:highlight/languages/go.dart';
+import 'package:highlight/languages/java.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:playground_components/playground_components.dart';
+import 'package:playground_components_dev/playground_components_dev.dart';
+
+import 'common/common.dart';
+
+// This test loads the app with most of the startup URL combinations.
+// They cannot be tested directly due to a Flutter bug:
+//     https://github.com/flutter/flutter/issues/118028
+// So the test performs in-app navigation to these URLs.
+// Many state objects are re-created this way, but not all,
+// so the test is not clean.
+
+void main() {
+  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+  testWidgets('Initial URLs', (WidgetTester wt) async {
+    await init(wt);
+
+    await _testEmbeddedRoot(wt);
+    await _testStandaloneRoot(wt);
+
+    await _testEmbeddedSdkOnly(wt);
+    await _testStandaloneSdkOnly(wt);
+
+    await _testCatalogDefaultExampleLoader(wt);
+    await _testContentExampleLoader(wt);
+    await _testEmptyExampleLoader(wt);
+    await _testHttpExampleLoader(wt);
+    await _testStandardExampleLoader(wt);
+    await _testUserSharedExampleLoader(wt);
+
+    await _testMultipleExamples(wt);
+  });
+}
+
+const _embeddedPath = '/embedded';
+const _standalonePath = '/';
+const _paths = [_embeddedPath, _standalonePath];
+
+const _fullViewOptionsMap = {
+  'readonly': 'readonly1,readonly2',
+  'unfold': 'unfold1,unfold2',
+};
+final _croppedViewOptionsMap = {
+  ..._fullViewOptionsMap,
+  'show': 'show',
+};
+
+final _fullViewOptions = _mapToQueryString(_fullViewOptionsMap);
+final _croppedViewOptions = _mapToQueryString(_croppedViewOptionsMap);
+
+Future<void> _testEmbeddedRoot(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse(_embeddedPath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneRoot(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountJava.path,

Review Comment:
   Would be better to generalize interface of obtaining info about examples. I suggest to make factory of examples, which will return required example by enum



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:highlight/languages/go.dart';
+import 'package:highlight/languages/java.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:playground_components/playground_components.dart';
+import 'package:playground_components_dev/playground_components_dev.dart';
+
+import 'common/common.dart';
+
+// This test loads the app with most of the startup URL combinations.
+// They cannot be tested directly due to a Flutter bug:
+//     https://github.com/flutter/flutter/issues/118028
+// So the test performs in-app navigation to these URLs.
+// Many state objects are re-created this way, but not all,
+// so the test is not clean.
+
+void main() {
+  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+  testWidgets('Initial URLs', (WidgetTester wt) async {
+    await init(wt);
+
+    await _testEmbeddedRoot(wt);
+    await _testStandaloneRoot(wt);
+
+    await _testEmbeddedSdkOnly(wt);
+    await _testStandaloneSdkOnly(wt);
+
+    await _testCatalogDefaultExampleLoader(wt);
+    await _testContentExampleLoader(wt);
+    await _testEmptyExampleLoader(wt);
+    await _testHttpExampleLoader(wt);
+    await _testStandardExampleLoader(wt);
+    await _testUserSharedExampleLoader(wt);
+
+    await _testMultipleExamples(wt);
+  });
+}
+
+const _embeddedPath = '/embedded';
+const _standalonePath = '/';
+const _paths = [_embeddedPath, _standalonePath];
+
+const _fullViewOptionsMap = {
+  'readonly': 'readonly1,readonly2',
+  'unfold': 'unfold1,unfold2',
+};
+final _croppedViewOptionsMap = {
+  ..._fullViewOptionsMap,
+  'show': 'show',
+};
+
+final _fullViewOptions = _mapToQueryString(_fullViewOptionsMap);
+final _croppedViewOptions = _mapToQueryString(_croppedViewOptionsMap);
+
+Future<void> _testEmbeddedRoot(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse(_embeddedPath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneRoot(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountJava.path,
+    java,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse(_standalonePath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testEmbeddedSdkOnly(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse('$_embeddedPath?sdk=go'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneSdkOnly(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(

Review Comment:
   this test will be broken if default example will be changed



##########
playground/frontend/lib/main.dart:
##########
@@ -43,7 +43,7 @@ void main() async {
   // Router API specific initialization.
   final pageStack = GetIt.instance.get<PageStack>();
   final routerDelegate = BeamRouterDelegate(pageStack);
-  final routeInformationParser = PlaygroundRouteInformationParser();
+  final rip = GetIt.instance.get<PageStackRouteInformationParser>();

Review Comment:
   may be `routeParser`? My first association is rest in peace 



##########
playground/frontend/playground_components_dev/lib/src/widget_tester.dart:
##########
@@ -50,4 +52,28 @@ extension WidgetTesterExtension on WidgetTester {
     final context = element(find.codeField());
     return context.read<PlaygroundController>();
   }
+
+  Future<void> navigateAndSettle(Uri url) async {
+    print(url);
+    await _navigate(url);
+    await Future.delayed(const Duration(seconds:1));
+    await pumpAndSettle();
+
+    await Future.delayed(const Duration(seconds: 1));
+    await pumpAndSettle();
+  }
+
+  Future<void> _navigate(Uri uri) async {
+    final rip = GetIt.instance.get<PageStackRouteInformationParser>();

Review Comment:
   `routeParser`



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:highlight/languages/go.dart';
+import 'package:highlight/languages/java.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:playground_components/playground_components.dart';
+import 'package:playground_components_dev/playground_components_dev.dart';
+
+import 'common/common.dart';
+
+// This test loads the app with most of the startup URL combinations.
+// They cannot be tested directly due to a Flutter bug:
+//     https://github.com/flutter/flutter/issues/118028
+// So the test performs in-app navigation to these URLs.
+// Many state objects are re-created this way, but not all,
+// so the test is not clean.
+
+void main() {
+  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+  testWidgets('Initial URLs', (WidgetTester wt) async {
+    await init(wt);
+
+    await _testEmbeddedRoot(wt);
+    await _testStandaloneRoot(wt);
+
+    await _testEmbeddedSdkOnly(wt);
+    await _testStandaloneSdkOnly(wt);
+
+    await _testCatalogDefaultExampleLoader(wt);
+    await _testContentExampleLoader(wt);
+    await _testEmptyExampleLoader(wt);
+    await _testHttpExampleLoader(wt);
+    await _testStandardExampleLoader(wt);
+    await _testUserSharedExampleLoader(wt);
+
+    await _testMultipleExamples(wt);
+  });
+}
+
+const _embeddedPath = '/embedded';
+const _standalonePath = '/';

Review Comment:
   suggest take from standalone playground path file



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';

Review Comment:
   unused import



##########
playground/frontend/lib/main.dart:
##########
@@ -43,7 +43,7 @@ void main() async {
   // Router API specific initialization.
   final pageStack = GetIt.instance.get<PageStack>();
   final routerDelegate = BeamRouterDelegate(pageStack);
-  final routeInformationParser = PlaygroundRouteInformationParser();
+  final rip = GetIt.instance.get<PageStackRouteInformationParser>();

Review Comment:
   also unused import on 33 row



##########
playground/frontend/lib/main.dart:
##########
@@ -43,7 +43,7 @@ void main() async {
   // Router API specific initialization.
   final pageStack = GetIt.instance.get<PageStack>();
   final routerDelegate = BeamRouterDelegate(pageStack);
-  final routeInformationParser = PlaygroundRouteInformationParser();
+  final rip = GetIt.instance.get<PageStackRouteInformationParser>();

Review Comment:
   also I think we can make extension on get it to make calls shorter



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:highlight/languages/go.dart';
+import 'package:highlight/languages/java.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:playground_components/playground_components.dart';
+import 'package:playground_components_dev/playground_components_dev.dart';
+
+import 'common/common.dart';
+
+// This test loads the app with most of the startup URL combinations.
+// They cannot be tested directly due to a Flutter bug:
+//     https://github.com/flutter/flutter/issues/118028
+// So the test performs in-app navigation to these URLs.
+// Many state objects are re-created this way, but not all,
+// so the test is not clean.
+
+void main() {
+  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+  testWidgets('Initial URLs', (WidgetTester wt) async {
+    await init(wt);
+
+    await _testEmbeddedRoot(wt);
+    await _testStandaloneRoot(wt);
+
+    await _testEmbeddedSdkOnly(wt);
+    await _testStandaloneSdkOnly(wt);
+
+    await _testCatalogDefaultExampleLoader(wt);
+    await _testContentExampleLoader(wt);
+    await _testEmptyExampleLoader(wt);
+    await _testHttpExampleLoader(wt);
+    await _testStandardExampleLoader(wt);
+    await _testUserSharedExampleLoader(wt);
+
+    await _testMultipleExamples(wt);
+  });
+}
+
+const _embeddedPath = '/embedded';
+const _standalonePath = '/';
+const _paths = [_embeddedPath, _standalonePath];
+
+const _fullViewOptionsMap = {
+  'readonly': 'readonly1,readonly2',
+  'unfold': 'unfold1,unfold2',
+};
+final _croppedViewOptionsMap = {
+  ..._fullViewOptionsMap,
+  'show': 'show',
+};
+
+final _fullViewOptions = _mapToQueryString(_fullViewOptionsMap);
+final _croppedViewOptions = _mapToQueryString(_croppedViewOptionsMap);
+
+Future<void> _testEmbeddedRoot(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse(_embeddedPath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneRoot(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountJava.path,
+    java,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse(_standalonePath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testEmbeddedSdkOnly(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse('$_embeddedPath?sdk=go'),

Review Comment:
   there are a lot of `Uri.parse` calls in the file with different params. It also could be generalized with builder.



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:highlight/languages/go.dart';
+import 'package:highlight/languages/java.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:playground_components/playground_components.dart';
+import 'package:playground_components_dev/playground_components_dev.dart';
+
+import 'common/common.dart';
+
+// This test loads the app with most of the startup URL combinations.
+// They cannot be tested directly due to a Flutter bug:
+//     https://github.com/flutter/flutter/issues/118028
+// So the test performs in-app navigation to these URLs.
+// Many state objects are re-created this way, but not all,
+// so the test is not clean.
+
+void main() {
+  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+  testWidgets('Initial URLs', (WidgetTester wt) async {
+    await init(wt);
+
+    await _testEmbeddedRoot(wt);
+    await _testStandaloneRoot(wt);
+
+    await _testEmbeddedSdkOnly(wt);
+    await _testStandaloneSdkOnly(wt);
+
+    await _testCatalogDefaultExampleLoader(wt);
+    await _testContentExampleLoader(wt);
+    await _testEmptyExampleLoader(wt);
+    await _testHttpExampleLoader(wt);
+    await _testStandardExampleLoader(wt);
+    await _testUserSharedExampleLoader(wt);
+
+    await _testMultipleExamples(wt);
+  });
+}
+
+const _embeddedPath = '/embedded';
+const _standalonePath = '/';
+const _paths = [_embeddedPath, _standalonePath];
+
+const _fullViewOptionsMap = {
+  'readonly': 'readonly1,readonly2',
+  'unfold': 'unfold1,unfold2',
+};
+final _croppedViewOptionsMap = {
+  ..._fullViewOptionsMap,
+  'show': 'show',
+};
+
+final _fullViewOptions = _mapToQueryString(_fullViewOptionsMap);
+final _croppedViewOptions = _mapToQueryString(_croppedViewOptionsMap);
+
+Future<void> _testEmbeddedRoot(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse(_embeddedPath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneRoot(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountJava.path,
+    java,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse(_standalonePath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testEmbeddedSdkOnly(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse('$_embeddedPath?sdk=go'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneSdkOnly(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountGo.path,
+    go,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse('$_standalonePath?sdk=go'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testCatalogDefaultExampleLoader(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountGo.path,
+    go,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse('$_standalonePath?sdk=go&default=true'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testContentExampleLoader(WidgetTester wt) async {
+  final content = await Examples.getFullTextByPath(ExampleGo.path);
+
+  for (final path in _paths) {
+    final files = jsonEncode([
+      {'content': content, 'isMain': true}
+    ]);
+    await wt.navigateAndSettle(
+      Uri.parse(
+        '$path?sdk=go&files=${Uri.encodeComponent(files)}&$_fullViewOptions',
+      ),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.fullVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testEmptyExampleLoader(WidgetTester wt) async {
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&empty=true'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, '');
+  }
+}
+
+Future<void> _testHttpExampleLoader(WidgetTester wt) async {
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_fullViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.fullVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testStandardExampleLoader(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    WordCountGo.path,
+    go,
+  );
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&path=${WordCountGo.dbPath}'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, visibleText);
+  }
+}
+
+Future<void> _testUserSharedExampleLoader(WidgetTester wt) async {
+  final template = await Examples.getFullTextByPath(ExampleGo.path);
+  final tail = '\n//${DateTime.now().millisecondsSinceEpoch}';
+  final content = '$template$tail';
+
+  final exampleCache = wt.findPlaygroundController().exampleCache;
+  final snippetId = await exampleCache.saveSnippet(
+    files: [SnippetFile(content: content, isMain: false, name: 'name')],
+    sdk: Sdk.go,
+    pipelineOptions: 'a=b',
+  );
+
+  print('Created user-shared example ID: $snippetId');
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&shared=$snippetId&$_fullViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, '${ExampleGo.fullVisibleText}$tail');
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testMultipleExamples(WidgetTester wt) async {
+  final javaVisibleText = await Examples.getVisibleTextByPath(
+    AggregationMaxJava.path,
+    java,
+  );
+  const goVisibleText = ExampleGo.fullVisibleText;
+
+  final examplesList = [
+    {
+      'sdk': Sdk.java.id,
+      'path': AggregationMaxJava.dbPath,
+      ..._fullViewOptionsMap,
+    },
+    {
+      'sdk': Sdk.go.id,
+      'url': ExampleGo.url,
+      ..._fullViewOptionsMap,
+    },
+  ];
+  final examples = jsonEncode(examplesList);
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&examples=$examples'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, goVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    final playgroundController = wt.findPlaygroundController();
+    playgroundController.setSdk(Sdk.java);
+    await wt.pumpAndSettle();
+
+    _expectSdk(wt, Sdk.java);
+    _expectText(wt, javaVisibleText);
+  }
+}
+
+void _expectSdk(WidgetTester wt, Sdk sdk) {
+  final controller = wt.findPlaygroundController();
+  expect(controller.sdk, sdk);
+}
+
+void _expectText(WidgetTester wt, String visibleText) {
+  final controller = wt.findOneCodeController();
+  expect(controller.text, visibleText);
+}
+
+/// Checks that the example contains:
+/// - at least two 'editable' substrings, and they are editable,
+/// - at least two 'readonly' substrings, and they are read-only.
+Future<void> _expectEditableAndReadOnly(WidgetTester wt) async {
+  final controller = wt.findOneCodeController();
+
+  for (int i = 0; i < 2; i++) {
+    controller.value = controller.value.select('editable')!;
+
+    final edited1 = controller.value.typed('');

Review Comment:
   edited1?



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:highlight/languages/go.dart';
+import 'package:highlight/languages/java.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:playground_components/playground_components.dart';
+import 'package:playground_components_dev/playground_components_dev.dart';
+
+import 'common/common.dart';
+
+// This test loads the app with most of the startup URL combinations.
+// They cannot be tested directly due to a Flutter bug:
+//     https://github.com/flutter/flutter/issues/118028
+// So the test performs in-app navigation to these URLs.
+// Many state objects are re-created this way, but not all,
+// so the test is not clean.
+
+void main() {
+  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+  testWidgets('Initial URLs', (WidgetTester wt) async {
+    await init(wt);
+
+    await _testEmbeddedRoot(wt);
+    await _testStandaloneRoot(wt);
+
+    await _testEmbeddedSdkOnly(wt);
+    await _testStandaloneSdkOnly(wt);
+
+    await _testCatalogDefaultExampleLoader(wt);
+    await _testContentExampleLoader(wt);
+    await _testEmptyExampleLoader(wt);
+    await _testHttpExampleLoader(wt);
+    await _testStandardExampleLoader(wt);
+    await _testUserSharedExampleLoader(wt);
+
+    await _testMultipleExamples(wt);
+  });
+}
+
+const _embeddedPath = '/embedded';
+const _standalonePath = '/';
+const _paths = [_embeddedPath, _standalonePath];
+
+const _fullViewOptionsMap = {
+  'readonly': 'readonly1,readonly2',
+  'unfold': 'unfold1,unfold2',
+};
+final _croppedViewOptionsMap = {
+  ..._fullViewOptionsMap,
+  'show': 'show',
+};
+
+final _fullViewOptions = _mapToQueryString(_fullViewOptionsMap);
+final _croppedViewOptions = _mapToQueryString(_croppedViewOptionsMap);
+
+Future<void> _testEmbeddedRoot(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse(_embeddedPath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneRoot(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountJava.path,
+    java,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse(_standalonePath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testEmbeddedSdkOnly(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse('$_embeddedPath?sdk=go'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneSdkOnly(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountGo.path,
+    go,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse('$_standalonePath?sdk=go'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testCatalogDefaultExampleLoader(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountGo.path,
+    go,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse('$_standalonePath?sdk=go&default=true'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testContentExampleLoader(WidgetTester wt) async {
+  final content = await Examples.getFullTextByPath(ExampleGo.path);
+
+  for (final path in _paths) {
+    final files = jsonEncode([
+      {'content': content, 'isMain': true}
+    ]);
+    await wt.navigateAndSettle(
+      Uri.parse(
+        '$path?sdk=go&files=${Uri.encodeComponent(files)}&$_fullViewOptions',
+      ),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.fullVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testEmptyExampleLoader(WidgetTester wt) async {
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&empty=true'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, '');
+  }
+}
+
+Future<void> _testHttpExampleLoader(WidgetTester wt) async {
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_fullViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.fullVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testStandardExampleLoader(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    WordCountGo.path,
+    go,
+  );
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&path=${WordCountGo.dbPath}'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, visibleText);
+  }
+}
+
+Future<void> _testUserSharedExampleLoader(WidgetTester wt) async {
+  final template = await Examples.getFullTextByPath(ExampleGo.path);
+  final tail = '\n//${DateTime.now().millisecondsSinceEpoch}';
+  final content = '$template$tail';
+
+  final exampleCache = wt.findPlaygroundController().exampleCache;
+  final snippetId = await exampleCache.saveSnippet(
+    files: [SnippetFile(content: content, isMain: false, name: 'name')],
+    sdk: Sdk.go,
+    pipelineOptions: 'a=b',
+  );
+
+  print('Created user-shared example ID: $snippetId');
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&shared=$snippetId&$_fullViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, '${ExampleGo.fullVisibleText}$tail');
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testMultipleExamples(WidgetTester wt) async {
+  final javaVisibleText = await Examples.getVisibleTextByPath(
+    AggregationMaxJava.path,
+    java,
+  );
+  const goVisibleText = ExampleGo.fullVisibleText;
+
+  final examplesList = [
+    {
+      'sdk': Sdk.java.id,
+      'path': AggregationMaxJava.dbPath,
+      ..._fullViewOptionsMap,
+    },
+    {
+      'sdk': Sdk.go.id,
+      'url': ExampleGo.url,
+      ..._fullViewOptionsMap,
+    },
+  ];
+  final examples = jsonEncode(examplesList);
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&examples=$examples'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, goVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    final playgroundController = wt.findPlaygroundController();
+    playgroundController.setSdk(Sdk.java);
+    await wt.pumpAndSettle();
+
+    _expectSdk(wt, Sdk.java);
+    _expectText(wt, javaVisibleText);
+  }
+}
+
+void _expectSdk(WidgetTester wt, Sdk sdk) {
+  final controller = wt.findPlaygroundController();
+  expect(controller.sdk, sdk);
+}
+
+void _expectText(WidgetTester wt, String visibleText) {
+  final controller = wt.findOneCodeController();
+  expect(controller.text, visibleText);
+}
+
+/// Checks that the example contains:
+/// - at least two 'editable' substrings, and they are editable,
+/// - at least two 'readonly' substrings, and they are read-only.
+Future<void> _expectEditableAndReadOnly(WidgetTester wt) async {
+  final controller = wt.findOneCodeController();
+
+  for (int i = 0; i < 2; i++) {
+    controller.value = controller.value.select('editable')!;
+
+    final edited1 = controller.value.typed('');
+    controller.value = edited1;
+    await wt.pumpAndSettle();
+    expect(controller.value, edited1, reason: 'Cannot edit an editable line');
+
+    controller.value = controller.value.select('readonly')!.typed('');
+    await wt.pumpAndSettle();
+    expect(controller.value, edited1, reason: 'Can edit a read-only line');
+  }
+}
+
+/// Checks that every character in the editor is read-only.
+void _expectReadOnly(WidgetTester wt) {
+  final controller = wt.findOneCodeController();
+  final value = controller.value;
+  final text = controller.text;
+
+  for (int i = text.length; --i >= 0;) {

Review Comment:
   better to move decrement to third part of cycle



##########
playground/frontend/integration_test/initial_urls_test.dart:
##########
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'dart:convert';
+
+import 'package:flutter/widgets.dart';
+import 'package:flutter_code_editor/flutter_code_editor.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:highlight/languages/go.dart';
+import 'package:highlight/languages/java.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:playground_components/playground_components.dart';
+import 'package:playground_components_dev/playground_components_dev.dart';
+
+import 'common/common.dart';
+
+// This test loads the app with most of the startup URL combinations.
+// They cannot be tested directly due to a Flutter bug:
+//     https://github.com/flutter/flutter/issues/118028
+// So the test performs in-app navigation to these URLs.
+// Many state objects are re-created this way, but not all,
+// so the test is not clean.
+
+void main() {
+  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+  testWidgets('Initial URLs', (WidgetTester wt) async {
+    await init(wt);
+
+    await _testEmbeddedRoot(wt);
+    await _testStandaloneRoot(wt);
+
+    await _testEmbeddedSdkOnly(wt);
+    await _testStandaloneSdkOnly(wt);
+
+    await _testCatalogDefaultExampleLoader(wt);
+    await _testContentExampleLoader(wt);
+    await _testEmptyExampleLoader(wt);
+    await _testHttpExampleLoader(wt);
+    await _testStandardExampleLoader(wt);
+    await _testUserSharedExampleLoader(wt);
+
+    await _testMultipleExamples(wt);
+  });
+}
+
+const _embeddedPath = '/embedded';
+const _standalonePath = '/';
+const _paths = [_embeddedPath, _standalonePath];
+
+const _fullViewOptionsMap = {
+  'readonly': 'readonly1,readonly2',
+  'unfold': 'unfold1,unfold2',
+};
+final _croppedViewOptionsMap = {
+  ..._fullViewOptionsMap,
+  'show': 'show',
+};
+
+final _fullViewOptions = _mapToQueryString(_fullViewOptionsMap);
+final _croppedViewOptions = _mapToQueryString(_croppedViewOptionsMap);
+
+Future<void> _testEmbeddedRoot(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse(_embeddedPath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneRoot(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountJava.path,
+    java,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse(_standalonePath),
+  );
+  _expectSdk(wt, Sdk.java);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testEmbeddedSdkOnly(WidgetTester wt) async {
+  await wt.navigateAndSettle(
+    Uri.parse('$_embeddedPath?sdk=go'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, '');
+}
+
+Future<void> _testStandaloneSdkOnly(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountGo.path,
+    go,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse('$_standalonePath?sdk=go'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testCatalogDefaultExampleLoader(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    MinimalWordCountGo.path,
+    go,
+  );
+
+  await wt.navigateAndSettle(
+    Uri.parse('$_standalonePath?sdk=go&default=true'),
+  );
+  _expectSdk(wt, Sdk.go);
+  _expectText(wt, visibleText);
+}
+
+Future<void> _testContentExampleLoader(WidgetTester wt) async {
+  final content = await Examples.getFullTextByPath(ExampleGo.path);
+
+  for (final path in _paths) {
+    final files = jsonEncode([
+      {'content': content, 'isMain': true}
+    ]);
+    await wt.navigateAndSettle(
+      Uri.parse(
+        '$path?sdk=go&files=${Uri.encodeComponent(files)}&$_fullViewOptions',
+      ),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.fullVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testEmptyExampleLoader(WidgetTester wt) async {
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&empty=true'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, '');
+  }
+}
+
+Future<void> _testHttpExampleLoader(WidgetTester wt) async {
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_fullViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.fullVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testStandardExampleLoader(WidgetTester wt) async {
+  final visibleText = await Examples.getVisibleTextByPath(
+    WordCountGo.path,
+    go,
+  );
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&path=${WordCountGo.dbPath}'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, visibleText);
+  }
+}
+
+Future<void> _testUserSharedExampleLoader(WidgetTester wt) async {
+  final template = await Examples.getFullTextByPath(ExampleGo.path);
+  final tail = '\n//${DateTime.now().millisecondsSinceEpoch}';
+  final content = '$template$tail';
+
+  final exampleCache = wt.findPlaygroundController().exampleCache;
+  final snippetId = await exampleCache.saveSnippet(
+    files: [SnippetFile(content: content, isMain: false, name: 'name')],
+    sdk: Sdk.go,
+    pipelineOptions: 'a=b',
+  );
+
+  print('Created user-shared example ID: $snippetId');
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&shared=$snippetId&$_fullViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, '${ExampleGo.fullVisibleText}$tail');
+    await _expectEditableAndReadOnly(wt);
+
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&url=${ExampleGo.url}&$_croppedViewOptions'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, ExampleGo.croppedVisibleText);
+    _expectReadOnly(wt);
+  }
+}
+
+Future<void> _testMultipleExamples(WidgetTester wt) async {
+  final javaVisibleText = await Examples.getVisibleTextByPath(
+    AggregationMaxJava.path,
+    java,
+  );
+  const goVisibleText = ExampleGo.fullVisibleText;
+
+  final examplesList = [
+    {
+      'sdk': Sdk.java.id,
+      'path': AggregationMaxJava.dbPath,
+      ..._fullViewOptionsMap,
+    },
+    {
+      'sdk': Sdk.go.id,
+      'url': ExampleGo.url,
+      ..._fullViewOptionsMap,
+    },
+  ];
+  final examples = jsonEncode(examplesList);
+
+  for (final path in _paths) {
+    await wt.navigateAndSettle(
+      Uri.parse('$path?sdk=go&examples=$examples'),
+    );
+    _expectSdk(wt, Sdk.go);
+    _expectText(wt, goVisibleText);
+    await _expectEditableAndReadOnly(wt);
+
+    final playgroundController = wt.findPlaygroundController();
+    playgroundController.setSdk(Sdk.java);
+    await wt.pumpAndSettle();
+
+    _expectSdk(wt, Sdk.java);
+    _expectText(wt, javaVisibleText);
+  }
+}
+
+void _expectSdk(WidgetTester wt, Sdk sdk) {
+  final controller = wt.findPlaygroundController();
+  expect(controller.sdk, sdk);
+}
+
+void _expectText(WidgetTester wt, String visibleText) {
+  final controller = wt.findOneCodeController();
+  expect(controller.text, visibleText);
+}
+
+/// Checks that the example contains:
+/// - at least two 'editable' substrings, and they are editable,
+/// - at least two 'readonly' substrings, and they are read-only.
+Future<void> _expectEditableAndReadOnly(WidgetTester wt) async {
+  final controller = wt.findOneCodeController();
+
+  for (int i = 0; i < 2; i++) {

Review Comment:
   2 is a magic number here



##########
playground/frontend/playground_components_dev/lib/src/widget_tester.dart:
##########
@@ -50,4 +52,28 @@ extension WidgetTesterExtension on WidgetTester {
     final context = element(find.codeField());
     return context.read<PlaygroundController>();
   }
+
+  Future<void> navigateAndSettle(Uri url) async {
+    print(url);
+    await _navigate(url);
+    await Future.delayed(const Duration(seconds:1));
+    await pumpAndSettle();
+
+    await Future.delayed(const Duration(seconds: 1));
+    await pumpAndSettle();

Review Comment:
   Explain, please. Why is it required?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org