google/EarlGrey

[EarlGrey 2] grey_sufficientlyVisible() asserts incorrectly in iPad Pro 4th gen (off by .4)

whoyawn opened this issue · 0 comments

Exception: com.google.earlgrey.ElementInteractionErrorDomain

Exception Name: com.google.earlgrey.ElementInteractionErrorDomain
Exception Reason: {
  "Description Glossary" :   {
    "M" : "sufficientlyVisible(Expected: 0.750000, Actual: 0.715313)",
    "E" : "<UILabel:0x7fe7f746e7a0; isAccessible=Y; AX.label='UI Test Template'; AX.frame={{172, 245.49999999999994}, {973, 21}}; AX.activationPoint={658.5, 255.99999999999994}; AX.traits='UIAccessibilityTraitStaticText'; AX.focused='N'; frame={{16, 10}, {973, 21}}; opaque; alpha=1; UIE=N; text='UI Test Template'>",
    "S" : "sufficientlyVisible(Expected: 0.750000, Actual: 0.715313)"
  },
  "User Info" :   {
    "NSLocalizedDescription" : "Assertion with matcher [M] failed: UI element [E] failed to match the following matcher(s): [S]"
  },
  "Bundle ID" : "com.textrecruit.main",
  "File Name" : "GREYAssertions.m",
  "Stack Trace" :   [
    "0   AppFramework                        0x000000010e5c06e9 __39+[GREYAssertions assertionWithMatcher:]_block_invoke + 2313",
    "1   AppFramework                        0x000000010e5da813 -[GREYAssertionBlock assert:error:] + 99",
    "2   AppFramework                        0x000000010e5ba334 __39-[GREYElementInteraction assert:error:]_block_invoke + 1572",
    "3   AppFramework                        0x000000010e5b752d __83-[GREYElementInteraction matchElementsWithTimeout:syncBeforeMatch:completionBlock:]_block_invoke + 733",
    "4   AppFramework                        0x000000010e564604 __59-[GREYUIThreadExecutor executeSyncWithTimeout:block:error:]_block_invoke + 68",
    "5   AppFramework                        0x000000010e54ff27 __98-[GREYRunLoopSpinner grey_drainRunLoopInActiveModeAndCheckCondition:explicitRunLoopDrain:forTime:]_block_invoke.35 + 311",
    "6   AppFramework                        0x000000010e550db7 __110-[GREYRunLoopSpinner grey_setupObserverInMode:withBeforeSourcesBlock:beforeWaitingBlock:explicitRunLoopDrain:]_block_invoke.54 + 103",
    "7   CoreFoundation                      0x00007fff23da1087 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23",
    "8   CoreFoundation                      0x00007fff23d9bb3e __CFRunLoopDoObservers + 430",
    "9   CoreFoundation                      0x00007fff23d9c08a __CFRunLoopRun + 1226",
    "10  CoreFoundation                      0x00007fff23d9b8a4 CFRunLoopRunSpecific + 404",
    "11  GraphicsServices                    0x00007fff38c05bbe GSEventRunModal + 139",
    "12  UIKitCore                           0x00007fff49372964 UIApplicationMain + 1605",
    "13  TextRecruit                         0x000000010e04eb79 main + 841",
    "14  libdyld.dylib                       0x00007fff5211c1fd start + 1",
    "15  ???                                 0x0000000000000006 0x0 + 6"
  ],
  "Line" : "55",
  "Error Code" : "3",
  "App Screenshots" :   {
    "Visibility Checker Most Recent Expected After Image" : <UIImage:0x6000002c50e0 anonymous {852, 20.5}>,
    "Visibility Checker Most Recent Actual After Image" : <UIImage:0x6000002fa760 anonymous {1704, 41}>,
    "Screenshot At Failure" : <UIImage:0x6000002c4870 anonymous {1024, 1366}>,
    "Visibility Checker Most Recent Before Image" : <UIImage:0x6000002f9dd0 anonymous {1704, 41}>
  },
  "Function Name" : "+[GREYAssertions assertionWithMatcher:]_block_invoke",
  "Description" : "Assertion with matcher [M] failed: UI element [E] failed to match the following matcher(s): [S]",
  "Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain"
}
Exception Details: ((kindOfClass('UILabel') || kindOfClass('UITextField') || kindOfClass('UITextView')) && hasText('UI Test Template'))

Bundle ID: com.textrecruit.main.TextRecruitUITests.xctrunner

Relevant code:

let title = "UI Test Template"
let text = "This is an example for UI testing."
EarlGrey.selectElement(with: grey_text(title))
    .assert(grey_sufficientlyVisible())

image

It seems that 100% of the element is visible when I look at it on the simulator, but EarlGrey is off: "S" : "sufficientlyVisible(Expected: 0.750000, Actual: 0.715313)". It correctly selects the element, so I know the problem can't be that the wrong element is selected. I also tested it with an accessibility identifier and I get the same error.