Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d8034538
Unverified
Commit
d8034538
authored
Nov 11, 2021
by
Core
Committed by
GitHub
Nov 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: enable flavor option on test command (#89045)
parent
24097328
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
4 deletions
+89
-4
flavors_test.dart
dev/devicelab/bin/tasks/flavors_test.dart
+7
-1
flavors_test_ios.dart
dev/devicelab/bin/tasks/flavors_test_ios.dart
+7
-1
flavors_test_win.dart
dev/devicelab/bin/tasks/flavors_test_win.dart
+7
-1
integration_tests.dart
dev/devicelab/lib/tasks/integration_tests.dart
+16
-1
integration_test.dart
...tion_tests/flavors/integration_test/integration_test.dart
+21
-0
main.dart
dev/integration_tests/flavors/lib/main.dart
+4
-0
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+1
-0
test_test.dart
...flutter_tools/test/commands.shard/hermetic/test_test.dart
+26
-0
No files found.
dev/devicelab/bin/tasks/flavors_test.dart
View file @
d8034538
...
@@ -4,9 +4,15 @@
...
@@ -4,9 +4,15 @@
import
'package:flutter_devicelab/framework/devices.dart'
;
import
'package:flutter_devicelab/framework/devices.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/task_result.dart'
;
import
'package:flutter_devicelab/tasks/integration_tests.dart'
;
import
'package:flutter_devicelab/tasks/integration_tests.dart'
;
Future
<
void
>
main
()
async
{
Future
<
void
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
await
task
(
createFlavorsTest
());
await
task
(()
async
{
await
createFlavorsTest
().
call
();
await
createIntegrationTestFlavorsTest
().
call
();
return
TaskResult
.
success
(
null
);
});
}
}
dev/devicelab/bin/tasks/flavors_test_ios.dart
View file @
d8034538
...
@@ -4,9 +4,15 @@
...
@@ -4,9 +4,15 @@
import
'package:flutter_devicelab/framework/devices.dart'
;
import
'package:flutter_devicelab/framework/devices.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/task_result.dart'
;
import
'package:flutter_devicelab/tasks/integration_tests.dart'
;
import
'package:flutter_devicelab/tasks/integration_tests.dart'
;
Future
<
void
>
main
()
async
{
Future
<
void
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
ios
;
deviceOperatingSystem
=
DeviceOperatingSystem
.
ios
;
await
task
(
createFlavorsTest
());
await
task
(()
async
{
await
createFlavorsTest
().
call
();
await
createIntegrationTestFlavorsTest
().
call
();
return
TaskResult
.
success
(
null
);
});
}
}
dev/devicelab/bin/tasks/flavors_test_win.dart
View file @
d8034538
...
@@ -4,9 +4,15 @@
...
@@ -4,9 +4,15 @@
import
'package:flutter_devicelab/framework/devices.dart'
;
import
'package:flutter_devicelab/framework/devices.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/task_result.dart'
;
import
'package:flutter_devicelab/tasks/integration_tests.dart'
;
import
'package:flutter_devicelab/tasks/integration_tests.dart'
;
Future
<
void
>
main
()
async
{
Future
<
void
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
await
task
(
createFlavorsTest
());
await
task
(()
async
{
await
createFlavorsTest
().
call
();
await
createIntegrationTestFlavorsTest
().
call
();
return
TaskResult
.
success
(
null
);
});
}
}
dev/devicelab/lib/tasks/integration_tests.dart
View file @
d8034538
...
@@ -29,6 +29,14 @@ TaskFunction createFlavorsTest() {
...
@@ -29,6 +29,14 @@ TaskFunction createFlavorsTest() {
);
);
}
}
TaskFunction
createIntegrationTestFlavorsTest
(
)
{
return
IntegrationTest
(
'
${flutterDirectory.path}
/dev/integration_tests/flavors'
,
'integration_test/integration_test.dart'
,
extraOptions:
<
String
>[
'--flavor'
,
'paid'
],
);
}
TaskFunction
createExternalUiIntegrationTest
(
)
{
TaskFunction
createExternalUiIntegrationTest
(
)
{
return
DriverTest
(
return
DriverTest
(
'
${flutterDirectory.path}
/dev/integration_tests/external_ui'
,
'
${flutterDirectory.path}
/dev/integration_tests/external_ui'
,
...
@@ -166,10 +174,16 @@ class DriverTest {
...
@@ -166,10 +174,16 @@ class DriverTest {
}
}
class
IntegrationTest
{
class
IntegrationTest
{
IntegrationTest
(
this
.
testDirectory
,
this
.
testTarget
);
IntegrationTest
(
this
.
testDirectory
,
this
.
testTarget
,
{
this
.
extraOptions
=
const
<
String
>[],
}
);
final
String
testDirectory
;
final
String
testDirectory
;
final
String
testTarget
;
final
String
testTarget
;
final
List
<
String
>
extraOptions
;
Future
<
TaskResult
>
call
()
{
Future
<
TaskResult
>
call
()
{
return
inDirectory
<
TaskResult
>(
testDirectory
,
()
async
{
return
inDirectory
<
TaskResult
>(
testDirectory
,
()
async
{
...
@@ -183,6 +197,7 @@ class IntegrationTest {
...
@@ -183,6 +197,7 @@ class IntegrationTest {
'-d'
,
'-d'
,
deviceId
,
deviceId
,
testTarget
,
testTarget
,
...
extraOptions
,
];
];
await
flutter
(
'test'
,
options:
options
);
await
flutter
(
'test'
,
options:
options
);
...
...
dev/integration_tests/flavors/integration_test/integration_test.dart
0 → 100644
View file @
d8034538
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flavors/main.dart'
as
app
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:integration_test/integration_test.dart'
;
void
main
(
)
{
IntegrationTestWidgetsFlutterBinding
.
ensureInitialized
();
group
(
'Flavor Test'
,
()
{
testWidgets
(
'check flavor'
,
(
WidgetTester
tester
)
async
{
app
.
runMainApp
();
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'paid'
),
findsOneWidget
);
});
});
}
dev/integration_tests/flavors/lib/main.dart
View file @
d8034538
...
@@ -8,6 +8,10 @@ import 'package:flutter_driver/driver_extension.dart';
...
@@ -8,6 +8,10 @@ import 'package:flutter_driver/driver_extension.dart';
void
main
(
)
{
void
main
(
)
{
enableFlutterDriverExtension
();
enableFlutterDriverExtension
();
runMainApp
();
}
void
runMainApp
(
)
{
runApp
(
const
Center
(
child:
Flavor
()));
runApp
(
const
Center
(
child:
Flavor
()));
}
}
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
d8034538
...
@@ -73,6 +73,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
...
@@ -73,6 +73,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
usesDartDefineOption
();
usesDartDefineOption
();
usesWebRendererOption
();
usesWebRendererOption
();
usesDeviceUserOption
();
usesDeviceUserOption
();
usesFlavorOption
();
argParser
argParser
..
addMultiOption
(
'name'
,
..
addMultiOption
(
'name'
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/test_test.dart
View file @
d8034538
...
@@ -605,6 +605,32 @@ dev_dependencies:
...
@@ -605,6 +605,32 @@ dev_dependencies:
]),
]),
});
});
testUsingContext
(
'Integration tests given flavor'
,
()
async
{
final
FakeFlutterTestRunner
testRunner
=
FakeFlutterTestRunner
(
0
);
final
TestCommand
testCommand
=
TestCommand
(
testRunner:
testRunner
);
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
testCommand
);
await
commandRunner
.
run
(
const
<
String
>[
'test'
,
'--no-pub'
,
'--flavor'
,
'dev'
,
'integration_test'
,
]);
expect
(
testRunner
.
lastDebuggingOptionsValue
.
buildInfo
.
flavor
,
contains
(
'dev'
),
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
DeviceManager:
()
=>
_FakeDeviceManager
(<
Device
>[
FakeDevice
(
'ephemeral'
,
'ephemeral'
,
type:
PlatformType
.
android
),
]),
});
testUsingContext
(
'Builds the asset manifest by default'
,
()
async
{
testUsingContext
(
'Builds the asset manifest by default'
,
()
async
{
final
FakeFlutterTestRunner
testRunner
=
FakeFlutterTestRunner
(
0
);
final
FakeFlutterTestRunner
testRunner
=
FakeFlutterTestRunner
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment