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
111a7d01
Unverified
Commit
111a7d01
authored
Aug 23, 2022
by
hellohuanlin
Committed by
GitHub
Aug 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[platform_view]retry launch if it fails to launch for xcuitest (#110030)
parent
129fa769
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
PlatformViewUITests.m
..._view_tests/ios/PlatformViewUITests/PlatformViewUITests.m
+23
-7
No files found.
dev/integration_tests/ios_platform_view_tests/ios/PlatformViewUITests/PlatformViewUITests.m
View file @
111a7d01
...
...
@@ -26,16 +26,32 @@ static const CGFloat kStandardTimeOut = 60.0;
[
super
setUp
];
self
.
continueAfterFailure
=
NO
;
self
.
app
=
[[
XCUIApplication
alloc
]
init
];
[
self
.
app
launch
];
// Retry launching the app if it fails to launch.
// This is trying to fix a "failed to terminate" failure, which is likely a bug in Xcode.
// The solution is based on https://stackoverflow.com/questions/41872848/xctests-failing-to-launch-app-in-simulator-intermittently
int
remainingLaunchCount
=
10
;
while
(
true
)
{
self
.
app
=
[[
XCUIApplication
alloc
]
init
];
[
self
.
app
launch
];
remainingLaunchCount
-=
1
;
[
NSThread
sleepForTimeInterval
:
3
];
if
(
self
.
app
.
exists
)
{
// success launch
break
;
}
if
(
remainingLaunchCount
>
0
)
{
NSLog
(
@"Retry launch with remaining launch count %d"
,
remainingLaunchCount
);
[
self
.
app
terminate
];
[
NSThread
sleepForTimeInterval
:
3
];
continue
;
}
NSLog
(
@"Failed to launch"
);
}
}
-
(
void
)
tearDown
{
// This is trying to fix a "failed to terminate" failure, which is likely a bug in Xcode.
// In theory the terminate call is not necessary, but many has encountered this similar
// issue, and fixed it by terminating the app and relaunching it if needed for each test.
// Here we simply try terminating the app in tearDown, but if it does not work,
// then alternative solution is to terminate and relaunch the app.
[
self
.
app
terminate
];
[
super
tearDown
];
}
...
...
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