percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
70 stars 43 forks source link

Recent Percy CLI (post 1.1.0) downloads browser even when available at PERCY_BROWSER_EXECUTABLE #935

Closed geoffharcourt closed 2 years ago

geoffharcourt commented 2 years ago

The problem

We upgraded to Percy CLI 1.2.1 (from 1.1.0) last night, and started seeing our browser launches start failing. We are running on Alpine Linux, which is known for being difficult to install Chrome on, and have been using our own installation for several years. We know the browser is there because our system tests are running in it, and we print the browser version out with this line right before we run the specs:

# Output the version of Chrome for debugging
echo "Chromium version for Percy: $($PERCY_BROWSER_EXECUTABLE --version)"

Environment

Details

When our tests run, despite the local Chromium instance already being installed, we see this output:

Chromium version for Percy: Chromium 99.0.4844.84
--
  | [percy] Successfully downloaded Chromium 929511
  | [percy] Skipping visual tests
  | [percy] Error: Failed to launch browser.
  | Error relocating /usr/local/share/.config/yarn/global/node_modules/@percy/core/.local-chromium/929511/chrome-linux/chrome: __mbrlen: symbol not found
  | Error relocating /usr/local/share/.config/yarn/global/node_modules/@percy/core/.local-chromium/929511/chrome-linux/chrome: __close: symbol not found
  | Error relocating /usr/local/share/.config/yarn/global/node_modules/@percy/core/.local-chromium/929511/chrome-linux/chrome: initstate_r: symbol not found
  | Error relocating /usr/local/share/.config/yarn/global/node_modules/@percy/core/.local-chromium/929511/chrome-linux/chrome: random_r: symbol not found

I have confirmed by falling back to CLI v1.1.0 that this doesn't happen in that version, we end up using the specified browser and don't attempt to install or use another version of Chromium.

Debug logs

Most of the output was a successful download of Chrome, but the download part is too big to put here. This is a link the full output: https://gist.githubusercontent.com/geoffharcourt/71f9373d03a2c1c830e08ded6c3647c6/raw/a3beee21e434cac515aa6da23b9ea2bdcb284f5d/Percy%2520logs

Here's what look like the relevant parts:

Chromium version for Percy: Chromium 99.0.4844.84 

[percy:config] Found config file: .percy.yml (0ms)

[percy:config] Using config:

{

  version: 2,

  snapshot: {

    percyCSS: 'video::-webkit-media-controls-panel {\n' +

      '  display: none !important;\n' +

      '  opacity: 0 !important;\n' +

      '}\n' +

      '\n' +

      'video::-webkit-media-controls-timeline {\n' +

      '  display: none;\n' +

      '}\n' +

      '\n' +

      'body.full_year_curriculum_info iframe {\n' +

      '  display: none;\n' +

      '}\n' +

      '\n' +

      '#manage-students-table-actions,\n' +

      '#sort-search-results {\n' +

      '  background-color: white !important;\n' +

      '  color: white !important;\n' +

      '}\n' +

      '\n' +

      '#toast-container {\n' +

      '  visibility: hidden;\n' +

      '}\n' +

      '\n' +

      '.essay-saving {\n' +

      '  display: none;\n' +

      '}\n' +

      '\n' +

      '.front-testimonial-copy {\n' +

      '  visibility: hidden !important;\n' +

      '}\n' +

      '\n' +

      '.testimonial-identity {\n' +

      '  visibility: hidden !important;\n' +

      '}\n' +

      '\n' +

      '.fyc-testimonial-info {\n' +

      '  visibility: hidden !important;\n' +

      '}\n' +

      '\n' +

      '.fyc-testimonial-learn-more {\n' +

      '  visibility: hidden;\n' +

      '}\n',

    widths: [

      1370

    ]

  },

  discovery: {

    networkIdleTimeout: 250,

    disableCache: true

  }

} (21ms)

... (downloading of Chrome which succeeds)

[percy:core:browser] Launching browser (29ms)

[percy:core:browser] Closing browser (28ms)

[percy:core:browser] Browser closed (6ms)

[percy:cli:exec] Skipping visual tests (0ms)

[percy:cli:exec] Error: Failed to launch browser. 

Error relocating /usr/local/share/.config/yarn/global/node_modules/@percy/core/.local-chromium/929511/chrome-linux/chrome: __mbrlen: symbol not found

Error relocating /usr/local/share/.config/yarn/global/node_modules/@percy/core/.local-chromium/929511/chrome-linux/chrome: __close: symbol not found

Error relocating /usr/local/share/.config/yarn/global/node_modules/@percy/core/.local-chromium/929511/chrome-linux/chrome: initstate_r: symbol not found

Error relocating /usr/local/share/.config/yarn/global/node_modules/@percy/core/.local-chromium/929511/chrome-linux/chrome: random_r: symbol not found

'





    at file:///usr/local/share/.config/yarn/global/node_modules/@percy/core/dist/browser.js:233:55

    at cleanup (file:///usr/local/share/.config/yarn/global/node_modules/@percy/core/dist/browser.js:241:9)

    at handleError (file:///usr/local/share/.config/yarn/global/node_modules/@percy/core/dist/browser.js:233:34)

    at Socket.handleExitClose (file:///usr/local/share/.config/yarn/global/node_modules/@percy/core/dist/browser.js:231:35)

    at Socket.emit (node:events:538:35)

    at Pipe.<anonymous> (node:net:687:12) (0ms)

[percy:cli:exec] Running "bundle exec rake db:create db:schema:load search:index_all_commonlit_content_synchronously knapsack_pro:queue:rspec[--format documentation --format RSpec::Buildkite::AnnotationFormatter]" (1ms)

Code to reproduce issue

Given the nature of testing/environment bugs, it’s best to try and isolate the issue in a reproducible repo. This will make it much easier for us to diagnose and fix.

Robdel12 commented 2 years ago

Whoops, looks like we deleted the env var in this PR: https://github.com/percy/cli/pull/922/files#diff-6880a3b5416b99a6e775053e1e1cb135e960f420d80f6009c6c31b2e7942cab9L72

We'll get this put back into place! v1.14 is the last version that has this for now

skybenedettof commented 2 years ago

@Robdel12 Any idea on when the fix will be released?

Robdel12 commented 2 years ago

Released in 1.3.0: https://github.com/percy/cli/releases/tag/v1.3.0