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


##########
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:
   I went from example constants to `ExampleDescriptor` instances. Later if we 
need to loop through SDKs, it will be easier this way.
   
   I do not see a room for factories because we have everything hardcoded.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to