Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[platform_view]use cmd to uninstall the app #111139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions dev/devicelab/bin/tasks/native_platform_view_ui_tests_ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ Future<void> main() async {
final String projectDirectory = '${flutterDirectory.path}/dev/integration_tests/ios_platform_view_tests';

await inDirectory(projectDirectory, () async {

// To address "Failed to terminate" failure.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits: link the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. it got landed before my force push. will just leave it as it is.

section('Uninstall previously installed app');

await flutter(
'install',
options: <String>[
'--uninstall-only',
],
);

section('Build clean');

await flutter('clean');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,45 +26,6 @@ - (void)setUp {
[super setUp];
self.continueAfterFailure = NO;

// 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.");

// It's possible that app icon is not hittable yet.
NSPredicate *hittable = [NSPredicate predicateWithFormat:@"exists == YES AND hittable == YES"];
[self expectationForPredicate:hittable evaluatedWithObject:appIcon handler:nil];
[self waitForExpectationsWithTimeout:kStandardTimeOut handler:nil];

// Pressing for 2 seconds will bring up context menu.
// Pressing for 3 seconds will dismiss the context menu and make icons wiggle.
[appIcon pressForDuration:2];

// The "Remove App" button in context menu.
XCUIElement *contextMenuRemoveButton = springboard.buttons[@"Remove App"];
XCTAssert([contextMenuRemoveButton waitForExistenceWithTimeout:kStandardTimeOut], @"The context menu remove app button must appear.");
[contextMenuRemoveButton tap];

// Tap the delete confirmation
XCUIElement *deleteConfirmationButton = springboard.alerts.buttons[@"Delete App"];
XCTAssert([deleteConfirmationButton waitForExistenceWithTimeout:kStandardTimeOut], @"The first delete confirmation button must appear.");
[deleteConfirmationButton tap];

// Tap the second delete confirmation
XCUIElement *secondDeleteConfirmationButton = springboard.alerts.buttons[@"Delete"];
XCTAssert([secondDeleteConfirmationButton waitForExistenceWithTimeout:kStandardTimeOut], @"The second delete confirmation button must appear.");
[secondDeleteConfirmationButton tap];

[NSThread sleepForTimeInterval:3];
} else {
NSLog(@"No previously installed app found.");
}

self.app = [[XCUIApplication alloc] init];
[self.app launch];
}
Expand Down