Scrolling to an element in table view with cells' content laid out using 'layoutMarginsGuide' fails to scroll.
- Dominant language
- Objective-C
- Stars
- 5.7k
- Forks
- 737
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 5
Description
Scroll a `UITableView` to find an element which is offscreen using following
```
EarlGrey.selectElement(with: grey_text("Add")).using(searchAction: grey_scrollInDirection(GREYDirection.down, 45), onElementWithMatcher: grey_kindOfClass(UITableView.self)).assert(grey_sufficientlyVisible())
```
#### The scrolling fails with the errors below. The cells used in the table view are custom cells which have labels that are placed using constraints with the cell's `contentView.layoutMarginsGuide`.
#### If the cell contents are laid using `frame` or any other constraints except relating to `layoutMarginsGuide`, the scroll action takes place.
#### The are two failures, the first being the visibility assertion as the view does not scroll. The other one is an `unknown error`.
##### Assertion Failed:
```
Exception: AssertionFailedException
Exception Name: AssertionFailedException
Exception Reason: An assertion failed.
Exception with Assertion: {
"Assertion Criteria": "assertWithMatcher:matcherForSufficientlyVisible(>=0.750000)",
"Element Matcher": "((kindOfClass('UILabel') || kindOfClass('UITextField') || kindOfClass('UITextView')) && hasText('Add'))"
}
Exception Details: Error Trace: [
{
"Description": "Assertion with matcher [M] failed: UI element [E] failed to match the following matcher(s): [S]",
"Description Glossary": {
"M": "matcherForSufficientlyVisible(>=0.750000)",
"E": "",
"S": "matcherForSufficientlyVisible(>=0.750000)"
},
"Error Domain": "com.google.earlgrey.ElementInteractionErrorDomain",
"Error Code": "3",
"File Name": "GREYAssertions.m",
"Function Name": "+[GREYAssertions grey_createAssertionWithMatcher:]_block_invoke",
"Line": "75",
"TestCase Class": "XXX_EarlGreyTests.DocumentEditorEarlGreyTests",
"TestCase Method": "testAddAndDeleteNewPage"
}
]
Stack Trace: (
0 EarlGrey 0x000000011b30a618 -[GREYDefaultFailureHandler handleException:details:] + 920
1 EarlGrey 0x000000011b2fc229 -[GREYElementInteraction grey_handleFailureOfAssertion:assertionError:userProvidedOutError:] + 4121
2 EarlGrey 0x000000011b2f9405 __39-[GREYElementInteraction assert:error:]_block_invoke + 1237
3 EarlGrey 0x000000011b3126fe __59-[GREYUIThreadExecutor executeSyncWithTimeout:block:error:]_block_invoke + 30
4 EarlGrey 0x000000011b2e75c5 __54-[GREYRunLoopSpinner grey_checkConditionInActiveMode:]_block_invoke + 85
5 CoreFoundation 0x0000000104d4ab0c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
6 CoreFoundation 0x0000000104d2f2db __CFRunLoopDoBlocks + 331
7 CoreFoundation 0x0000000104d2ea5e __CFRunLoopRun + 1246
8 CoreFoundation 0x0000000104d2e30b CFRunLoopRunSpecific + 635
9 EarlGrey 0x000000011b2e74c4 -[GREYRunLoopSpinner grey_checkConditionInActiveMode:] + 228
10 EarlGrey 0x000000011b2e686e -[GREYRunLoopSpinner spinWithStopConditionBlock:] + 126
11 EarlGrey 0x000000011b31230d -[GREYUIThreadExecutor executeSyncWithTimeout:block:error:] + 1133
12 EarlGrey 0x000000011b2f88ad -[GREYElementInteraction assert:error:] + 1037
13 EarlGrey 0x000000011b2f96c6 -[GREYElementInteraction assertWithMatcher:error:] + 70
14 EarlGrey 0x000000011b2f9663 -[GREYElementInteraction assertWithMatcher:] + 19
15 XXXXXX-EarlGreyTests 0x000000011a524f93 _T0So15GREYInteractionP24XXXXXX_EarlGreyTestsE6assertxSo11GREYMatcher_pyXKF + 83
16 XXXXXX-EarlGreyTests 0x000000011a558aef _T024XXXXXX_EarlGreyTests014DocumentEditorcdE0C23testAddAndDeleteNewPageyyFyycfU_ + 1567
17 XXXXXX-EarlGreyTests 0x000000011a559611 _T024XXXXXX_EarlGreyTests014DocumentEditorcdE0C23testAddAndDeleteNewPageyyFyycfU_TA + 17
18 XXXXXX-EarlGreyTests 0x000000011a5168f9 _T0So10XCTestCaseC24XXXXXX_EarlGreyTestsE4testySo16UIViewControllerC4with_yyKcADtKF + 569
19 XXXXXX-EarlGreyTests 0x000000011a558481 _T024XXXXXX_EarlGreyTests014DocumentEditorcdE0C23testAddAndDeleteNewPageyyF + 593
20 XXXXXX-EarlGreyTests 0x000000011a559c44 _T024XXXXXX_EarlGreyTests014DocumentEditorcdE0C23testAddAndDeleteNewPageyyFTo + 36
21 CoreFoundation 0x0000000104d2bccc __invoking___ + 140
22 CoreFoundation 0x0000000104d2bb84 -[NSInvocation invoke] + 308
23 EarlGrey 0x000000011b2f296f -[GREYTestCaseInvocation invoke] + 95
24 XCTest 0x00000001189e001a __24-[XCTestCase invokeTest]_block_invoke.184 + 74
25 XCTest 0x0000000118a3aae3 +[XCTestCase(Failures) performFailableBlock:shouldInterruptTest:] + 36
26 XCTest 0x0000000118a3aa2e -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 54
27 XCTest 0x00000001189dfce3 __24-[XCTestCase invokeTest]_block_invoke + 847
28 XCTest 0x0000000118a3fa7d -[XCUITestContext performInScope:] + 248
29 XCTest 0x00000001189df97f -[XCTestCase invokeTest] + 175
30 EarlGrey 0x000000011b2eb122 -[XCTestCase(GREYAdditions) grey_invokeTest] + 450
31 CoreFoundation 0x0000000104d2bccc __invoking___ + 140
32 CoreFoundation 0x0000000104d2bb84 -[NSInvocation invoke] + 308
33 XXXTestHost 0x0000000101a33394 __ASPECTS_ARE_BEING_CALLED__ + 4036
34 CoreFoundation 0x0000000104d2a5f8 ___forwarding___ + 760
35 CoreFoundation 0x0000000104d2a278 _CF_forwarding_prep_0 + 120
36 XCTest 0x00000001189e1555 __26-[XCTestCase performTest:]_block_invoke_2 + 42
37 XCTest 0x0000000118a3aae3 +[XCTestCase(Failures) performFailableBlock:shouldInterruptTest:] + 36
38 XCTest 0x0000000118a3aa2e -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 54
39 XCTest 0x00000001189e1402 __26-[XCTestCase performTest:]_block_invoke.318 + 90
40 XCTest 0x0000000118a47061 +[XCTContext runInContextForTestCase:block:] + 225
41 XCTest 0x00000001189e0aff -[XCTestCase performTest:] + 673
42 XCTest 0x0000000118a23727 -[XCTest runTest] + 57
43 XCTest 0x00000001189dc341 __27-[XCTestSuite performTest:]_block_invoke + 365
44 XCTest 0x00000001189dbb1d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 55
45 XCTest 0x00000001189dbdde -[XCTestSuite performTest:] + 296
46 XCTest 0x0000000118a23727 -[XCTest runTest] + 57
47 XCTest 0x00000001189dc341 __27-[XCTestSuite performTest:]_block_invoke + 365
48 XCTest 0x00000001189dbb1d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 55
49 XCTest 0x00000001189dbdde -[XCTestSuite performTest:] + 296
50 XCTest 0x0000000118a23727 -[XCTest runTest] + 57
51 XCTest 0x00000001189dc341 __27-[XCTestSuite performTest:]_block_invoke + 365
52 XCTest 0x00000001189dbb1d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 55
53 XCTest 0x00000001189dbdde -[XCTestSuite performTest:] + 296
54 XCTest 0x0000000118a23727 -[XCTest runTest] + 57
55 XCTest 0x0000000118a50fa6 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
56 XCTest 0x00000001189f4389 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 594
57 XCTest 0x0000000118a50db1 -[XCTTestRunSession runTestsAndReturnError:] + 369
58 XCTest 0x00000001189c2c71 -[XCTestDriver runTestsAndReturnError:] + 447
59 XCTest 0x0000000118a45bb1 _XCTestMain + 960
60 CoreFoundation 0x0000000104d4ab0c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
61 CoreFoundation 0x0000000104d2f2db __CFRunLoopDoBlocks + 331
62 CoreFoundation 0x0000000104d2ea84 __CFRunLoopRun + 1284
63 CoreFoundation 0x0000000104d2e30b CFRunLoopRunSpecific + 635
64 GraphicsServices 0x00000001053a5a73 GSEventRunModal + 62
65 UIKit 0x0000000101d41057 UIApplicationMain + 159
66 XXXTestHost 0x0000000101a2a88f main + 111
67 libdyld.dylib 0x00000001097e3955 start + 1
68 ??? 0x0000000000000005 0x0 + 5
)
```
##### Unknown Error:
```
:0: error: -[XXXXXX_EarlGreyTests.DocumentEditorEarlGreyTests testAddAndDeleteNewPage] : failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
(
0 CoreFoundation 0x0000000104da81e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x000000010549a031 objc_exception_throw + 48
2 CoreFoundation 0x0000000104da80b9 -[NSException raise] + 9
3 EarlGrey 0x000000011b2eae1b -[XCTestCase(GREYAdditions) grey_markAsFailedAtLine:inFile:description:] + 155
4 EarlGrey 0x000000011b30a6fd -[GREYDefaultFailureHandler handleException:details:] + 1149
5 EarlGrey 0x000000011b2fc229 -[GREYElementInteraction grey_handleFailureOfAssertion:assertionError:userProvidedOutError:] + 4121
6 EarlGrey 0x000000011b2f9405 __39-[GREYElementInteraction assert:error:]_block_invoke + 1237
7 EarlGrey 0x000000011b3126fe __59-[GREYUIThreadExecutor executeSyncWithTimeout:block:error:]_block_invoke + 30
8 EarlGrey 0x000000011b2e75c5 __54-[GREYRunLoopSpinner grey_checkConditionInActiveMode:]_block_invoke + 85
9 CoreFoundation 0x0000000104d4ab0c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
10 CoreFoundation 0x0000000104d2f2db __CFRunLoopDoBlocks + 331
11 CoreFoundation 0x0000000104d2ea5e __CFRunLoopRun + 1246
12 CoreFoundation 0x0000000104d2e30b CFRunLoopRunSpecific + 635
13 EarlGrey 0x000000011b2e74c4 -[GREYRunLoopSpinner grey_checkConditionInActiveMode:] + 228
14 EarlGrey 0x000000011b2e686e -[GREYRunLoopSpinner spinWithStopConditionBlock:] + 126
15 EarlGrey 0x000000011b31230d -[GREYUIThreadExecutor executeSyncWithTimeout:block:error:] + 1133
16 EarlGrey 0x000000011b2f88ad -[GREYElementInteraction assert:error:] + 1037
17 EarlGrey 0x000000011b2f96c6 -[GREYElementInteraction assertWithMatcher:error:] + 70
18 EarlGrey 0x000000011b2f9663 -[GREYElementInteraction assertWithMatcher:] + 19
19 XXXXXX-EarlGreyTests 0x000000011a524f93 _T0So15GREYInteractionP24XXXXXX_EarlGreyTestsE6assertxSo11GREYMatcher_pyXKF + 83
20 XXXXXX-EarlGreyTests 0x000000011a558aef _T024XXXXXX_EarlGreyTests014DocumentEditorcdE0C23testAddAndDeleteNewPageyyFyycfU_ + 1567
21 XXXXXX-EarlGreyTests 0x000000011a559611 _T024XXXXXX_EarlGreyTests014DocumentEditorcdE0C23testAddAndDeleteNewPageyyFyycfU_TA + 17
22 XXXXXX-EarlGreyTests 0x000000011a5168f9 _T0So10XCTestCaseC24XXXXXX_EarlGreyTestsE4testySo16UIViewControllerC4with_yyKcADtKF + 569
23 XXXXXX-EarlGreyTests 0x000000011a558481 _T024XXXXXX_EarlGreyTests014DocumentEditorcdE0C23testAddAndDeleteNewPageyyF + 593
24 XXXXXX-EarlGreyTests 0x000000011a559c44 _T024XXXXXX_EarlGreyTests014DocumentEditorcdE0C23testAddAndDeleteNewPageyyFTo + 36
25 CoreFoundation 0x0000000104d2bccc __invoking___ + 140
26 CoreFoundation 0x0000000104d2bb84 -[NSInvocation invoke] + 308
27 EarlGrey 0x000000011b2f296f -[GREYTestCaseInvocation invoke] + 95
28 XCTest 0x00000001189e001a __24-[XCTestCase invokeTest]_block_invoke.184 + 74
29 XCTest 0x0000000118a3aae3 +[XCTestCase(Failures) performFailableBlock:shouldInterruptTest:] + 36
30 XCTest 0x0000000118a3aa2e -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 54
31 XCTest 0x00000001189dfce3 __24-[XCTestCase invokeTest]_block_invoke + 847
32 XCTest 0x0000000118a3fa7d -[XCUITestContext performInScope:] + 248
33 XCTest 0x00000001189df97f -[XCTestCase invokeTest] + 175
34 EarlGrey 0x000000011b2eb122 -[XCTestCase(GREYAdditions) grey_invokeTest] + 450
35 CoreFoundation 0x0000000104d2bccc __invoking___ + 140
36 CoreFoundation 0x0000000104d2bb84 -[NSInvocation invoke] + 308
37 XXXTestHost 0x0000000101a33394 __ASPECTS_ARE_BEING_CALLED__ + 4036
38 CoreFoundation 0x0000000104d2a5f8 ___forwarding___ + 760
39 CoreFoundation 0x0000000104d2a278 _CF_forwarding_prep_0 + 120
40 XCTest 0x00000001189e1555 __26-[XCTestCase performTest:]_block_invoke_2 + 42
41 XCTest 0x0000000118a3aae3 +[XCTestCase(Failures) performFailableBlock:shouldInterruptTest:] + 36
42 XCTest 0x0000000118a3aa2e -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 54
43 XCTest 0x00000001189e1402 __26-[XCTestCase performTest:]_block_invoke.318 + 90
44 XCTest 0x0000000118a47061 +[XCTContext runInContextForTestCase:block:] + 225
45 XCTest 0x00000001189e0aff -[XCTestCase performTest:] + 673
46 XCTest 0x0000000118a23727 -[XCTest runTest] + 57
47 XCTest 0x00000001189dc341 __27-[XCTestSuite performTest:]_block_invoke + 365
48 XCTest 0x00000001189dbb1d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 55
49 XCTest 0x00000001189dbdde -[XCTestSuite performTest:] + 296
50 XCTest 0x0000000118a23727 -[XCTest runTest] + 57
51 XCTest 0x00000001189dc341 __27-[XCTestSuite performTest:]_block_invoke + 365
52 XCTest 0x00000001189dbb1d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 55
53 XCTest 0x00000001189dbdde -[XCTestSuite performTest:] + 296
54 XCTest 0x0000000118a23727 -[XCTest runTest] + 57
55 XCTest 0x00000001189dc341 __27-[XCTestSuite performTest:]_block_invoke + 365
56 XCTest 0x00000001189dbb1d -[XCTestSuite _performProtectedSectionForTest:testSection:] + 55
57 XCTest 0x00000001189dbdde -[XCTestSuite performTest:] + 296
58 XCTest 0x0000000118a23727 -[XCTest runTest] + 57
59 XCTest 0x0000000118a50fa6 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
60 XCTest 0x00000001189f4389 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 594
61 XCTest 0x0000000118a50db1 -[XCTTestRunSession runTestsAndReturnError:] + 369
62 XCTest 0x00000001189c2c71 -[XCTestDriver runTestsAndReturnError:] + 447
63 XCTest 0x0000000118a45bb1 _XCTestMain + 960
64 CoreFoundation 0x0000000104d4ab0c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
65 CoreFoundation 0x0000000104d2f2db __CFRunLoopDoBlocks + 331
66 CoreFoundation 0x0000000104d2ea84 __CFRunLoopRun + 1284
67 CoreFoundation 0x0000000104d2e30b CFRunLoopRunSpecific + 635
68 GraphicsServices 0x00000001053a5a73 GSEventRunModal + 62
69 UIKit 0x0000000101d41057 UIApplicationMain + 159
70 XXXTestHost 0x0000000101a2a88f main + 111
71 libdyld.dylib 0x00000001097e3955 start + 1
72 ??? 0x0000000000000005 0x0 + 5
)
2018-06-06 16:51:18.196969+0530 XXXTestHost[33569:400717] [XXXX] [ Warn] -[XXXRenderQueue cancelAllTasks]_block_invoke/244 cancelAllTasks should only be used for debugging purposes or in tests but never in productive code. This message will only be logged once.
Test Case '-[XXXXXX_EarlGreyTests.XXXEarlGreyTests testAddAndDeleteNewPage]' failed (10.133 seconds).
Test Suite 'XXXEarlGreyTests' failed at 2018-06-06 16:51:18.219.
Executed 1 test, with 2 failures (2 unexpected) in 10.133 (10.313) seconds
Test Suite 'XXXXXX-EarlGreyTests.xctest' failed at 2018-06-06 16:51:18.221.
Executed 1 test, with 2 failures (2 unexpected) in 10.133 (10.315) seconds
Test Suite 'Selected tests' failed at 2018-06-06 16:51:18.222.
Executed 1 test, with 2 failures (2 unexpected) in 10.133 (10.319) seconds
```
Contributor guide
Research direction
Start with the grey_scrollInDirection search action on UITableView and the testAddAndDeleteNewPage failure, then inspect GREYAssertions.m and the GREYElementInteraction stack shown in the report. Reproduce the layoutMarginsGuide case and compare it with cells laid out by frame or other constraints; done means the offscreen label scrolls into sufficient visibility without the unknown error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, objective-c, swift
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100