This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Upgrades to felt (running on multiple modes, multiple backends, single test target option) #22260
Merged
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
40848e0
testing running the tests on all build modes
f2213f3
don't run debug mode on other browsers
75465a3
fix platform message test failures
eae835f
some cleanup. change dispose platform channel message
5889d0c
adding flags to control the integration tests better with felt
8117c92
running tests by target name, selecting web rendering backend
3d7e145
fix conditions
0f13714
carrying some conditions to helper methods. Adding comments
dfb5353
create a blocked list for failing canvaskit test
78fad8e
parse parameters before all integration tests
9b5f830
Give better warning to developers for tests that are blocked for CI
2598808
address some reviwer comments (more remains)
1812790
remove named parameters
73fab26
also run with auto mode
c997661
add verbose option
f373ba6
reduce the number of tests running. skip url_test for now
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix conditions
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -160,19 +160,8 @@ class IntegrationTestsManager { | |
| int numberOfPassedTests = 0; | ||
| int numberOfFailedTests = 0; | ||
|
|
||
| Set<String> buildModes; | ||
| if (_buildModeSelected) { | ||
| final String mode = IntegrationTestsArgumentParser.instance.buildMode; | ||
| if (mode == 'debug' && _browser != 'chrome') { | ||
| throw ToolException('Debug mode is only supported for Chrome.'); | ||
| } else { | ||
| buildModes = <String>{mode}; | ||
| } | ||
| } else { | ||
| buildModes = _browser == 'chrome' | ||
| ? {'debug', 'profile', 'release'} | ||
| : {'profile', 'release'}; | ||
| } | ||
| final Set<String> buildModes = _getBuildModes(); | ||
|
|
||
| for (String fileName in e2eTestsToRun) { | ||
| await _runTestsTarget(directory, fileName, buildModes); | ||
| } | ||
|
|
@@ -228,13 +217,10 @@ class IntegrationTestsManager { | |
| } | ||
| final IntegrationArguments arguments = | ||
| IntegrationArguments.fromBrowser(_browser); | ||
| final List<String> testArgs = arguments.getTestArguments(testName, mode); | ||
| if (canvaskitBackend) { | ||
| testArgs.add('--web-renderer=canvaskit'); | ||
| } | ||
| final int exitCode = await runProcess( | ||
| executable, | ||
| arguments.getTestArguments(testName, mode), | ||
| arguments.getTestArguments(testName, mode, | ||
| isCanvaskitBackend: canvaskitBackend), | ||
| workingDirectory: directory.path, | ||
| environment: enviroment, | ||
| ); | ||
|
|
@@ -251,6 +237,23 @@ class IntegrationTestsManager { | |
| } | ||
| } | ||
|
|
||
| Set<String> _getBuildModes() { | ||
| Set<String> buildModes; | ||
| if (_buildModeSelected) { | ||
| final String mode = IntegrationTestsArgumentParser.instance.buildMode; | ||
| if (mode == 'debug' && _browser != 'chrome') { | ||
| throw ToolException('Debug mode is only supported for Chrome.'); | ||
| } else { | ||
| buildModes = <String>{mode}; | ||
| } | ||
| } else { | ||
| buildModes = _browser == 'chrome' | ||
| ? {'debug', 'profile', 'release'} | ||
| : {'profile', 'release'}; | ||
| } | ||
| return buildModes; | ||
| } | ||
|
|
||
| /// Validate the directory has a `pubspec.yaml` file and a `test_driver` | ||
| /// directory. | ||
| /// | ||
|
|
@@ -405,14 +408,16 @@ abstract class IntegrationArguments { | |
| } | ||
| } | ||
|
|
||
| List<String> getTestArguments(String testName, String mode); | ||
| List<String> getTestArguments(String testName, String mode, | ||
| {bool isCanvaskitBackend = false}); | ||
|
||
|
|
||
| String getCommandToRun(String testName, String mode); | ||
| } | ||
|
|
||
| /// Arguments to give `flutter drive` to run the integration tests on Chrome. | ||
| class ChromeIntegrationArguments extends IntegrationArguments { | ||
| List<String> getTestArguments(String testName, String mode) { | ||
| List<String> getTestArguments(String testName, String mode, | ||
| {bool isCanvaskitBackend = false}) { | ||
| return <String>[ | ||
| 'drive', | ||
| '--target=test_driver/${testName}', | ||
|
|
@@ -423,10 +428,12 @@ class ChromeIntegrationArguments extends IntegrationArguments { | |
| if (isLuci) '--chrome-binary=${preinstalledChromeExecutable()}', | ||
| '--headless', | ||
| '--local-engine=host_debug_unopt', | ||
| if (isCanvaskitBackend) '--web-renderer=canvaskit', | ||
| ]; | ||
| } | ||
|
|
||
| String getCommandToRun(String testName, String mode) { | ||
| String getCommandToRun(String testName, String mode, | ||
| {bool isCanvaskitBackend = false}) { | ||
| String statementToRun = 'flutter drive ' | ||
| '--target=test_driver/${testName} -d web-server --$mode ' | ||
| '--browser-name=chrome --local-engine=host_debug_unopt'; | ||
|
|
@@ -440,7 +447,8 @@ class ChromeIntegrationArguments extends IntegrationArguments { | |
|
|
||
| /// Arguments to give `flutter drive` to run the integration tests on Firefox. | ||
| class FirefoxIntegrationArguments extends IntegrationArguments { | ||
| List<String> getTestArguments(String testName, String mode) { | ||
| List<String> getTestArguments(String testName, String mode, | ||
| {bool isCanvaskitBackend = false}) { | ||
nturgut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return <String>[ | ||
| 'drive', | ||
| '--target=test_driver/${testName}', | ||
|
|
@@ -450,18 +458,21 @@ class FirefoxIntegrationArguments extends IntegrationArguments { | |
| '--browser-name=firefox', | ||
| '--headless', | ||
| '--local-engine=host_debug_unopt', | ||
| if (isCanvaskitBackend) '--web-renderer=canvaskit', | ||
| ]; | ||
| } | ||
|
|
||
| String getCommandToRun(String testName, String mode) => | ||
| String getCommandToRun(String testName, String mode, | ||
| {bool isCanvaskitBackend = false}) => | ||
| 'flutter ${getTestArguments(testName, mode).join(' ')}'; | ||
| } | ||
|
|
||
| /// Arguments to give `flutter drive` to run the integration tests on Safari. | ||
| class SafariIntegrationArguments extends IntegrationArguments { | ||
| SafariIntegrationArguments(); | ||
|
|
||
| List<String> getTestArguments(String testName, String mode) { | ||
| List<String> getTestArguments(String testName, String mode, | ||
| {bool isCanvaskitBackend = false}) { | ||
| return <String>[ | ||
| 'drive', | ||
| '--target=test_driver/${testName}', | ||
|
|
@@ -470,10 +481,12 @@ class SafariIntegrationArguments extends IntegrationArguments { | |
| '--$mode', | ||
| '--browser-name=safari', | ||
| '--local-engine=host_debug_unopt', | ||
| if (isCanvaskitBackend) '--web-renderer=canvaskit', | ||
| ]; | ||
| } | ||
|
|
||
| String getCommandToRun(String testName, String mode) => | ||
| String getCommandToRun(String testName, String mode, | ||
| {bool isCanvaskitBackend = false}) => | ||
| 'flutter ${getTestArguments(testName, mode).join(' ')}'; | ||
| } | ||
|
|
||
|
|
@@ -528,7 +541,7 @@ class IntegrationTestsArgumentParser { | |
| 'See https://flutter.dev/docs/testing/build-modes for more ' | ||
| 'details on the build modes.') | ||
| ..addOption('rendering-backend', | ||
nturgut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| defaultsTo: 'html', | ||
| defaultsTo: '', | ||
| help: 'By default both `html` and `canvaskit` rendering backends are ' | ||
nturgut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ' tested when running integration tests. If this option is set ' | ||
| ' only one of these backends will be used. `canvaskit` and `html`' | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the built-in knowledge of which browsers should use which modes is adding complexity without much benefit. For example, one might attempt to run a test in Edge, but will need to change
feltcode in order to do it.I would instead run in one mode only and in the CI script invoke
feltmultiple time with different modes, perhaps even in different subshards.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
felt testI want them to see all that is failing and passing instead of running the multiple times with different build modes.