我已经创建了一个 public-repo 来测试 private-repo 。
我的private-repo和public-repo具有相同的配置:
{ "os": "linux", "env": "BUNDLE_GEMS__CONTRIBSYS__COM=1234567890", "dist": "trusty", "cache": { "bundler": true, yarn: true, "directories": [ "~/.cache" ] }, "group": "stable", "addons": { "postgresql": "9.4" }, "script": [ "$(yarn bin)/cypress run" ], "install": [ "yarn add cypress" ], "node_js": 10, "language": "node_js", "services": [ "redis-server", "postgresql" ], "before_script": [ "rails server -p 3000 -b 127.0.0.1 &", "psql -c 'create database travis_ci_test;' -U postgres", "RAILS_ENV=test bundle exec rake db:schema:load", "RAILS_ENV=test bundle exec rake db:seed" ], "before_install": [ "gem install bundler", "bundle install" ] }
但是我不明白为什么我的私人仓库中有此错误消息:
Testing 1) can i access to 127.0.0.1 2) can i access to localhost 0 passing (1m) 2 failing 1) Testing can i access to 127.0.0.1: CypressError: cy.request() timed out waiting 30000ms for a response from your server. The request we sent was: Method: GET URL: http://127.0.0.1:3000/ No response was received within the timeout. at Object.cypressErr (http://localhost:36431/__cypress/runner/cypress_runner.js:68076:11) at Object.throwErr (http://localhost:36431/__cypress/runner/cypress_runner.js:68041:18) at Object.throwErrByPath (http://localhost:36431/__cypress/runner/cypress_runner.js:68068:17) at http://localhost:36431/__cypress/runner/cypress_runner.js:59657:25 at tryCatcher (http://localhost:36431/__cypress/runner/cypress_runner.js:7091:23) at http://localhost:36431/__cypress/runner/cypress_runner.js:2408:41 at tryCatcher (http://localhost:36431/__cypress/runner/cypress_runner.js:7091:23) at Promise._settlePromiseFromHandler (http://localhost:36431/__cypress/runner/cypress_runner.js:5113:31) at Promise._settlePromise (http://localhost:36431/__cypress/runner/cypress_runner.js:5170:18) at Promise._settlePromise0 (http://localhost:36431/__cypress/runner/cypress_runner.js:5215:10) at Promise._settlePromises (http://localhost:36431/__cypress/runner/cypress_runner.js:5290:18) at Async._drainQueue (http://localhost:36431/__cypress/runner/cypress_runner.js:2023:16) at Async._drainQueues (http://localhost:36431/__cypress/runner/cypress_runner.js:2033:10) at Async.drainQueues (http://localhost:36431/__cypress/runner/cypress_runner.js:1907:14) at
我的公开仓库:https://github.com/joffreyBerrier/rails-travis
我的公共Travis版本:https://travis-ci.org/joffreyBerrier/rails-travis/builds
我的Cypress测试:
describe('Testing', () => { it('can i access to 127.0.0.1', () => { cy.request('http://127.0.0.1:3000'); }); it('can i access to localhost', () => { cy.request('localhost:3000'); }); });
答案 0 :(得分:0)
OP使用以下.travis.yml
解决了他的问题:
language: node_js
node_js:
- 9.11.2
addons:
postgresql: "9.4"
services:
- redis-server
- postgresql
cache:
bundler: true
yarn: true
directories:
- /home/travis/.rvm/
- ~/.cache
before_install:
- gem install bundler
- bundle install
install:
- yarn add cypress
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- bin/rails server &
- bundle exec rake assets:precompile
- sleep 10
- RAILS_ENV=test bundle exec rake db:schema:load
- RAILS_ENV=test bundle exec rake your_seed
script:
- $(yarn bin)/cypress run --record
- bundle exec rspec spec/controllers spec/models spec/jobs