agileware-jp / redmine_issue_templates

Redmine Issue Template. Pull requests, reporting issues, stars and sponsoring are always welcome!
https://www.redmine.org/plugins/redmine_issue_templates
GNU General Public License v2.0
70 stars 32 forks source link

RSpec test doesn't work on Redmine 4.2.0 and later #22

Closed yui-har closed 2 years ago

yui-har commented 2 years ago

Summary

Currently, all visit method call raises an exception error.

Description

% RAILS_ENV=test bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/

...

2022-04-21 16:17:18 WARN Selenium [DEPRECATION] [:desired_capabilities] :desired_capabilities as a parameter for driver initialization is deprecated. Use :capabilities with an Array value of capabilities/options if necessary instead.
2022-04-21 16:17:18 WARN Selenium [DEPRECATION] [:browser_options] :options as a parameter for driver initialization is deprecated. Use :capabilities with an Array of value capabilities/options if necessary instead.
    Settings "apply_global_template_to_all_projects" is displayed. (FAILED - 1)

...

Failures:

  1) PluginSetting to apply Global issue templates to all the projects plugin settings  Settings "apply_global_template_to_all_projects" is displayed.
     Failure/Error: log_user(user.login, user.login)

     Selenium::WebDriver::Error::WebDriverError:
       no sessionId in returned payload
     # ./plugins/redmine_issue_templates/spec/support/login_helper.rb:5:in `log_user'
     # ./plugins/redmine_issue_templates/spec/features/admin_spec.rb:25:in `block (2 levels) in <top (required)>'

...

In addition, the rake task redmine_issue_templates:spec does not work.

% RAILS_ENV=test bundle exec rake redmine_issue_templates:spec

An error occurred while loading ./plugins/redmine_issue_templates/spec/features/admin_spec.rb.
Failure/Error: load_dependency(file) { result = super }

LoadError:
  cannot load such file -- spec_helper
# ./plugins/redmine_issue_templates/spec/rails_helper.rb:8:in `<top (required)>'
# ./plugins/redmine_issue_templates/spec/features/admin_spec.rb:2:in `require_relative'
# ./plugins/redmine_issue_templates/spec/features/admin_spec.rb:2:in `<top (required)>'
# ./plugins/redmine_issue_templates/lib/tasks/test.rake:27:in `block (2 levels) in <top (required)>'

...

Finished in 0.00004 seconds (files took 2.32 seconds to load)
0 examples, 0 failures, 5 errors occurred outside of examples

Environment

yui-har commented 2 years ago

Redmine 4.2.0 has changed Selenium webdriver option key chromeOptions to goog:chromeOptions. https://www.redmine.org/issues/34119 https://www.redmine.org/projects/redmine/repository/revisions/20549/diff/trunk/test/application_system_test_case.rb

The redmine_issue_templates plugin also needs to make this change.

yui-har commented 2 years ago

I want to use the plugin in Redmine 4.2 or later, so I want to change requires_redmine version_or_higher: '4.0' to 4.2.

master: https://github.com/agileware-jp/redmine_issue_templates/blob/master/init.rb#L52 0.3-stable: https://github.com/agileware-jp/redmine_issue_templates/blob/0.3-stable/init.rb#L52

And, since the value of version_or_higher changes, I think you need to increase the version number of the plugin.

yui-har commented 2 years ago

I want to use the plugin in Redmine 4.2 or later, so I want to change requires_redmine version_or_higher: '4.0' to 4.2.

master: https://github.com/agileware-jp/redmine_issue_templates/blob/master/init.rb#L52 0.3-stable: https://github.com/agileware-jp/redmine_issue_templates/blob/0.3-stable/init.rb#L52

And, since the value of version_or_higher changes, I think you need to increase the version number of the plugin.

It depends on the combination of capybara gem and ChromeDriver, but I confirmed that RSpec works on Redmine 4.0. Therefore, the value of version_or_higher does not need to be changed.

yui-har commented 2 years ago

@kyamada23 @nishidayuya Thank you for reviewing and merging #23 and #24. If the problem is resolved, please close this issue.