Skip to content

Commit

Permalink
Increased timeout time, close #669
Browse files Browse the repository at this point in the history
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 #670

Differential Revision: D4915711

Pulled By: rnystrom

fbshipit-source-id: 7afd990cd5d18844ec1da08c5335f7138feb0b87
  • Loading branch information
heshamsalman authored and facebook-github-bot committed Apr 19, 2017
1 parent 301f147 commit 04e6c1b
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 106 deletions.
106 changes: 53 additions & 53 deletions Tests/IGListAdapterE2ETests.m

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Tests/IGListAdapterTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
24 changes: 12 additions & 12 deletions Tests/IGListAdapterUpdaterTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -535,7 +535,7 @@ - (void)test_ {
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:15 handler:nil];
[self waitForExpectationsWithTimeout:30 handler:nil];
}

- (void)test_2 {
Expand Down Expand Up @@ -576,7 +576,7 @@ - (void)test_2 {
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:15 handler:nil];
[self waitForExpectationsWithTimeout:30 handler:nil];
}

@end
42 changes: 21 additions & 21 deletions Tests/IGListBindingSectionControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -145,32 +145,32 @@ - (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<IGListBatchContext> batchContext){} completion:^(BOOL finished) {
IGTestStringBindableCell *batchedCell00 = [self cellAtSection:0 item:0];
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 {
Expand All @@ -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");
Expand All @@ -201,47 +201,47 @@ - (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 {
[self setupWithObjects:@[
[[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
22 changes: 11 additions & 11 deletions Tests/IGListCollectionViewLayoutTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}];
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -664,15 +664,15 @@ - (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);
}

- (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)
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Tests/IGListSingleNibItemControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Tests/IGListSingleSectionControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Tests/IGListSingleStoryboardItemControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions Tests/IGListStackSectionControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -877,7 +877,7 @@ - (void)test_whenRemovingCellsFromChild_thatStackSendsDisplayEventsCorrectly {
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:15 handler:nil];
[self waitForExpectationsWithTimeout:30 handler:nil];
}

- (void)test_whenMovingItemsInChild_thatCorrectCellsAreMoved {
Expand All @@ -904,7 +904,7 @@ - (void)test_whenMovingItemsInChild_thatCorrectCellsAreMoved {
[expectation fulfill];
}];

[self waitForExpectationsWithTimeout:15 handler:nil];
[self waitForExpectationsWithTimeout:30 handler:nil];
}

@end

0 comments on commit 04e6c1b

Please sign in to comment.