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
05d55157
Unverified
Commit
05d55157
authored
Jun 19, 2021
by
Jenn Magder
Committed by
GitHub
Jun 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set up iOS native integration_tests in ui example project (#84890)
parent
1607ef5b
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
338 additions
and
65 deletions
+338
-65
native_ui_tests_ios32.dart
dev/devicelab/bin/tasks/native_ui_tests_ios32.dart
+2
-59
ios.dart
dev/devicelab/lib/framework/ios.dart
+57
-0
integration_tests.dart
dev/devicelab/lib/tasks/integration_tests.dart
+14
-0
integration_test.dart
...tegration_tests/ui/integration_test/integration_test.dart
+3
-0
Podfile
dev/integration_tests/ui/ios/Podfile
+4
-0
project.pbxproj
...integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj
+205
-0
Runner.xcscheme
...s/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+12
-6
contents.xcworkspacedata
..._tests/ui/ios/Runner.xcworkspace/contents.xcworkspacedata
+3
-0
IDEWorkspaceChecks.plist
.../Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+8
-0
Info.plist
dev/integration_tests/ui/ios/RunnerTests/Info.plist
+22
-0
RunnerTests.m
dev/integration_tests/ui/ios/RunnerTests/RunnerTests.m
+8
-0
No files found.
dev/devicelab/bin/tasks/native_ui_tests_ios32.dart
View file @
05d55157
...
@@ -4,14 +4,11 @@
...
@@ -4,14 +4,11 @@
// @dart = 2.8
// @dart = 2.8
import
'dart:io'
;
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/
host_agent
.dart'
;
import
'package:flutter_devicelab/framework/
ios
.dart'
;
import
'package:flutter_devicelab/framework/task_result.dart'
;
import
'package:flutter_devicelab/framework/task_result.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
import
'package:path/path.dart'
as
path
;
Future
<
void
>
main
()
async
{
Future
<
void
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
ios
;
deviceOperatingSystem
=
DeviceOperatingSystem
.
ios
;
...
@@ -38,62 +35,8 @@ Future<void> main() async {
...
@@ -38,62 +35,8 @@ Future<void> main() async {
});
});
section
(
'Run platform unit tests'
);
section
(
'Run platform unit tests'
);
final
Device
device
=
await
devices
.
workingDevice
;
final
Device
device
=
await
devices
.
workingDevice
;
final
Map
<
String
,
String
>
environment
=
Platform
.
environment
;
await
runNativeIosXcodeTests
(
device
,
projectDirectory
);
// If not running on CI, inject the Flutter team code signing properties.
final
String
developmentTeam
=
environment
[
'FLUTTER_XCODE_DEVELOPMENT_TEAM'
]
??
'S8QB4VV633'
;
final
String
codeSignStyle
=
environment
[
'FLUTTER_XCODE_CODE_SIGN_STYLE'
];
final
String
provisioningProfile
=
environment
[
'FLUTTER_XCODE_PROVISIONING_PROFILE_SPECIFIER'
];
final
String
resultBundleTemp
=
Directory
.
systemTemp
.
createTempSync
(
'flutter_native_ui_tests_ios32_xcresult.'
).
path
;
final
String
resultBundlePath
=
path
.
join
(
resultBundleTemp
,
'result'
);
final
int
testResultExit
=
await
exec
(
'xcodebuild'
,
<
String
>[
'-workspace'
,
'Runner.xcworkspace'
,
'-scheme'
,
'Runner'
,
'-configuration'
,
'Release'
,
'-destination'
,
'id=
${device.deviceId}
'
,
'-resultBundlePath'
,
resultBundlePath
,
'test'
,
'COMPILER_INDEX_STORE_ENABLE=NO'
,
'DEVELOPMENT_TEAM=
$developmentTeam
'
,
if
(
codeSignStyle
!=
null
)
'CODE_SIGN_STYLE=
$codeSignStyle
'
,
if
(
provisioningProfile
!=
null
)
'PROVISIONING_PROFILE_SPECIFIER=
$provisioningProfile
'
,
],
workingDirectory:
path
.
join
(
projectDirectory
,
'ios'
),
canFail:
true
,
);
if
(
testResultExit
!=
0
)
{
final
Directory
dumpDirectory
=
hostAgent
.
dumpDirectory
;
if
(
dumpDirectory
!=
null
)
{
// Zip the test results to the artifacts directory for upload.
final
String
zipPath
=
path
.
join
(
dumpDirectory
.
path
,
'native_ui_tests_ios32-
${DateTime.now().toLocal().toIso8601String()}
.zip'
);
await
exec
(
'zip'
,
<
String
>[
'-r'
,
'-9'
,
zipPath
,
'result.xcresult'
,
],
workingDirectory:
resultBundleTemp
,
canFail:
true
,
// Best effort to get the logs.
);
}
return
TaskResult
.
failure
(
'Platform unit tests failed'
);
}
return
TaskResult
.
success
(
null
);
return
TaskResult
.
success
(
null
);
});
});
...
...
dev/devicelab/lib/framework/ios.dart
View file @
05d55157
...
@@ -5,7 +5,13 @@
...
@@ -5,7 +5,13 @@
// @dart = 2.8
// @dart = 2.8
import
'dart:convert'
;
import
'dart:convert'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'devices.dart'
;
import
'host_agent.dart'
;
import
'task_result.dart'
;
import
'utils.dart'
;
import
'utils.dart'
;
typedef
SimulatorFunction
=
Future
<
void
>
Function
(
String
deviceId
);
typedef
SimulatorFunction
=
Future
<
void
>
Function
(
String
deviceId
);
...
@@ -144,3 +150,54 @@ Future<void> removeIOSimulator(String deviceId) async {
...
@@ -144,3 +150,54 @@ Future<void> removeIOSimulator(String deviceId) async {
);
);
}
}
}
}
Future
<
void
>
runNativeIosXcodeTests
(
Device
device
,
String
projectDirectory
)
async
{
final
Map
<
String
,
String
>
environment
=
Platform
.
environment
;
// If not running on CI, inject the Flutter team code signing properties.
final
String
developmentTeam
=
environment
[
'FLUTTER_XCODE_DEVELOPMENT_TEAM'
]
??
'S8QB4VV633'
;
final
String
resultBundleTemp
=
Directory
.
systemTemp
.
createTempSync
(
'flutter_native_ios_tests_xcresult.'
).
path
;
final
String
resultBundlePath
=
path
.
join
(
resultBundleTemp
,
'result'
);
final
int
testResultExit
=
await
exec
(
'xcodebuild'
,
<
String
>[
'-workspace'
,
'Runner.xcworkspace'
,
'-scheme'
,
'Runner'
,
'-configuration'
,
'Release'
,
'-destination'
,
'id=
${device.deviceId}
'
,
'-resultBundlePath'
,
resultBundlePath
,
'test'
,
'COMPILER_INDEX_STORE_ENABLE=NO'
,
'DEVELOPMENT_TEAM=
$developmentTeam
'
,
],
workingDirectory:
path
.
join
(
projectDirectory
,
'ios'
),
canFail:
true
,
);
if
(
testResultExit
!=
0
)
{
final
Directory
dumpDirectory
=
hostAgent
.
dumpDirectory
;
if
(
dumpDirectory
!=
null
)
{
// Zip the test results to the artifacts directory for upload.
final
String
zipPath
=
path
.
join
(
dumpDirectory
.
path
,
'xcode_test_results_-
${DateTime.now().toLocal().toIso8601String()}
.zip'
);
await
exec
(
'zip'
,
<
String
>[
'-r'
,
'-9'
,
zipPath
,
'result.xcresult'
,
],
workingDirectory:
resultBundleTemp
,
canFail:
true
,
// Best effort to get the logs.
);
}
throw
TaskResult
.
failure
(
'Xcode iOS unit tests failed'
);
}
}
dev/devicelab/lib/tasks/integration_tests.dart
View file @
05d55157
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
import
'../framework/devices.dart'
;
import
'../framework/devices.dart'
;
import
'../framework/framework.dart'
;
import
'../framework/framework.dart'
;
import
'../framework/ios.dart'
;
import
'../framework/task_result.dart'
;
import
'../framework/task_result.dart'
;
import
'../framework/utils.dart'
;
import
'../framework/utils.dart'
;
...
@@ -190,6 +191,19 @@ class IntegrationTest {
...
@@ -190,6 +191,19 @@ class IntegrationTest {
];
];
await
flutter
(
'test'
,
options:
options
);
await
flutter
(
'test'
,
options:
options
);
if
(
device
is
IosDevice
)
{
section
(
'Run integration_test from Xcode'
);
final
List
<
String
>
options
=
<
String
>[
'ios'
,
'--config-only'
,
testTarget
,
];
await
flutter
(
'build'
,
options:
options
);
await
runNativeIosXcodeTests
(
device
,
testDirectory
);
}
return
TaskResult
.
success
(
null
);
return
TaskResult
.
success
(
null
);
});
});
}
}
...
...
dev/integration_tests/ui/integration_test/integration_test.dart
View file @
05d55157
...
@@ -3,10 +3,13 @@
...
@@ -3,10 +3,13 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:integration_test/integration_test.dart'
;
import
'package:integration_ui/build_mode.dart'
as
app
;
import
'package:integration_ui/build_mode.dart'
as
app
;
void
main
(
)
{
void
main
(
)
{
group
(
'Integration Test'
,
()
{
group
(
'Integration Test'
,
()
{
IntegrationTestWidgetsFlutterBinding
.
ensureInitialized
();
testWidgets
(
'smoke test'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'smoke test'
,
(
WidgetTester
tester
)
async
{
app
.
main
();
app
.
main
();
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
...
...
dev/integration_tests/ui/ios/Podfile
View file @
05d55157
...
@@ -29,6 +29,10 @@ flutter_ios_podfile_setup
...
@@ -29,6 +29,10 @@ flutter_ios_podfile_setup
target
'Runner'
do
target
'Runner'
do
flutter_install_all_ios_pods
File
.
dirname
(
File
.
realpath
(
__FILE__
))
flutter_install_all_ios_pods
File
.
dirname
(
File
.
realpath
(
__FILE__
))
target
'RunnerTests'
do
inherit!
:search_paths
end
end
end
post_install
do
|
installer
|
post_install
do
|
installer
|
...
...
dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj
View file @
05d55157
This diff is collapsed.
Click to expand it.
dev/integration_tests/ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
View file @
05d55157
...
@@ -27,8 +27,6 @@
...
@@ -27,8 +27,6 @@
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv =
"YES"
>
shouldUseLaunchSchemeArgsEnv =
"YES"
>
<Testables>
</Testables>
<MacroExpansion>
<MacroExpansion>
<BuildableReference
<BuildableReference
BuildableIdentifier =
"primary"
BuildableIdentifier =
"primary"
...
@@ -38,8 +36,18 @@
...
@@ -38,8 +36,18 @@
ReferencedContainer =
"container:Runner.xcodeproj"
>
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</BuildableReference>
</MacroExpansion>
</MacroExpansion>
<AdditionalOptions>
<Testables>
</AdditionalOptions>
<TestableReference
skipped =
"NO"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"F708CDE82677EA0F00ABB9ED"
BuildableName =
"RunnerTests.xctest"
BlueprintName =
"RunnerTests"
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
</TestAction>
<LaunchAction
<LaunchAction
buildConfiguration =
"Debug"
buildConfiguration =
"Debug"
...
@@ -61,8 +69,6 @@
...
@@ -61,8 +69,6 @@
ReferencedContainer =
"container:Runner.xcodeproj"
>
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</BuildableReference>
</BuildableProductRunnable>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
</LaunchAction>
<ProfileAction
<ProfileAction
buildConfiguration =
"Profile"
buildConfiguration =
"Profile"
...
...
dev/integration_tests/ui/ios/Runner.xcworkspace/contents.xcworkspacedata
View file @
05d55157
...
@@ -4,4 +4,7 @@
...
@@ -4,4 +4,7 @@
<FileRef
<FileRef
location =
"group:Runner.xcodeproj"
>
location =
"group:Runner.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
location =
"group:Pods/Pods.xcodeproj"
>
</FileRef>
</Workspace>
</Workspace>
dev/integration_tests/ui/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
0 → 100644
View file @
05d55157
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
IDEDidComputeMac32BitWarning
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
/plist
>
dev/integration_tests/ui/ios/RunnerTests/Info.plist
0 → 100644
View file @
05d55157
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
$
(
DEVELOPMENT_LANGUAGE
)<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
$
(
EXECUTABLE_NAME
)<
/string
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
<
string
>
$
(
PRODUCT_BUNDLE_IDENTIFIER
)<
/string
>
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
string
>
6.0
<
/string
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
$
(
PRODUCT_NAME
)<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
$
(
PRODUCT_BUNDLE_PACKAGE_TYPE
)<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.0
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
<
/string
>
<
/
d
i
c
t
>
<
/plist
>
dev/integration_tests/ui/ios/RunnerTests/RunnerTests.m
0 → 100644
View file @
05d55157
//
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
XCTest
;
@
import
integration
_
test
;
INTEGRATION
_
TEST
_
IOS
_
RUNNER
(
RunnerTests
)
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