twalpole / apparition

Capybara driver for Chrome using CDP
MIT License
363 stars 46 forks source link

Does it run on hosted CI e.g. CircleCI, TravisCI? #10

Closed teohm closed 5 years ago

teohm commented 5 years ago

Hi, can anyone confirm if this new driver runs properly on hosted CI such as CircleCI, TravisCI etc?

I'm just started to test it on CircleCI, my RSpec test suite just hang and timed out.

RSpec is shutting down and will print the summary report... Interrupt again to force quit.
Too long with no output (exceeded 10m0s)
twalpole commented 5 years ago

@teohm This is still in beta so it hasn't been fully tested on different CI setups however there is nothing specifically know that should stop it from working. If you can provide a way to reproduce your issue I'll be happy to look into it.

baffers commented 5 years ago

I'm experiencing this too with CircleCI

twalpole commented 5 years ago

@baffers As mentioned in my previous answer -- if someone can provide a simple project that reproduces this behavior I'll be more than happy to take a look and figure out what's going wrong.

baffers commented 5 years ago

I totally understand, as soon as I wrote that comment I was like "they're going to want an example". it's kind of a weird week for me so if @teohm can't provide an example this week, I'll try to get one together next week

twalpole commented 5 years ago

@baffers Sounds good -- one quick question, are you using the released gem or the master branch?

baffers commented 5 years ago

@twalpole master. Also, once I passed in headless: false into the driver config my tests started running so I'm guessing there isn't a huge problem with Apparition, just my set up. I'm hitting some little bugs with other random things (eg, send_keys(:return) blows up but send_keys(:enter) works) but nothing that I can't work around.

twalpole commented 5 years ago

@baffers Yeah - Looks like there's not currently a key definition for :return - so that would explain that. Please add issues for any other things you come across that don't behave correctly , and I'll get them fixed if possible.

twalpole commented 5 years ago

FYI - there is :enter and :numpad_enter as two different options . - I've also added a :return alias for :enter which notifies the user that :return is deprecated - I assume you came from using capybara_webkit previously since it appears that's the only driver that supported using :return in the first place.

skyeagle commented 5 years ago

@teohm I had the same issue, it turns out these two options helped:

        browser_options: {
          'no-sandbox' => nil,
          'disable-features' => 'VizDisplayCompositor'
        },

the latter one found here

twalpole commented 5 years ago

@skyeagle Thanks for that -- note you should also be able to pass that as

browser_options: [ :no_sandbox, disable_features: 'VizDisplayCompositor']

to reduce the need for all the nils (and strings vs symbols)

twalpole commented 5 years ago

If anyone else can confirm whether or not those two options fix the issue for them, I'll go ahead and close this

baffers commented 5 years ago

@twalpole yes it did!

twalpole commented 5 years ago

Great! - Closing this then.

etagwerker commented 5 years ago

@twalpole Just ran into this issue and the attempts listed above did not work for me. 😢

Here are the things I tried:

require 'capybara/apparition'

Capybara.register_driver :apparition do |app|
  Capybara::Apparition::Driver.new(
    app,
    browser_options: {
      'no-sandbox' => nil,
      'disable-features' => 'VizDisplayCompositor'
    }
  )
end

Capybara.javascript_driver = :apparition

That didn't work.

Then I tried:

require 'capybara/apparition'

Capybara.register_driver :apparition do |app|
   Capybara::Apparition::Driver.new(app, browser_options: [ :no_sandbox, disable_features: 'VizDisplayCompositor'])
end

Capybara.javascript_driver = :apparition

I get a timeout from Circle CI with this output:

bundle exec rspec --format progress $TEST_FILES
Requested historical based timing, but they are not present.  Falling back to name based sorting
................................................Capybara starting Puma...
* Version 3.12.1 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:43099

Is there something I'm doing wrong?

I tried with both apparition v0.4.0 and apparition from master

baffers commented 5 years ago

Hey @etagwerker I'm sure if this will help but this is our config:

Capybara::Apparition::Driver.new(app, {
                                         browser_logger: nil,
                                         headless: true, # TO RUN A BROWSER LOCALLY, CHANGE TO FALSE
                                         browser_options: [ :disable_gpu, :no_sandbox, disable_features: 'VizDisplayCompositor']
                                      }
                                 )  
kjakub commented 5 years ago

i was running to the same issue on gitlab/cicd and confirming here that options from @baffers helped. @twalpole I would add link to this issue from main README.md , it took me some time to come here

kjakub commented 5 years ago

@twalpole :1st_place_medal: for this repo