带有 Cypress 作业的 Azure 管道失败(错误:连接 ETIMEDOUT 89.26.127.7:443)

问题描述 投票:0回答:1
Running:  account-info.cy.js                                                             (1 of 28)
2024-03-06T14:33:47.1630675Z 
2024-03-06T14:33:47.1632042Z 
2024-03-06T14:33:47.1671568Z   Customer Login and changing the info
2024-03-06T14:34:29.6433747Z     1) "before all" hook for "should log and changed personal settings and add Family memeber: AXQA-7462 AXQA-7463"
2024-03-06T14:34:29.6444319Z 
2024-03-06T14:34:30.0768369Z 
2024-03-06T14:34:30.0883026Z   0 passing (43s)
2024-03-06T14:34:30.0960102Z   1 failing
2024-03-06T14:34:30.0970550Z 
2024-03-06T14:34:30.0971383Z   1) Customer Login and changing the info
2024-03-06T14:34:30.0972105Z        "before all" hook for "should log and changed personal settings and add Family memeber: AXQA-7462 AXQA-7463":
2024-03-06T14:34:30.0974931Z      CypressError: `cy.visit()` failed trying to load:
2024-03-06T14:34:30.0975179Z 
2024-03-06T14:34:30.0975605Z https://latestversion.webdev-staging.teamaxess.com/en/Products/Tickets
2024-03-06T14:34:30.0975973Z 
2024-03-06T14:34:30.0976219Z We attempted to make an http request to this URL but the request failed without a response.
2024-03-06T14:34:30.0976416Z 
2024-03-06T14:34:30.0976647Z We received this error at the network level:
2024-03-06T14:34:30.0976816Z 
2024-03-06T14:34:30.0977081Z   > Error: connect ETIMEDOUT 89.26.127.7:443
2024-03-06T14:34:30.0979612Z 
2024-03-06T14:34:30.0980310Z Common situations why this would fail:
2024-03-06T14:34:30.0980855Z   - you don't have internet access
2024-03-06T14:34:30.0981241Z   - you forgot to run / boot your web server
2024-03-06T14:34:30.0981614Z   - your web server isn't accessible
2024-03-06T14:34:30.0981994Z   - you have weird network configuration settings on your computer

我正在尝试使用 Azure 从头开始构建管道。 错误页面:https://latestversion.webdev-staging.teamaxess.com/en/Products/Tickets可以访问。 到目前为止的结果是,一旦 azure 运行 npx cypress run ,作业就会失败。

每次测试都会出现问题。总是一样的。

我相信这是因为我的配置而发生的,但我不确定。

我使用的配置(azure-pipelines.yml)是:

# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger: none

pool:
  vmImage: 'windows-latest'

variables:
  npm_config_cache: $(Pipeline.Workspace)/.npm
  cypress_config_cache: $(Pipeline.Workspace)/.cache/Cypress

steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '18.x'
    displayName: 'Install Node.js'

  # NPM modules and Cypress binary should be cached
  # otherwise the install will be too slow
  # https://docs.microsoft.com/en-us/azure/devops/pipelines/caching/?view=azure-devops
  # since the username / user home directory are not available via system variables
  # (there is even an open question about it)
  # https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops
  # just use "/home/vsts" for now

  - task: Cache@2
    inputs:
      key: 'npm | "$(Agent.OS)" | package-lock.json'
      restoreKeys: |
        npm | "$(Agent.OS)"
      path: $(npm_config_cache)
    displayName: Cache npm

  - task: Cache@2
    inputs:
      key: cypress | $(Agent.OS) | package-lock.json
      restoreKeys: |
        cypress | $(Agent.OS)
      path: $(cypress_config_cache)
    displayName: Cache cypress

  # Install Node dependencies
  - script: npm ci
    displayName: 'Install NPM dependencies'

  - script: npm run cy:verify
    displayName: 'Cypress verify'

  - script: npm run cy:info
    displayName: 'Cypress info'

  # The next command starts the server and runs Cypress end-to-end tests against it.
  # The test artifacts (video, screenshots, test output) will be uploaded to Cypress dashboard.
  # To record on Cypress dashboard we need to set CYPRESS_RECORD_KEY environment variable.
  # For setting ci-build-id, BUILD_BUILDNUMBER is a good candidate
  - script: |
      npx cypress run
    displayName: 'Run Cypress tests for base_url $(CYPRESS_BASE_URL_LATEST)'
    env:
      # avoid warnings about terminal
      TERM: xterm
  - task: PublishTestResults@2
    condition: succeededOrFailed()
    inputs:
      testResultsFormat: 'JUnit'
      testResultsFiles: '**/results-*.xml'
      testRunTitle: 'Publish Test Results'

每次测试失败的原因都是相同的。原因是>错误:连接ETIMEDOUT 89.26.127.7:443。有人可以让我知道我做错了什么吗?

azure azure-devops cypress
1个回答
0
投票

从您发布的 YAML 中,可以看到您正在使用环境变量“

cypress_config_cache
”来设置/覆盖 Cypress 二进制文件的默认缓存文件夹。

根据文档“高级安装”,正确的环境变量应该是“

CYPRESS_CACHE_FOLDER
”。

© www.soinside.com 2019 - 2024. All rights reserved.