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
5217f89d
Unverified
Commit
5217f89d
authored
Aug 25, 2022
by
hellohuanlin
Committed by
GitHub
Aug 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[platform_view]delete previously installed app if needed (#110201)
parent
605661c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
+26
-21
PlatformViewUITests.m
..._view_tests/ios/PlatformViewUITests/PlatformViewUITests.m
+26
-21
No files found.
dev/integration_tests/ios_platform_view_tests/ios/PlatformViewUITests/PlatformViewUITests.m
View file @
5217f89d
...
...
@@ -26,29 +26,34 @@ static const CGFloat kStandardTimeOut = 60.0;
[
super
setUp
];
self
.
continueAfterFailure
=
NO
;
// 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
;
// Delete the previously installed app if needed before running.
// This is to address "Failed to terminate" failure.
// The solution is based on https://stackoverflow.com/questions/50016018/uitest-failed-to-terminate-com-test-abc3708-after-60-0s-state-is-still-runnin
XCUIApplication
*
springboard
=
[[
XCUIApplication
alloc
]
initWithBundleIdentifier
:
@"com.apple.springboard"
];
[
springboard
activate
];
XCUIElement
*
appIcon
=
springboard
.
icons
[
@"ios_platform_view_tests"
];
if
([
appIcon
waitForExistenceWithTimeout
:
kStandardTimeOut
])
{
NSLog
(
@"Deleting previously installed app."
);
// Make icons wiggle
[
appIcon
pressForDuration
:
3
];
// Tap the "x" button
[
appIcon
.
buttons
[
@"DeleteButton"
]
tap
];
// Tap the delete confirmation
[
springboard
.
alerts
.
buttons
[
@"Delete App"
]
tap
];
// Tap the second delete confirmation
[
springboard
.
alerts
.
buttons
[
@"Delete"
]
tap
];
// Press home button to stop wiggling
[
XCUIDevice
.
sharedDevice
pressButton
:
XCUIDeviceButtonHome
];
[
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"
);
}
else
{
NSLog
(
@"No previously installed app found."
);
}
self
.
app
=
[[
XCUIApplication
alloc
]
init
];
[
self
.
app
launch
];
}
-
(
void
)
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