Skip to content

Conversation

@jmuheim
Copy link
Owner

@jmuheim jmuheim commented Jun 9, 2018

Bootstrap 4 uses Flexbox which is not supported by PhantomJS, so some existing specs failed.

This is a good moment to replace PhantomJS with headless Chrome.

Took the chance to also update other gems.

Copy link
Owner Author

@jmuheim jmuheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @gurix!

# config.action_controller.action_on_unpermitted_parameters = :raise

# Automatically convert boolean values to integer using sqlite3
config.active_record.sqlite3.represent_boolean_as_integer = true if Rails.version >= '5.1.0' && config.active_record.sqlite3.present?
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use SQLite at all. As far as I remember some tests use to break under SQLite, so I decided to use MySQL also in tests.

So I think we should rather try to remove all SQLite stuff, maybe then the deprecation warning would go away?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply the deprecation warning goes away but nothing is stopping someone to use the base project in conjunction with sqlite so it is justified here.

@@ -1,0 +1,10 @@
AllCops:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Rubocop some time ago, but didn't remember I'm still using it.

It's good to have it, I think. But line length and stuff sometimes seems a pain in the ass, especially in specs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True but for some blocks as it, scenario and so on you can disable the line length. Feel free to change it as soon as it disturbs you (not tested):

LineLength:
  Enabled: true
  Max: 160
  ExcludedMethods:
    - describe
    - context
    - scenario
    - it
    - feature
Metrics/BlockLength:
  ExcludedMethods:
    - describe
    - context
    - scenario
    - it
    - feature

fill_in 'page_notes', with: 'A new note'

find('#page_images_attributes_0_file', visible: false).set base64_other_image[:data]
# As capybara does not finde thethe element having "display: none" in headless chrome we simulate it as js code
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea.

Some improvements:

  • Typos: finde thethe
  • Create a module with this method, e.g. find_hidden (see FocusElement module for inspiration) so we can reuse it.

gem 'rspec'
gem 'rspec-rails' # RSpec for Rails

gem 'capybara' # Capybara helps you test web applications by simulating how a real user would interact with your app.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Why does it work locally with capybara-selenium only, but not on Travis?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you installed capybara before and capybara-selenium does not depend from capybara for its own in this case. But yeah it should as it is declared in https://github.com/dsaenztagarro/capybara-selenium/blob/868a5b6329464f0d0bcee5beda5a93c4623182d7/capybara_selenium.gemspec#L21.

Gemfile Outdated

gem 'capybara' # Capybara helps you test web applications by simulating how a real user would interact with your app.

gem 'sqlite3' # Use SQLite as the database for Active Record
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, look here! Maybe this is the cause for the deprecation warning?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh uhhmm I guess so. I'l try to remove it.

before_install:
- export TZ=Europe/Zurich
- mysql -e 'CREATE DATABASE base_test'
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting stuff. Could you explain a bit more (or give a link)?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, Chromedriver isn't found on Travis. Any idea how to fix?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope I had not the time atm.

Copy link
Collaborator

@gurix gurix Jun 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/flavorjones/chromedriver-helper seems to install it properly. Hint came from http://quyetbui.info/chrome-headless-capybara-on-travis-ci/. But i am not sure if i.e google-chrome-stable --headless --disable-gpu ... and the gem capybara-selenium ir really needed in this setting.

@gurix
Copy link
Collaborator

gurix commented Jun 11, 2018

At least headless Chromedriver is found somehow. But still a lot is broken 😡.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants