My detox tests are running fine locally but whenever I run them from Travis, it seems to fail. For example, the following runs fine on local:
test('should have welcome screen and skip button hides on last frame', async() => {
await expect(element(by.id('WelcomeScreen_Skip'))).toBeVisible();
await expect(element(by.id('WelcomeScreen_Carousel'))).toBeVisible();
await element(by.id('WelcomeScreen_Carousel')).swipe('left');
});
However, the same block of code fails on Travis with the following error:
Welcome Screen › should have welcome screen and skip button hides on last frame
An assertion failed.
Exception with Assertion: {
"Assertion Criteria": "assertWithMatcher:matcherForSufficientlyVisible(>=0.750000)",
"Element Matcher": "((!(kindOfClass('RCTScrollView')) && ((respondsToSelector(accessibilityIdentifier) && accessibilityID('WelcomeScreen_Skip')) && !(kindOfClass('UIAccessibilityTextFieldElement')))) || (((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass('RCTScrollView'))) && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(((respondsToSelector(accessibilityIdentifier) && accessibilityID('WelcomeScreen_Skip')) && !(kindOfClass('UIAccessibilityTextFieldElement')))))))"
}
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": "<RCTTextView:0x7fa8cac55c10; AX=Y; AX.id='WelcomeScreen_Skip'; AX.label='Skip'; AX.frame={{320.66665649414062, 60}, {38.666656494140625, 24.333335876464844}}; AX.activationPoint={339.99998474121094, 72.166667938232422}; AX.traits='UIAccessibilityTraitStaticText'; AX.focused='N'; frame={{0, 0}, {38.666656494140625, 24.333335876464844}}; alpha=1>",
"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"
}
]
I noticed another unusual behavior. When I added the "waitFor" to the first two lines of await statement, those two lines passed but the third line with the "swipe" failed.
test('should have welcome screen and skip button hides on last frame', async() => {
await waitFor(element(by.id('WelcomeScreen_Skip'))).toBeVisible();
await waitFor(element(by.id('WelcomeScreen_Carousel'))).toBeVisible();
await element(by.id('WelcomeScreen_Carousel')).swipe('left');
});
Swiping is failing which doesn't make sense because the test says the same id passes on the line before. Here is the error:
Cannot perform action due to constraint(s) failure.
Exception with Action: {
"Action Name": "Swipe Left for duration 0.1",
"Element Description": "<RCTCustomScrollView:0x7f967a1e0800; AX=N; AX.frame={{0, 126}, {375, 654}}; AX.activationPoint={187.5, 453}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {375, 654}}; opaque; alpha=1>",
"Failed Constraint(s)": "interactable",
"All Constraint(s)": "(interactable && !(isSystemAlertViewShown) && kindOfClass('UIView') && respondsToSelector(accessibilityFrame))",
"Recovery Suggestion": "Adjust element properties so that it matches the failed constraint(s)."
}
[
{
"Description": "Cannot perform action due to constraint(s) failure.",
"Error Domain": "com.google.earlgrey.ElementInteractionErrorDomain",
"Error Code": "1",
"File Name": "GREYBaseAction.m",
"Function Name": "-[GREYBaseAction satisfiesConstraintsForElement:error:]",
"Line": "66"
}
]
Detox: 15.5.0
React Native: 0.61.2
Node: 13.0.1
Device: iPhone 11
Xcode: Xcode 10.2.1
macOS: 10.14.4
Test Runner: Jest