Обратный вызов Detox Async не вызывался (Timeout) только на TravisCI - PullRequest
0 голосов
/ 12 июня 2019

Я новичок в Travis CI, и в основном мой проект - HelloWorld react-native, использующий очень простой тест на детоксикацию.Тест работает хорошо на моем локальном компьютере, однако я столкнулся с ошибкой TimeOut на Travis при выполнении теста.

  • Я не уверен, что метропроцессор запускается правильно
  • Мой другойПредположим, симулятор не установлен / не работает на Travis

Мой travis.yml является основным в документации Detox:

language: objective-c
osx_image: xcode10.2

branches:
  only:
  - master

env:
  global:
  - NODE_VERSION=stable

install:
- brew tap wix/brew
- brew install applesimutils
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
- export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- nvm alias default $NODE_VERSION

- npm install -g react-native-cli
- npm install -g detox-cli
- npm install 

script:
- detox build --configuration ios.sim.release
- detox test --configuration ios.sim.release --cleanup

firstTest.spec.js Детокс тест:

describe('Example', () => {
  beforeEach(async () => {
    await device.reloadReactNative();
  });

  it('should have welcome screen', async () => {
    await expect(element(by.id('welcome'))).toBeVisible();
  });
});

Журнал Travis:

[1m[37mExample[39m[22m: [90mshould have welcome screen[39m

[1m[37mExample[39m[22m: [90mshould have welcome screen[39m[90m [[31mFAIL[90m][39m

[0m[7m[1m[31m FAIL [39m[22m[27m[0m [2me2e/[22m[1mfirstTest.spec.js[22m ([0m[1m[41m513.126s[49m[22m[0m)

  Example

    [31m✕[39m [2mshould have welcome screen (38ms)[22m

[1m[31m  [1m◠[1mExample › should have welcome screen[39m[22m

    Timeout - Async callback was not invoked within the 500000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 500000ms timeout specified by jest.setTimeout.

[2m[22m

[2m      [2mat mapper ([2m../node_modules/jest-jasmine2/build/queueRunner.js[2m:25:45)[2m[22m


[1m[31m  [1m◠[1mExample › should have welcome screen[39m[22m

    ReferenceError: device is not defined

И эта моя package.json настройка: я также запускаю базовый тест Jest Untit

"jest": {
    "preset": "react-native",
    "testMatch": [
      "<rootDir>/__tests__/**/*.js?(x)",
      "<rootDir>/src/**/*.test.js"
    ],
    "setupFiles": [
      "<rootDir>/setupTests.js"
    ],
    "transformIgnorePatterns": [
      ...
    ]
  },
  "detox": {
    "test-runner": "jest",
    "runner-config": "e2e/config.json",
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
        "build": "xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "name": "iPhone X"
      }
    }
  }

На моей локальной машине detox test --configuration ios.sim.debug --cleanupотлично работает.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...