Playground integration test run and editing#25033
Conversation
…hange the example (apache#24730) (apache#24729)
* Integration test for changing SDK and running code (apache#24779) * Rename an integration test (apache#24779) * Use enum to switch SDK in integration test (apache#24779) * Find SDK in a dropdown by key (apache#24779) * Add a TODO (apache#24779) * Fix exports (apache#24779)
* Integration test for changing SDK and running code (apache#24779) * Rename an integration test (apache#24779) * Use enum to switch SDK in integration test (apache#24779) * Find SDK in a dropdown by key (apache#24779) * Add a TODO (apache#24779) * Fix exports (apache#24779) * Integration tests miscellaneous UI (#383) * miscellaneous ui integration tests * reverted pubspec.lock * gradle tasks ordered alhpabetically * integration tests refactoring * clean code * integration tests miscellaneous ui fix pr * rename method * added layout adaptivity * A minor cleanup (apache#24779) Co-authored-by: Dmitry Repin <mr.malarg@gmail.com>
| final startSource = controller.source; | ||
| await wt.enterText(find.codeField(), 'print("Hello World!'); | ||
|
|
||
| expect(startSource != controller.source, true); |
There was a problem hiding this comment.
| expect(startSource != controller.source, true); | |
| expect(controller.source, isNot(startSource)); |
|
|
||
| expect(startSource != controller.source, true); | ||
|
|
||
| await wt.runShortcut(controller.resetShortcut.shortcuts.keys); |
There was a problem hiding this comment.
Make shortcuts OS-dependent.
There was a problem hiding this comment.
All 5 shortcuts work in Ubuntu.
| import 'package:playground_components_dev/playground_components_dev.dart'; | ||
|
|
||
| extension CommonFindersExtension on CommonFinders { | ||
| Finder appDropdownButtonWithText(String text) { |
There was a problem hiding this comment.
Look for PipelineOptionsDropdown.
| await wt.tapAndSettle(find.runOrCancelButton()); | ||
|
|
||
| final playgroundController = wt.findPlaygroundController(); | ||
| expect(playgroundController.outputResult, contains('Pipeline cancelled')); |
|
|
||
| _checkIfRawTextCorrect('--some test --some2 test2'); | ||
|
|
||
| await wt.tapAndSettle(find.pipelineOptionsOptionsTab()); |
There was a problem hiding this comment.
| await wt.tapAndSettle(find.pipelineOptionsOptionsTab()); | |
| await wt.tapAndSettle(find.pipelineOptionsListTab()); |
| ); | ||
| } | ||
|
|
||
| Future<void> _editingAndResettingChanges(WidgetTester wt) async { |
| expect(playgroundController.source, equals(code)); | ||
| } | ||
|
|
||
| Future<void> _checkCodeHighlighting(WidgetTester wt) async { |
There was a problem hiding this comment.
| Future<void> _checkCodeHighlighting(WidgetTester wt) async { | |
| Future<void> _expectMoreThanOneColor(WidgetTester wt) async { |
| Finder foldToggles = _getFoldToggles(); | ||
|
|
||
| Finder topToggle = | ||
| wt.getCenter(foldToggles.at(0)).dy < wt.getCenter(foldToggles.at(1)).dy |
There was a problem hiding this comment.
Look for inputs the same way, comparing their centers, remove keys from inputs.
| await wt.tapAndSettle(find.exampleSelector()); | ||
| await wt.tapAndSettle(find.exampleSelector()); |
| await _checkFilteringExamplesByTags(wt); | ||
| await _checkFilteringExamplesBySearchString(wt); |
There was a problem hiding this comment.
Check the actual examples before filtering and after filtering.
playground/frontend/build.gradle
Outdated
| } | ||
|
|
||
| tasks.register("integrationTest_standalone_cancel_running_example") { | ||
| runIntegrationTest("standalone_cancel_running_example", "/") |
| duration, | ||
| ); | ||
| } catch (e) { | ||
| //ignore |
| final source = wt | ||
| .findPlaygroundController() | ||
| .snippetEditingController | ||
| ?.activeFileController | ||
| ?.codeController | ||
| .fullText ?? | ||
| ''; |
There was a problem hiding this comment.
Check if there is a getter for this. It may be on the Copy button of the embedded playground.
| (WidgetTester wt) async { | ||
| await init(wt); | ||
|
|
||
| await wt.tapAndSettle(find.appDropdownButtonWithText('Pipeline Options')); |
There was a problem hiding this comment.
| await wt.tapAndSettle(find.appDropdownButtonWithText('Pipeline Options')); | |
| await wt.openPipelineOptions(); |
?
| await wt.tap(find.runOrCancelButton()); | ||
| await Future.delayed(const Duration(milliseconds: 300)); | ||
|
|
||
| await wt.tapAndSettle(find.runOrCancelButton()); |
There was a problem hiding this comment.
Add a comment that cancelling is just for speed.
| if (examples.isEmpty) { | ||
| return true; | ||
| } |
|
|
||
| return categories | ||
| .map((e) => e.examples.length) | ||
| .reduce((value, element) => value + element); |
There was a problem hiding this comment.
| .reduce((value, element) => value + element); | |
| .reduce((a, b) => a + b); |
| notifyListeners(); | ||
| } | ||
|
|
||
| void showAutocompleter() { |
There was a problem hiding this comment.
| void showAutocompleter() { | |
| void showSuggestions() { |
| 'Something went wrong. Please try again later or create a GitHub issue'; | ||
| const kProcessingStartedText = 'The processing has started\n'; | ||
| const kProcessingStartedOptionsText = | ||
| 'The processing has started with pipeline options: '; |
There was a problem hiding this comment.
| 'The processing has started with pipeline options: '; | |
| 'The processing has been started with the pipeline options: '; |
|
|
||
| import 'native_platform.dart'; | ||
|
|
||
| extension LogicalKeyboardKeyExtension on LogicalKeyboardKey { |
There was a problem hiding this comment.
| extension LogicalKeyboardKeyExtension on LogicalKeyboardKey { | |
| class LogicalKeyboardKeyExtension { |
| return byType(MoreActions); | ||
| } | ||
|
|
||
| Finder pipelineOptions() { |
There was a problem hiding this comment.
| Finder pipelineOptions() { | |
| Finder pipelineOptionsDropdown() { |
| Finder verticallyAt(int index, WidgetTester wt) => | ||
| _alignedIndexAt(index, Axis.vertical, wt); | ||
|
|
||
| Finder _alignedIndexAt(int index, Axis axis, WidgetTester wt) { |
There was a problem hiding this comment.
nthOnAxis or atIndexOnAxis?
| if (a == b) { | ||
| return 0; | ||
| } else if (a > b) { | ||
| return 1; | ||
| } else { | ||
| return -1; | ||
| } |
There was a problem hiding this comment.
return (a - b).sign.toInt();| //ignore | ||
| } | ||
|
|
||
| await wt.wait(duration); |
There was a problem hiding this comment.
This worked for me instead, and the test is green:
await wt.pump();
await Future.delayed(duration);Can this be used instead of this function? If not, then why?
There was a problem hiding this comment.
this approach freezes main isolate (watch the animation on the button with both approaches)
There was a problem hiding this comment.
To me this is a lesser evil than inventing a method with a vague name without being sure how exactly it does what it does. We can just test the result.
There was a problem hiding this comment.
What is the definition of "freeze"?
I believe it is impossible to put the thread to sleep in JavaScript.
I guess what appears "frozen" is just animations not ticking or ticking but not rendering.
If pump() ticks animations once and schedules a render, then for the test purpose there technically is no difference between calling it once vs calling it in a loop, it's just that with the loop we are visually satisfied with smooth animation at the cost of active waiting and complexity. I suggest keeping things simple.
There was a problem hiding this comment.
added pumpAndSettleNoException
|
A successful run of this test in GitHub workflow: https://github.com/apache/beam/actions/runs/4172006277/jobs/7222584726 |
…25329_fix-cors-issue-when
…25329_fix-cors-issue-when-no-internet
* Refactor output tabs, test embedded playground (apache#25136) * Clean up (apache#25136)
|
lgtm thanks y'all! |
* Integration test to load the default example of the default SDK and change the example (apache#24730) (apache#24729) * Fix formatting and README (apache#24730) * Support collection v1.17.0 (apache#24730) * LoadingIndicator on chaning examples, remove duplicating licenses (apache#24730) * Add a missing license header (apache#24730) * Integration test for changing SDK and running code (apache#24779) (#382) * Integration test for changing SDK and running code (apache#24779) * Rename an integration test (apache#24779) * Use enum to switch SDK in integration test (apache#24779) * Find SDK in a dropdown by key (apache#24779) * Add a TODO (apache#24779) * Fix exports (apache#24779) * Issue24779 integration changing sdk from 24370 (#387) * Integration test for changing SDK and running code (apache#24779) * Rename an integration test (apache#24779) * Use enum to switch SDK in integration test (apache#24779) * Find SDK in a dropdown by key (apache#24779) * Add a TODO (apache#24779) * Fix exports (apache#24779) * Integration tests miscellaneous UI (#383) * miscellaneous ui integration tests * reverted pubspec.lock * gradle tasks ordered alhpabetically * integration tests refactoring * clean code * integration tests miscellaneous ui fix pr * rename method * added layout adaptivity * A minor cleanup (apache#24779) Co-authored-by: Dmitry Repin <mr.malarg@gmail.com> * integration tests run and editing * example selector test * minor fixes * rat * fix pr * minor * minor * rat * integration test finder written * integration test minor fixes * minor fixes * removed comment * minor fixes * playground integration tests minor fixes * integration test pumpAnSettleNoException * integration test shortcut refactor * integration test another changing shortcuts running * upgrade to flutter 3.7.1 * workaround comment * playground frontend updated major versions * issues 25329 25331 25336 * 25329 extract connectivity extension to separate file * Upgrade Flutter to 3.7.3 in integration tests (apache#24730) * Fix integration test (apache#24730) * fix cors issue and added mouse scroll to tags * Upgrade Flutter in Dockerfile (apache#24720) * sorting moved to model * sorting moved to model * sorting moved to model * bugs fix * issue 25278 * fix pr * quites fix in en.yaml * Fix not loading default example (apache#25528) * fix compile error * Refactor output tabs, test embedded playground (apache#25136) (#439) * Refactor output tabs, test embedded playground (apache#25136) * Clean up (apache#25136) * Change example paths to IDs in integration tests * Panning the graph tab (apache#25118) --------- Co-authored-by: Alexey Inkin <alexey.inkin@akvelon.com> Co-authored-by: alexeyinkin <leha@inkin.ru>
Playground integration test run and editing
Resolves #24936
Resolves #24923
Resolves #24922
Resolves #24921
Resolves #24937
Resolves #24938
Resolves #24939
Resolves #24940
Resolves #24941
Resolves #25051
Resolves #25052
Resolves #25053
Resolves #25278
resolves #25329
resolves #25331
resolves #25336
resolves #25332
resolves #25333
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.