From 04e6c1bff127ac2cf5dacaf278d1ecbece37ab3f Mon Sep 17 00:00:00 2001 From: heshamsalman Date: Wed, 19 Apr 2017 12:50:20 -0700 Subject: [PATCH] Increased timeout time, close #669 Summary: Simple find and replace for `waitForExpectationsWithTimeout:15` and `waitForExpectationsWithTimeout:16` Issue fixed: #669 - [ ] All tests pass. Demo project builds and runs. - [ ] I added tests, an experiment, or detailed why my change isn't tested. - [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Closes https://github.com/Instagram/IGListKit/pull/670 Differential Revision: D4915711 Pulled By: rnystrom fbshipit-source-id: 7afd990cd5d18844ec1da08c5335f7138feb0b87 --- Tests/IGListAdapterE2ETests.m | 106 +++++++++--------- Tests/IGListAdapterTests.m | 2 +- Tests/IGListAdapterUpdaterTests.m | 24 ++-- Tests/IGListBindingSectionControllerTests.m | 42 +++---- Tests/IGListCollectionViewLayoutTests.m | 22 ++-- Tests/IGListSingleNibItemControllerTests.m | 2 +- Tests/IGListSingleSectionControllerTests.m | 2 +- ...GListSingleStoryboardItemControllerTests.m | 2 +- Tests/IGListStackSectionControllerTests.m | 10 +- 9 files changed, 106 insertions(+), 106 deletions(-) diff --git a/Tests/IGListAdapterE2ETests.m b/Tests/IGListAdapterE2ETests.m index d40b4fe05..f8eed16e7 100644 --- a/Tests/IGListAdapterE2ETests.m +++ b/Tests/IGListAdapterE2ETests.m @@ -3,7 +3,7 @@ * All rights reserved. * * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant + * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ @@ -115,7 +115,7 @@ - (void)test_whenUpdating_withEqualObjects_thatCellConfigurationDoesntChange { XCTAssertEqual(cell.delegate, [self.adapter sectionControllerForObject:self.dataSource.objects[0]]); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenReloadingItem_cellConfigurationChanges { @@ -169,7 +169,7 @@ - (void)test_whenObjectEqualityChanges_thatSectionCountChanges { XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 2); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenUpdatesComplete_thatCellsExist { @@ -185,7 +185,7 @@ - (void)test_whenUpdatesComplete_thatCellsExist { XCTAssertNotNil([self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:1]]); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenReloadDataCompletes_thatCellsExist { @@ -201,7 +201,7 @@ - (void)test_whenReloadDataCompletes_thatCellsExist { XCTAssertNotNil([self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:1]]); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSectionControllerInsertsIndexes_thatCountsAreUpdated { @@ -222,7 +222,7 @@ - (void)test_whenSectionControllerInsertsIndexes_thatCountsAreUpdated { XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSectionControllerDeletesIndexes_thatCountsAreUpdated { @@ -244,7 +244,7 @@ - (void)test_whenSectionControllerDeletesIndexes_thatCountsAreUpdated { XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 1); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSectionControllerReloadsIndexes_thatCellConfigurationUpdates { @@ -269,7 +269,7 @@ - (void)test_whenSectionControllerReloadsIndexes_thatCellConfigurationUpdates { XCTAssertEqualObjects(updatedCell.label.text, @"c"); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSectionControllerReloads_thatCountsAreUpdated { @@ -290,7 +290,7 @@ - (void)test_whenSectionControllerReloads_thatCountsAreUpdated { XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingUpdates_withSectionControllerMutations_thatCollectionCountsAreUpdated { @@ -328,7 +328,7 @@ - (void)test_whenPerformingUpdates_withSectionControllerMutations_thatCollection XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSectionControllerMoves_withSectionControllerMutations_thatCollectionViewWorks { @@ -360,7 +360,7 @@ - (void)test_whenSectionControllerMoves_withSectionControllerMutations_thatColle XCTAssertEqual([self.collectionView numberOfItemsInSection:1], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenItemIsRemoved_withSectionControllerMutations_thatCollectionViewWorks { @@ -389,7 +389,7 @@ - (void)test_whenItemIsRemoved_withSectionControllerMutations_thatCollectionView [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingUpdates_withUnequalItem_withItemMoving_thatCollectionViewCountsUpdate { @@ -410,7 +410,7 @@ - (void)test_whenPerformingUpdates_withUnequalItem_withItemMoving_thatCollection XCTAssertEqual([self.collectionView numberOfItemsInSection:1], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingUpdates_withItemMoving_withSectionControllerReloadIndexes_thatCollectionViewCountsUpdate { @@ -437,7 +437,7 @@ - (void)test_whenPerformingUpdates_withItemMoving_withSectionControllerReloadInd XCTAssertEqual([self.collectionView numberOfItemsInSection:1], 2); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingUpdates_withSectionControllerReloadIndexes_withItemDeleted_thatCollectionViewCountsUpdate { @@ -462,7 +462,7 @@ - (void)test_whenPerformingUpdates_withSectionControllerReloadIndexes_withItemDe XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingUpdates_withNewItemInstances_thatSectionControllersEqual { @@ -495,7 +495,7 @@ - (void)test_whenPerformingUpdates_withNewItemInstances_thatSectionControllersEq [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingMultipleUpdates_withNewItemInstances_thatSectionControllersReceiveNewInstances { @@ -536,7 +536,7 @@ - (void)test_whenPerformingMultipleUpdates_withNewItemInstances_thatSectionContr [expectation fulfill]; }]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenQueryingCollectionContext_withNewItemInstances_thatSectionMatchesCurrentIndex { @@ -569,7 +569,7 @@ - (void)test_whenQueryingCollectionContext_withNewItemInstances_thatSectionMatch }]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSectionControllerMutates_withReloadData_thatSectionControllerMutationIsApplied { @@ -593,7 +593,7 @@ - (void)test_whenSectionControllerMutates_withReloadData_thatSectionControllerMu XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenContentOffsetChanges_withPerformUpdates_thatCollectionViewWorks { @@ -618,7 +618,7 @@ - (void)test_whenContentOffsetChanges_withPerformUpdates_thatCollectionViewWorks XCTAssertEqual([self.collectionView numberOfSections], 2); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenReloadingItems_withNewItemInstances_thatSectionControllersReceiveNewInstances { @@ -674,7 +674,7 @@ - (void)test_whenReloadingItems_withPerformUpdates_thatReloadIsApplied { XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 2); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSectionControllerMutates_whenThereIsNoWindow_thatCollectionViewCountsAreUpdated { @@ -701,7 +701,7 @@ - (void)test_whenSectionControllerMutates_whenThereIsNoWindow_thatCollectionView XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 6); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingUpdates_withoutSettingDataSource_thatCompletionBlockExecutes { @@ -739,7 +739,7 @@ - (void)test_whenPerformingUpdates_withoutSettingDataSource_thatCompletionBlockE // simulate display reloading data on the collection view [collectionView layoutIfNeeded]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingUpdates_withItemsMovingInBlocks_thatCollectionViewWorks { @@ -783,7 +783,7 @@ - (void)test_whenPerformingUpdates_withItemsMovingInBlocks_thatCollectionViewWor XCTAssertEqual([collectionView numberOfSections], 10); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenReleasingObjects_thatAssertDoesntFire { @@ -811,7 +811,7 @@ - (void)test_whenReleasingObjects_thatAssertDoesntFire { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [expectation fulfill]; }); - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenItemDeleted_withDisplayDelegate_thatDelegateReceivesDeletedItem { @@ -836,7 +836,7 @@ - (void)test_whenItemDeleted_withDisplayDelegate_thatDelegateReceivesDeletedItem XCTAssertTrue(finished2); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenItemReloaded_withDisplacingMutations_thatCollectionViewWorks { @@ -861,7 +861,7 @@ - (void)test_whenItemReloaded_withDisplacingMutations_thatCollectionViewWorks { XCTAssertTrue(finished); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenCollectionViewAppears_thatWillDisplayEventsAreSent { @@ -910,7 +910,7 @@ - (void)test_whenAdapterUpdates_withItemUpdated_thatdidEndDisplayEventsAreSent { XCTAssertEqual([ic2.didEndDisplayCellIndexes countForObject:@1], 1); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenAdapterUpdates_withItemRemoved_thatdidEndDisplayEventsAreSent { @@ -940,7 +940,7 @@ - (void)test_whenAdapterUpdates_withItemRemoved_thatdidEndDisplayEventsAreSent { XCTAssertEqual([ic2.didEndDisplayCellIndexes countForObject:@1], 1); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenAdapterUpdates_withEmptyItems_thatdidEndDisplayEventsAreSent { @@ -963,7 +963,7 @@ - (void)test_whenAdapterUpdates_withEmptyItems_thatdidEndDisplayEventsAreSent { XCTAssertEqual([ic2.didEndDisplayCellIndexes countForObject:@1], 1); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenBatchUpdating_withCellQuery_thatCellIsNil { @@ -993,7 +993,7 @@ - (void)test_whenBatchUpdating_withCellQuery_thatCellIsNil { [self.adapter performUpdatesAnimated:YES completion:^(BOOL finished) { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenBatchUpdating_withDuplicateIdentifiers_thatHaveDifferentValues_thatCollectionViewWorks { @@ -1020,7 +1020,7 @@ - (void)test_whenBatchUpdating_withDuplicateIdentifiers_thatHaveDifferentValues_ [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenPerformingUpdates_withWorkingRange_thatAccessingCellDoesntCrash { @@ -1053,7 +1053,7 @@ - (void)test_whenPerformingUpdates_withWorkingRange_thatAccessingCellDoesntCrash [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenReloadingItems_withDeleteAndInsertCollision_thatUpdateCanBeApplied { @@ -1074,7 +1074,7 @@ - (void)test_whenReloadingItems_withDeleteAndInsertCollision_thatUpdateCanBeAppl [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenReloadingItems_withSectionInsertedInFront_thatUpdateCanBeApplied { @@ -1105,7 +1105,7 @@ - (void)test_whenReloadingItems_withSectionInsertedInFront_thatUpdateCanBeApplie [expectation2 fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenReloadingItems_withSectionDeletedInFront_thatUpdateCanBeApplied { @@ -1134,7 +1134,7 @@ - (void)test_whenReloadingItems_withSectionDeletedInFront_thatUpdateCanBeApplied [expectation2 fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenDataSourceDeallocatedAfterUpdateQueued_thatUpdateSuccesfullyCompletes { @@ -1157,7 +1157,7 @@ - (void)test_whenDataSourceDeallocatedAfterUpdateQueued_thatUpdateSuccesfullyCom dataSource = nil; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenQueuingUpdate_withSectionControllerBatchUpdate_thatSectionControllerNotRetained { @@ -1216,7 +1216,7 @@ - (void)test_whenMovingItems_withObjectMoving_thatCollectionViewWorks { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenMovingItems_withObjectReloaded_thatCollectionViewWorks { @@ -1241,7 +1241,7 @@ - (void)test_whenMovingItems_withObjectReloaded_thatCollectionViewWorks { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenMovingItems_withObjectDeleted_thatCollectionViewWorks { @@ -1264,7 +1264,7 @@ - (void)test_whenMovingItems_withObjectDeleted_thatCollectionViewWorks { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenMovingItems_withObjectInsertedBefore_thatCollectionViewWorks { @@ -1290,7 +1290,7 @@ - (void)test_whenMovingItems_withObjectInsertedBefore_thatCollectionViewWorks { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenMovingItems_thatCollectionViewWorks { @@ -1316,7 +1316,7 @@ - (void)test_whenMovingItems_thatCollectionViewWorks { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenInvalidatingSectionController_withSizeChange_thatCellsAreSameInstance_thatCellsFrameChanged { @@ -1344,7 +1344,7 @@ - (void)test_whenInvalidatingSectionController_withSizeChange_thatCellsAreSameIn [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenAdaptersSwapCollectionViews_thatOldAdapterDoesntUpdateOldCollectionView { @@ -1378,7 +1378,7 @@ - (void)test_whenAdaptersSwapCollectionViews_thatOldAdapterDoesntUpdateOldCollec [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenAdaptersSwapCollectionViews_ { @@ -1415,16 +1415,16 @@ - (void)test_whenAdaptersSwapCollectionViews_ { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenDidUpdateAsyncReloads_withBatchUpdatesInProgress_thatReloadIsExecuted { [self setupWithObjects:@[ genTestObject(@1, @1) ]]; - + IGTestDelegateController *section = [self.adapter sectionControllerForObject:self.dataSource.objects[0]]; - + XCTestExpectation *expectation1 = genExpectation; __weak __typeof__(section) weakSection = section; section.itemUpdateBlock = ^{ @@ -1439,21 +1439,21 @@ - (void)test_whenDidUpdateAsyncReloads_withBatchUpdatesInProgress_thatReloadIsEx XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 2); }]; }; - + // add an object so that a batch update is triggered (diff result has changes) self.dataSource.objects = @[ genTestObject(@1, @1), genTestObject(@2, @1) ]; - + XCTestExpectation *expectation2 = genExpectation; [self.adapter performUpdatesAnimated:YES completion:^(BOOL finished) { // verify that the section still has 2 items since this completion executes AFTER the reload block above XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 2); [expectation2 fulfill]; }]; - - [self waitForExpectationsWithTimeout:15 handler:nil]; + + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenInsertingItemsTwice_withDataUpdatedTwice_thatAllUpdatesAppliedWithoutException { @@ -1474,7 +1474,7 @@ - (void)test_whenInsertingItemsTwice_withDataUpdatedTwice_thatAllUpdatesAppliedW XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 4); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenDeletingItemsTwice_withDataUpdatedTwice_thatAllUpdatesAppliedWithoutException { @@ -1495,7 +1495,7 @@ - (void)test_whenDeletingItemsTwice_withDataUpdatedTwice_thatAllUpdatesAppliedWi XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 2); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } @end diff --git a/Tests/IGListAdapterTests.m b/Tests/IGListAdapterTests.m index 49ff31726..1b1e7a0bb 100644 --- a/Tests/IGListAdapterTests.m +++ b/Tests/IGListAdapterTests.m @@ -397,7 +397,7 @@ - (void)test_whenSectionItemsAreDeletedAsBatch_thatEmptyViewBecomesVisible { XCTAssertFalse(self.collectionView.backgroundView.hidden); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenScrollViewDelegateSet_thatDelegateReceivesEvents { diff --git a/Tests/IGListAdapterUpdaterTests.m b/Tests/IGListAdapterUpdaterTests.m index 0f2a03a20..8b8f5d656 100644 --- a/Tests/IGListAdapterUpdaterTests.m +++ b/Tests/IGListAdapterUpdaterTests.m @@ -16,7 +16,7 @@ #define genTestObject(k, v) [[IGSectionObject alloc] initWithKey:k value:v] #define genExpectation [self expectationWithDescription:NSStringFromSelector(_cmd)] -#define waitExpectation [self waitForExpectationsWithTimeout:15 handler:nil] +#define waitExpectation [self waitForExpectationsWithTimeout:30 handler:nil] @interface IGListAdapterUpdaterTests : XCTestCase @@ -110,7 +110,7 @@ - (void)test_whenInsertingSection_thatCollectionViewUpdates { XCTAssertEqual([self.collectionView numberOfSections], 2); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenDeletingSection_thatCollectionViewUpdates { @@ -131,7 +131,7 @@ - (void)test_whenDeletingSection_thatCollectionViewUpdates { XCTAssertEqual([self.collectionView numberOfSections], 1); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenInsertingSection_withItemChanges_thatCollectionViewUpdates { @@ -155,7 +155,7 @@ - (void)test_whenInsertingSection_withItemChanges_thatCollectionViewUpdates { XCTAssertEqual([self.collectionView numberOfItemsInSection:1], 2); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenInsertingSection_withDeletedSection_thatCollectionViewUpdates { @@ -183,7 +183,7 @@ - (void)test_whenInsertingSection_withDeletedSection_thatCollectionViewUpdates { XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenReloadingSections_thatCollectionViewUpdates { @@ -229,7 +229,7 @@ - (void)test_whenCollectionViewNeedsLayout_thatPerformBatchUpdateWorks { XCTAssertEqual([self.collectionView numberOfSections], 1); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenUpdatesAreReentrant_thatUpdatesExecuteSerially { @@ -275,7 +275,7 @@ - (void)test_whenUpdatesAreReentrant_thatUpdatesExecuteSerially { XCTAssertEqual(completionCounter, 1); [expectation2 fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenQueuingItemUpdates_thatUpdaterHasChanges { @@ -289,7 +289,7 @@ - (void)test_whenOnlyQueueingItemUpdates_thatUpdateBlockExecutes { // expectation should be triggered. test failure is a timeout [expectation fulfill]; } completion:nil]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenQueueingItemUpdates_withBatchUpdate_thatItemUpdateBlockExecutes { @@ -316,7 +316,7 @@ - (void)test_whenQueueingItemUpdates_withBatchUpdate_thatItemUpdateBlockExecutes XCTAssertTrue(sectionUpdateBlockExecuted); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenItemsMoveAndUpdate_thatCollectionViewWorks { @@ -353,7 +353,7 @@ - (void)test_whenItemsMoveAndUpdate_thatCollectionViewWorks { XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 3); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenConvertingReloads_withoutChanges_thatOriginalIndexUsed { @@ -535,7 +535,7 @@ - (void)test_ { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_2 { @@ -576,7 +576,7 @@ - (void)test_2 { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } @end diff --git a/Tests/IGListBindingSectionControllerTests.m b/Tests/IGListBindingSectionControllerTests.m index 3324150b1..796d25120 100644 --- a/Tests/IGListBindingSectionControllerTests.m +++ b/Tests/IGListBindingSectionControllerTests.m @@ -128,7 +128,7 @@ - (void)test_whenUpdating_withAddedModels_thatCellsCorrectAndConfigured { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSelectingCell_thatCorrectViewModelSelected { @@ -145,15 +145,15 @@ - (void)test_whenAdapterReloadsObjects_thatSectionUpdated { [[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@7, @"seven"]], ]]; [self.adapter reloadObjects:@[[[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@"four", @4, @"seven", @7]]]]; - + IGTestNumberBindableCell *cell00 = [self cellAtSection:0 item:0]; IGTestStringBindableCell *cell01 = [self cellAtSection:0 item:1]; - + XCTAssertEqualObjects(cell00.textField.text, @"7"); XCTAssertEqualObjects(cell01.label.text, @"seven"); XCTAssertNil([self cellAtSection:0 item:2]); XCTAssertNil([self cellAtSection:0 item:3]); - + // "fake" batch updates to make sure that calling reload triggers a diffed batch update XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)]; [self.adapter performBatchAnimated:YES updates:^(id batchContext){} completion:^(BOOL finished) { @@ -161,16 +161,16 @@ - (void)test_whenAdapterReloadsObjects_thatSectionUpdated { IGTestNumberBindableCell *batchedCell01 = [self cellAtSection:0 item:1]; IGTestStringBindableCell *batchedCell02 = [self cellAtSection:0 item:2]; IGTestNumberBindableCell *batchedCell03 = [self cellAtSection:0 item:3]; - + XCTAssertEqualObjects(batchedCell00.label.text, @"four"); XCTAssertEqualObjects(batchedCell01.textField.text, @"4"); XCTAssertEqualObjects(batchedCell02.label.text, @"seven"); XCTAssertEqualObjects(batchedCell03.textField.text, @"7"); - + [expectation fulfill]; }]; - - [self waitForExpectationsWithTimeout:16 handler:nil]; + + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenUpdating_withViewModelMovesAndReloads_thatCellUpdatedAndInstanceSame { @@ -182,13 +182,13 @@ - (void)test_whenUpdating_withViewModelMovesAndReloads_thatCellUpdatedAndInstanc [self setupWithObjects:@[ [[IGTestDiffingObject alloc] initWithKey:@1 objects:initObjects] ]]; - + XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3); - + IGTestStringBindableCell *cell00 = [self cellAtSection:0 item:0]; IGTestStringBindableCell *cell01 = [self cellAtSection:0 item:1]; IGTestCell *cell02 = [self cellAtSection:0 item:2]; - + XCTAssertEqualObjects(cell00.label.text, @"foo"); XCTAssertEqualObjects(cell01.label.text, @"bar"); XCTAssertEqualObjects(cell02.label.text, @"baz"); @@ -201,25 +201,25 @@ - (void)test_whenUpdating_withViewModelMovesAndReloads_thatCellUpdatedAndInstanc self.dataSource.objects = @[ [[IGTestDiffingObject alloc] initWithKey:@1 objects:newObjects] ]; - + XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)]; [self.adapter performUpdatesAnimated:YES completion:^(BOOL finished) { IGTestCell *batchedCell00 = [self cellAtSection:0 item:0]; IGTestStringBindableCell *batchedCell01 = [self cellAtSection:0 item:1]; IGTestStringBindableCell *batchedCell02 = [self cellAtSection:0 item:2]; - + XCTAssertEqualObjects(batchedCell00.label.text, @"bang"); XCTAssertEqualObjects(batchedCell01.label.text, @"foo"); XCTAssertEqualObjects(batchedCell02.label.text, @"bar"); - + XCTAssertEqual(cell00, batchedCell01); XCTAssertEqual(cell01, batchedCell02); XCTAssertEqual(cell02, batchedCell00); - + [expectation fulfill]; }]; - - [self waitForExpectationsWithTimeout:16 handler:nil]; + + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenUpdatingManually_with2Updates_thatBothCompletionBlocksCalled { @@ -227,21 +227,21 @@ - (void)test_whenUpdatingManually_with2Updates_thatBothCompletionBlocksCalled { [[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@7, @"seven"]], ]]; IGTestDiffingSectionController *section = [self.adapter sectionControllerForObject:self.dataSource.objects[0]]; - + XCTestExpectation *expectation1 = [self expectationWithDescription:NSStringFromSelector(_cmd)]; [section updateAnimated:YES completion:^(BOOL updated) { XCTAssertTrue(updated); [expectation1 fulfill]; }]; - + XCTestExpectation *expectation2 = [self expectationWithDescription:NSStringFromSelector(_cmd)]; [section updateAnimated:YES completion:^(BOOL updated) { // queued second, shouldn't execute update block XCTAssertFalse(updated); [expectation2 fulfill]; }]; - - [self waitForExpectationsWithTimeout:15 handler:nil]; + + [self waitForExpectationsWithTimeout:30 handler:nil]; } @end diff --git a/Tests/IGListCollectionViewLayoutTests.m b/Tests/IGListCollectionViewLayoutTests.m index 7471ce155..b41dc796c 100644 --- a/Tests/IGListCollectionViewLayoutTests.m +++ b/Tests/IGListCollectionViewLayoutTests.m @@ -492,20 +492,20 @@ - (void)test_whenBatchItemUpdates_withHeaderHeight_withLineSpacing_withInsets_th IGAssertEqualFrame([self headerForSection:0].frame, 10, 10, 85, 10); IGAssertEqualFrame([self cellForSection:0 item:0].frame, 10, 20, 85, 30); - + IGAssertEqualFrame([self headerForSection:1].frame, 10, 65, 85, 10); IGAssertEqualFrame([self cellForSection:1 item:0].frame, 10, 75, 85, 40); - + IGAssertEqualFrame([self headerForSection:2].frame, 10, 130, 85, 10); IGAssertEqualFrame([self cellForSection:2 item:0].frame, 10, 140, 85, 30); IGAssertEqualFrame([self cellForSection:2 item:1].frame, 10, 180, 85, 10); - + IGAssertEqualFrame([self headerForSection:3].frame, 10, 205, 85, 10); IGAssertEqualFrame([self cellForSection:3 item:0].frame, 10, 215, 85, 10); IGAssertEqualFrame([self cellForSection:3 item:1].frame, 10, 235, 85, 20); }]; - - [self waitForExpectationsWithTimeout:10 handler:^(NSError * _Nullable error) { + + [self waitForExpectationsWithTimeout:30 handler:^(NSError * _Nullable error) { XCTAssertNil(error); }]; } @@ -609,7 +609,7 @@ - (void)test_whenItemsAddedWidthSmallerThanWidth_DifferenceSmallerThanEpsilon { [[IGLayoutTestItem alloc] initWithSize:size], ]], ]]; - + IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 33, 33); IGAssertEqualFrame([self cellForSection:0 item:1].frame, 33, 0, 33, 33); IGAssertEqualFrame([self cellForSection:0 item:2].frame, 66, 0, 34, 33); @@ -628,7 +628,7 @@ - (void)test_whenItemsAddedWidthSmallerThanWidth_DifferenceBiggerThanEpsilon { [[IGLayoutTestItem alloc] initWithSize:CGSizeMake(65, 33)], ]], ]]; - + IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 33, 33); IGAssertEqualFrame([self cellForSection:0 item:1].frame, 33, 0, 65, 33); } @@ -646,7 +646,7 @@ - (void)test_whenItemsAddedWithBiggerThanWidth_DifferenceSmallerThanEpsilon { [[IGLayoutTestItem alloc] initWithSize:CGSizeMake(51, 50)], ]], ]]; - + IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 50, 50); IGAssertEqualFrame([self cellForSection:0 item:1].frame, 50, 0, 51, 50); } @@ -664,7 +664,7 @@ - (void)test_whenItemsAddedWithBiggerThanWidth_DifferenceBiggerThanEpsilon { [[IGLayoutTestItem alloc] initWithSize:CGSizeMake(52, 50)], ]], ]]; - + IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 50, 50); IGAssertEqualFrame([self cellForSection:0 item:1].frame, 0, 50, 52, 50); } @@ -672,7 +672,7 @@ - (void)test_whenItemsAddedWithBiggerThanWidth_DifferenceBiggerThanEpsilon { - (void)test_ { [self setUpWithStickyHeaders:NO topInset:0]; self.collectionView.frame = CGRectMake(0, 0, 414, 736); - + NSMutableArray *data = [NSMutableArray new]; for (NSInteger i = 0; i < 6; i++) { [data addObject:[[IGLayoutTestSection alloc] initWithInsets:UIEdgeInsetsMake(1, 1, 1, 1) @@ -684,7 +684,7 @@ - (void)test_ { ]]]; } [self prepareWithData:data]; - + XCTAssertEqual(self.collectionView.contentSize.height, 276); IGAssertEqualFrame([self cellForSection:0 item:0].frame, 1, 1, 136, 136); IGAssertEqualFrame([self cellForSection:1 item:0].frame, 139, 1, 136, 136); diff --git a/Tests/IGListSingleNibItemControllerTests.m b/Tests/IGListSingleNibItemControllerTests.m index f791d910d..a40432bf3 100644 --- a/Tests/IGListSingleNibItemControllerTests.m +++ b/Tests/IGListSingleNibItemControllerTests.m @@ -114,7 +114,7 @@ - (void)test_whenItemUpdated_thatCellIsConfigured { XCTAssertEqualObjects(cell2.label.text, @"Qux"); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } @end diff --git a/Tests/IGListSingleSectionControllerTests.m b/Tests/IGListSingleSectionControllerTests.m index 4cb6437ee..4c12f9796 100644 --- a/Tests/IGListSingleSectionControllerTests.m +++ b/Tests/IGListSingleSectionControllerTests.m @@ -116,7 +116,7 @@ - (void)test_whenItemUpdated_thatCellIsConfigured { XCTAssertEqualObjects(cell2.label.text, @"Qux"); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSelected_thatDelegateReceivesEvent { diff --git a/Tests/IGListSingleStoryboardItemControllerTests.m b/Tests/IGListSingleStoryboardItemControllerTests.m index 97da0a0e4..3790e2dc1 100644 --- a/Tests/IGListSingleStoryboardItemControllerTests.m +++ b/Tests/IGListSingleStoryboardItemControllerTests.m @@ -115,7 +115,7 @@ - (void)test_whenItemUpdated_thatCellIsConfigured { XCTAssertEqualObjects(cell2.label.text, @"Qux"); [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } @end diff --git a/Tests/IGListStackSectionControllerTests.m b/Tests/IGListStackSectionControllerTests.m index 08128cb33..b3c5eb187 100644 --- a/Tests/IGListStackSectionControllerTests.m +++ b/Tests/IGListStackSectionControllerTests.m @@ -445,7 +445,7 @@ - (void)test_whenRemovingCell_thatEventsForwardedToSectionControllers { [mockDelegate verify]; [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenQueryingVisibleSectionControllers_withCellsOffscreen_thatOnlyVisibleReturned { @@ -544,7 +544,7 @@ - (void)test_whenPerformingItemUpdates_thatMutationsMapToSectionControllers { [batchContext deleteInSectionController:section2 atIndexes:[NSIndexSet indexSetWithIndex:0]]; } completion:nil]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenSelectingItems_thatChildSectionControllersSelected { @@ -831,7 +831,7 @@ - (void)test_whenRemovingSection_withWorkingRange_thatChildSectionControllersRec [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenScrolling_withWorkingRange_thatChildSectionControllersReceiveEvents { @@ -877,7 +877,7 @@ - (void)test_whenRemovingCellsFromChild_thatStackSendsDisplayEventsCorrectly { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } - (void)test_whenMovingItemsInChild_thatCorrectCellsAreMoved { @@ -904,7 +904,7 @@ - (void)test_whenMovingItemsInChild_thatCorrectCellsAreMoved { [expectation fulfill]; }]; - [self waitForExpectationsWithTimeout:15 handler:nil]; + [self waitForExpectationsWithTimeout:30 handler:nil]; } @end