Детокс-тесты на iOS не пройдены на Travis CI - PullRequest
1 голос
/ 14 марта 2020

Мои тесты на детоксикацию работают локально, но всякий раз, когда я запускаю их с Трэвиса, кажется, что они не проходят Например, следующее работает нормально на локальном компьютере:

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

Я заметил другое необычное поведение. Когда я добавил «waitFor» в первые две строки оператора await, эти две строки прошли, но третья строка с «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');
  });

Смахивание не выполняется, что не имеет смысла, потому что тест говорит, что тот же идентификатор проходит в строке раньше. Вот ошибка:

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
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...