iOS的排毒测试在Travis CI上失败

时间:2020-03-13 21:55:28

标签: ios react-native continuous-integration travis-ci detox

我的排毒测试在本地运行良好,但是每当我从Travis运行它们时,它似乎都失败了。例如,以下在本地运行良好:

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');
  });

但是,同一代码块在Travis上失败,并出现以下错误:

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"
      }
    ]

我注意到了另一种异常行为。当我在await语句的前两行中添加“ waitFor”时,这两行都通过了,但是第三行中的“ swipe”失败了。

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');
  });

滑动失败,这没有意义,因为测试表明之前的行中传递了相同的ID。这是错误:

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

0 个答案:

没有答案