【问题标题】:Xvfb needs to be installed to be able to run the bitbucket pipeline需要安装XVFB以便能够运行Bitbucket管道
【发布时间】:2021-04-13 15:59:35
【问题描述】:

查看以前的票证,似乎必须从 NPM 库安装,我不知道为什么要我安装它,因为我无法在管道下运行 Sudo。

这是我的输出:

> installation_cypress@1.0.0 cy:run /opt/atlassian/pipelines/agent/build
> cypress run
It looks like this is your first time using Cypress: 6.2.1
[21:42:54]  Verifying Cypress can run /root/.cache/Cypress/6.2.1/Cypress [started]
[21:42:54]  Verifying Cypress can run /root/.cache/Cypress/6.2.1/Cypress [failed]
Your system is missing the dependency: Xvfb
Install Xvfb and run Cypress again.
Read our documentation on dependencies for more information:
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
----------
Error: spawn Xvfb ENOENT
----------
Platform: linux (Debian - 9.9)
Cypress Version: 6.2.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! installation_cypress@1.0.0 cy:run: `cypress run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the installation_cypress@1.0.0 cy:run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-01-07T21_42_54_586Z-debug.log
2021-01-07T21:42:54.598292177Z stdout P 

我们应该怎么做才能解决这个问题?

【问题讨论】:

    标签: node.js automation bitbucket cypress bitbucket-pipelines


    【解决方案1】:

    对此的最佳解决方案是在您的 YAML 文件中使用不同的配置。

    现在,我通过使用这个配置解决了这个问题:

    package.json:

    
            "scripts": {
            
             "jira:chrome": "cypress run --group 1x-chrome --record --headless --browser chrome",
            
              "jira:firefox": "cypress run --group 1x-firefox --record --headless --browser firefox",
            
              "jira:electron": "cypress run --group 1x-electron --record  --headless --browser electron"
            }
    

    bitbucket-pipelines.yaml:

        
        
        image: cypress/included:6.2.1
        options:
          max-time: 10
          
        # job definition cross-browser testing
        jira-chrome: &jira-chrome
          name: JIRA Chrome tests
          caches:
            - node
            - cypress
          script:
            - npx @bahmutov/print-env BITBUCKET
            - npm run jira:chrome -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard]
          artifacts:
            # store any generates images and videos as artifacts
            - cypress/screenshots/**
            - cypress/videos/**
        
        
        jira-firefox: &jira-firefox
          name: JIRA Firefox tests
          caches:
            - node
            - cypress
          script:
            - npx @bahmutov/print-env BITBUCKET
            - npm run jira:firefox -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard]
        
          artifacts:
            # store any generates images and videos as artifacts
            - cypress/screenshots/**
            - cypress/videos/**
        
        
        jira-electron: &jira-electron
          name: JIRA Electron tests
          caches:
            - node
            - cypress
          script:
            - npx @bahmutov/print-env BITBUCKET
            - npm run jira:electron -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard]
        
          artifacts:
            # store any generates images and videos as artifacts
            - cypress/screenshots/**
            - cypress/videos/**
            
        pipelines:
          default:
          - step:
              name: Install dependencies
              caches:
                - npm
                - cypress
                - node
              script:
                - npm ci
                - npx @bahmutov/print-env BITBUCKET
          - parallel:
            # cross-browser testing
            - step:
                <<: *jira-chrome    
            - step:
                <<: *jira-firefox
            - step:
                <<: *jira-electron
        definitions:
          caches:
           npm: $HOME/.npm
           cypress: $HOME/.cache/Cypress
    

    这将解决此问题。如果您有任何问题或疑虑,请告诉我,我将非常乐意为您提供帮助...!

    【讨论】:

    • 你能在交互模式下运行 cypress 吗?这将在 CLI 中针对图像运行 cypress。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-28
    • 1970-01-01
    • 2019-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多