From: Emin Kocan Date: Wed, 11 Sep 2024 23:54:31 +0000 (+0200) Subject: Selenium driver working on local X-Git-Tag: live~68^2~4 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/123c7d10a5e798e2379dfb04df4a22b1deface3c Selenium driver working on local --- diff --git a/Gemfile b/Gemfile index 165236cdf..804a9c185 100644 --- a/Gemfile +++ b/Gemfile @@ -141,6 +141,9 @@ gem "image_processing" # Used to validate widths gem "unicode-display_width" +gem "teaspoon" +gem "teaspoon-mocha" + # Gems useful for development group :development do gem "better_errors" diff --git a/Gemfile.lock b/Gemfile.lock index cb6a5d45c..e235cb6b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,9 +81,6 @@ GEM tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) - annotate (3.2.0) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) argon2 (2.3.0) ffi (~> 1.15) ffi-compiler (~> 1.0) @@ -169,9 +166,6 @@ GEM sprockets-rails tilt date (3.3.4) - debug (1.9.2) - irb (~> 1.10) - reline (>= 0.3.8) debug_inspector (1.2.0) deep_merge (1.2.2) delayed_job (4.1.12) @@ -582,6 +576,10 @@ GEM railties (>= 3.2.5) teaspoon-mocha (2.3.3) teaspoon (>= 1.0.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + terser (1.2.4) + execjs (>= 0.3.0, < 3) thor (1.3.2) tilt (2.4.0) timeout (0.4.1) @@ -620,7 +618,6 @@ DEPENDENCIES active_record_union activerecord-import addressable (~> 2.8) - annotate argon2 autoprefixer-rails aws-sdk-s3 @@ -639,7 +636,6 @@ DEPENDENCIES connection_pool dalli dartsass-sprockets - debug debug_inspector delayed_job_active_record doorkeeper @@ -710,7 +706,8 @@ DEPENDENCIES simplecov-lcov sprockets-exporters_pack strong_migrations (< 2.0.0) - teaspoon-mocha (~> 2.3) + teaspoon + teaspoon-mocha terser turbo-rails unicode-display_width diff --git a/test/teaspoon_env.rb b/test/teaspoon_env.rb index c23a7a3c3..8a9dc001f 100644 --- a/test/teaspoon_env.rb +++ b/test/teaspoon_env.rb @@ -41,11 +41,11 @@ Teaspoon.configure do |config| suite.matcher = "{test/javascripts,app/assets}/**/*_test.{js,js.coffee,coffee,es6,js.es6}" # Load additional JS files, but requiring them in your spec helper is the preferred way to do this. - #suite.javascripts = [] + # suite.javascripts = [] # You can include your own stylesheets if you want to change how Teaspoon looks. # Note: Spec related CSS can and should be loaded using fixtures. - #suite.stylesheets = ["teaspoon"] + # suite.stylesheets = ["teaspoon"] # This suites spec helper, which can require additional support files. This file is loaded before any of your test # files are loaded. @@ -62,22 +62,22 @@ Teaspoon.configure do |config| # Hooks allow you to use `Teaspoon.hook("fixtures")` before, after, or during your spec run. This will make a # synchronous Ajax request to the server that will call all of the blocks you've defined for that hook name. - #suite.hook :fixtures, &proc{} + # suite.hook :fixtures, &proc{} # Determine whether specs loaded into the test harness should be embedded as individual script tags or concatenated # into a single file. Similar to Rails' asset `debug: true` and `config.assets.debug = true` options. By default, # Teaspoon expands all assets to provide more valuable stack traces that reference individual source files. - #suite.expand_assets = true + # suite.expand_assets = true # Non-.js file extensions Teaspoon should consider JavaScript files - #suite.js_extensions = [/(\.js)?.coffee/, /(\.js)?.es6/, ".es6.js"] + # suite.js_extensions = [/(\.js)?.coffee/, /(\.js)?.es6/, ".es6.js"] end # Example suite. Since we're just filtering to files already within the root test/javascripts, these files will also # be run in the default suite -- but can be focused into a more specific suite. - #config.suite :targeted do |suite| + # config.suite :targeted do |suite| # suite.matcher = "spec/javascripts/targeted/*_spec.{js,js.coffee,coffee}" - #end + # end # CONSOLE RUNNER SPECIFIC # @@ -98,7 +98,14 @@ Teaspoon.configure do |config| # Selenium Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-Selenium-WebDriver # BrowserStack Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-BrowserStack-WebDriver # Capybara Webkit: https://github.com/jejacks0n/teaspoon/wiki/Using-Capybara-Webkit - #config.driver = :phantomjs + require "selenium-webdriver" + config.driver = :selenium + config.driver_options = { + :client_driver => :firefox, + :selenium_options => { + :options => Selenium::WebDriver::Firefox::Options.new(:args => ["-headless"]) + } + } # Specify additional options for the driver. # @@ -106,41 +113,41 @@ Teaspoon.configure do |config| # Selenium Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-Selenium-WebDriver # BrowserStack Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-BrowserStack-WebDriver # Capybara Webkit: https://github.com/jejacks0n/teaspoon/wiki/Using-Capybara-Webkit - #config.driver_options = nil + # config.driver_options = nil # Specify the timeout for the driver. Specs are expected to complete within this time frame or the run will be # considered a failure. This is to avoid issues that can arise where tests stall. - #config.driver_timeout = 180 + # config.driver_timeout = 180 # Specify a server to use with Rack (e.g. thin, mongrel). If nil is provided Rack::Server is used. - #config.server = nil + # config.server = nil # Specify a host to run on a specific host, otherwise Teaspoon will use 127.0.0.1. - #config.server_host = nil + # config.server_host = nil # Specify a port to run on a specific port, otherwise Teaspoon will use a random available port. - #config.server_port = nil + # config.server_port = nil # Timeout for starting the server in seconds. If your server is slow to start you may have to bump this, or you may # want to lower this if you know it shouldn't take long to start. - #config.server_timeout = 20 + # config.server_timeout = 20 # Force Teaspoon to fail immediately after a failing suite. Can be useful to make Teaspoon fail early if you have # several suites, but in environments like CI this may not be desirable. - #config.fail_fast = true + # config.fail_fast = true # Specify the formatters to use when outputting the results. # Note: Output files can be specified by using `"junit>/path/to/output.xml"`. # # Available: :dot, :clean, :documentation, :json, :junit, :pride, :rspec_html, :snowday, :swayze_or_oprah, :tap, :tap_y, :teamcity - #config.formatters = [:dot] + # config.formatters = [:dot] # Specify if you want color output from the formatters. - #config.color = true + # config.color = true # Teaspoon pipes all console[log/debug/error] to $stdout. This is useful to catch places where you've forgotten to # remove them, but in verbose applications this may not be desirable. - #config.suppress_log = false + # config.suppress_log = false # COVERAGE REPORTS / THRESHOLD ASSERTIONS # @@ -157,7 +164,7 @@ Teaspoon.configure do |config| # Specify that you always want a coverage configuration to be used. Otherwise, specify that you want coverage # on the CLI. # Set this to "true" or the name of your coverage config. - #config.use_coverage = nil + # config.use_coverage = nil # You can have multiple coverage configs by passing a name to config.coverage. # e.g. config.coverage :ci do |coverage| @@ -166,21 +173,21 @@ Teaspoon.configure do |config| # Which coverage reports Istanbul should generate. Correlates directly to what Istanbul supports. # # Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity - #coverage.reports = ["text-summary", "html"] + # coverage.reports = ["text-summary", "html"] # The path that the coverage should be written to - when there's an artifact to write to disk. # Note: Relative to `config.root`. - #coverage.output_path = "coverage" + # coverage.output_path = "coverage" # Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The # default excludes assets from vendor, gems and support libraries. - #coverage.ignore = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}] + # coverage.ignore = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}] # Various thresholds requirements can be defined, and those thresholds will be checked at the end of a run. If any # aren't met the run will fail with a message. Thresholds can be defined as a percentage (0-100), or nil. - #coverage.statements = nil - #coverage.functions = nil - #coverage.branches = nil - #coverage.lines = nil + # coverage.statements = nil + # coverage.functions = nil + # coverage.branches = nil + # coverage.lines = nil end end