Skip to content
Merged
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
26 changes: 26 additions & 0 deletions WebDriverAgentTests/IntegrationTests/FBSessionIntegrationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,32 @@ - (void)testApplicationIsNotLaunchedAsApplicationUnderTestByDefault
XCTAssertNoThrow(self.session.activeApplication);
}

// DELETE /session while /wda/apps/launch is still launching the app as the application under
// test: whichever of them finishes first, the app must not outlive the session. Settings takes
// long enough to launch for the deletion to usually land in the middle.
- (void)testApplicationLaunchedAsApplicationUnderTestDoesNotOutliveConcurrentSessionDeletion
{
[self startSessionWithoutApplicationUnderTest];
XCUIApplication *settingsApp = [[XCUIApplication alloc] initWithBundleIdentifier:SETTINGS_BUNDLE_ID];
[settingsApp terminate];
FBAssertWaitTillBecomesTrue(settingsApp.state == XCUIApplicationStateNotRunning);
FBSession *session = self.session;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)),
dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
[session kill];
});
@try {
[session launchApplicationWithBundleId:SETTINGS_BUNDLE_ID
shouldWaitForQuiescence:nil
arguments:nil
environment:nil
asApplicationUnderTest:YES];
} @catch (NSException *e) {
XCTAssertEqualObjects(e.name, FBSessionDoesNotExistException);
}
FBAssertWaitTillBecomesTrue(settingsApp.state == XCUIApplicationStateNotRunning);
}

- (void)testLaunchUnattachedApp
{
[FBUnattachedAppLauncher launchAppWithBundleId:SETTINGS_BUNDLE_ID];
Expand Down
Loading