diff --git a/.circleci/config.yml b/.circleci/config.yml index 978ebbbf..3ac67d53 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,14 +11,14 @@ general: jobs: build: docker: - # specify the version you desire here (ruby 2.4.x) - - image: circleci/ruby:2.5-browsers-legacy + # specify the version you desire here (ruby 2.6.x) + - image: circleci/ruby:2.6-browsers-legacy steps: - checkout test: docker: # specify the version you desire here - - image: circleci/ruby:2.5-browsers-legacy + - image: circleci/ruby:2.6-browsers-legacy environment: RAILS_ENV: test DB_HOST: 127.0.0.1 @@ -37,6 +37,7 @@ jobs: name: ready for redmine command: | REDMINE_BRANCH=master sh script/circleci-setup.sh + - run: perl -pi -e "s/gem \"capybara\".*$/gem \"capybara\"/g" Gemfile - run: bundle install --path vendor/bundle --without postgresql rmagick && bundle update - run: bundle exec rails g rspec:install - run: bundle exec rake db:create RAILS_ENV=test @@ -47,7 +48,20 @@ jobs: bundle exec rake ${CIRCLE_PROJECT_REPONAME}:test RAILS_ENV=test - run: command: | - bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/ + bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/models/ + - run: + command: | + bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/helpers/ + - run: + command: | + bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/controllers/ + - run: + command: | + bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/requests/ + - run: + command: | + bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/features/ + - run: command: | bundle exec rake redmine:plugins:migrate NAME=${CIRCLE_PROJECT_REPONAME} \ diff --git a/.gitattributes b/.gitattributes index 572629a3..f3ed94dd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,3 +7,4 @@ Gemfile.local export-ignore .circleci/ export-ignore docker-compose.yml export-ignore Dockerfile export-ignore +_config.yml export-ignore diff --git a/.rubocop.yml b/.rubocop.yml index 2014a51d..803a6275 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,3 @@ inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 2.2 + TargetRubyVersion: 2.3 diff --git a/README.md b/README.md index 0ca5f81d..937dc140 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,18 @@ If you have any requests, bug reports, please use GitHub issues. + + + diff --git a/app/views/global_issue_templates/_form.html.erb b/app/views/global_issue_templates/_form.html.erb index c180af74..a114b8aa 100644 --- a/app/views/global_issue_templates/_form.html.erb +++ b/app/views/global_issue_templates/_form.html.erb @@ -1,185 +1,185 @@ -<%= error_messages_for 'global_issue_template' %> -
-

<%= f.text_field :title, required: true, size: 80, label: l(:issue_template_name) %>

- -
- <%= l(:label_applied_for_issue) %> -

- <% if issue_template.tracker.blank? %> - <%= f.select :tracker_id, trackers.collect { |t| [t.name, t.id] }, {required: true}, - required: true, label: l(:label_tracker) %> - - <%= h issue_template.tracker.present? ? issue_template.tracker.name : - l(:orphaned_template, default: 'Orphaned template from tracker') %> - - <% else %> - <%= f.select :tracker_id, trackers.collect { |t| [t.name, t.id] }, {required: true}, - required: true, label: l(:label_tracker), selected: issue_template.tracker.id %> - <% end %> -

-

<%= f.text_field :issue_title, required: false, size: 80, label: l(:issue_title) %> - - <%= l(:help_for_this_field) %> - - -

-

- <%= f.text_area :description, cols: 78, rows: 12, - required: true, - label: l(:issue_description), class: 'wiki-edit', style: 'overflow:auto;' %> -

- - <% if checklist_enabled %> -

- - - -

    - <% issue_template.checklist.each_with_index do |content, i| %> -
  • - - <%= content %> - - - -
  • - <% end %> -
-

- <% end %> -
-

- <%= f.text_area :note, cols: 70, rows: 3, - required: false, - label: l(:issue_template_note), style: 'overflow:auto;' %> -

- -

<%= f.check_box :is_default, label: l(:field_is_default) %> - - <%= l(:help_for_this_field) %> - - -

- -

<%= f.check_box :enabled, label: l(:label_enabled) %> - - <%= l(:help_for_this_field) %> - - -

-
- -<%= wikitoolbar_for 'global_issue_template_description' %> - -
-<%= link_to l(:button_cancel), {action: 'index'}, data: {confirm: l(:text_are_you_sure)} %> - - - - - - - - - - -
- <% if apply_all_projects %> -

- - - <%= l(:note_apply_global_template_to_all_projects_setting_enabled) %> - - ( - <%= link_to(l(:label_settings), - { controller: 'settings', action: 'plugin', id: 'redmine_issue_templates' }, - class: 'issue_template icon plugins') %> ) -

- <% end %> - <% if projects.any? %> -
- - -
- <% end %> - <%= hidden_field_tag 'global_issue_template[project_ids][]', '' %> -
- - -<%= submit_tag l(issue_template.new_record? ? :button_create : :button_save) %> - - +<%= error_messages_for 'global_issue_template' %> +
+

<%= f.text_field :title, required: true, size: 80, label: l(:issue_template_name) %>

+ +
+ <%= l(:label_applied_for_issue) %> +

+ <% if issue_template.tracker.blank? %> + <%= f.select :tracker_id, trackers.collect { |t| [t.name, t.id] }, {required: true}, + required: true, label: l(:label_tracker) %> + + <%= h issue_template.tracker.present? ? issue_template.tracker.name : + l(:orphaned_template, default: 'Orphaned template from tracker') %> + + <% else %> + <%= f.select :tracker_id, trackers.collect { |t| [t.name, t.id] }, {required: true}, + required: true, label: l(:label_tracker), selected: issue_template.tracker.id %> + <% end %> +

+

<%= f.text_field :issue_title, required: false, size: 80, label: l(:issue_title) %> + + <%= l(:help_for_this_field) %> + + +

+

+ <%= f.text_area :description, cols: 78, rows: 12, + required: true, + label: l(:issue_description), class: 'wiki-edit', style: 'overflow:auto;' %> +

+ + <% if checklist_enabled %> +

+ + + +

    + <% issue_template.checklist.each_with_index do |content, i| %> +
  • + + <%= content %> + + + +
  • + <% end %> +
+

+ <% end %> +
+

+ <%= f.text_area :note, cols: 70, rows: 3, + required: false, + label: l(:issue_template_note), style: 'overflow:auto;' %> +

+ +

<%= f.check_box :is_default, label: l(:field_is_default) %> + + <%= l(:help_for_this_field) %> + + +

+ +

<%= f.check_box :enabled, label: l(:label_enabled) %> + + <%= l(:help_for_this_field) %> + + +

+
+ +<%= wikitoolbar_for 'global_issue_template_description' %> + +
+<%= link_to l(:button_cancel), {action: 'index'}, data: {confirm: l(:text_are_you_sure)} %> + + + + + + + + + + +
+ <% if apply_all_projects %> +

+ + + <%= l(:note_apply_global_template_to_all_projects_setting_enabled) %> + + ( + <%= link_to(l(:label_settings), + { controller: 'settings', action: 'plugin', id: 'redmine_issue_templates' }, + class: 'issue_template icon plugins') %> ) +

+ <% end %> + <% if projects.any? %> +
+ + +
+ <% end %> + <%= hidden_field_tag 'global_issue_template[project_ids][]', '' %> +
+ + +<%= submit_tag l(issue_template.new_record? ? :button_create : :button_save) %> + + diff --git a/app/views/issue_templates/_form.html.erb b/app/views/issue_templates/_form.html.erb index f3a4bb30..6cbebcc4 100644 --- a/app/views/issue_templates/_form.html.erb +++ b/app/views/issue_templates/_form.html.erb @@ -1,160 +1,160 @@ -<%= error_messages_for 'issue_template' %> -
-

<%= f.text_field :title, required: true, size: 80, label: l(:issue_template_name) %>

- -
- <%= l(:label_applied_for_issue) %> -

- <% if issue_template.tracker.blank? %> - <%= f.select :tracker_id, template_target_trackers(project, issue_template), - required: true, label: l(:label_tracker), include_blank: true %> - - <%= h issue_template.tracker.present? ? issue_template.tracker.name : - l(:orphaned_template, default: 'Orphaned template from tracker') %> - <% else %> - <%= f.select :tracker_id, template_target_trackers(project, issue_template), - required: true, label: l(:label_tracker), selected: issue_template.tracker.id %> - <% unless project_tracker?(issue_template.tracker, project) %>
- <%= non_project_tracker_msg(project_tracker?(issue_template.tracker, project)) %> - <% end %> - <% end %> -

-

<%= f.text_field :issue_title, required: false, size: 80, label: l(:issue_title) %> - - <%= l(:help_for_this_field) %> - - -

-

- <%= f.text_area :description, cols: 78, rows: 12, - required: true, - label: l(:issue_description), class: 'wiki-edit' %> -

- - - <% if checklist_enabled %> -

- - - - -

    - <% issue_template.checklist.each_with_index do |content, i| %> -
  • - - <%= content %> - - - -
  • - <% end %> -
-

- <% end %> -
-

- <%= f.text_area :note, cols: 70, rows: 3, - required: false, - label: l(:issue_template_note) %> -

- -

<%= f.check_box :is_default, label: l(:field_is_default) %> - - <%= l(:help_for_this_field) %> - - -

-

- <%= f.check_box :enabled, label: l(:label_enabled) %> - - <%= l(:help_for_this_field) %> - - -

- -

- <%= f.check_box :enabled_sharing, label: l(:label_enabled_sharing) %> - - <%= l(:help_for_this_field) %> - - -

- -
- -<%= wikitoolbar_for 'issue_template_description' %> - - - - - - - - - - - - +<%= error_messages_for 'issue_template' %> +
+

<%= f.text_field :title, required: true, size: 80, label: l(:issue_template_name) %>

+ +
+ <%= l(:label_applied_for_issue) %> +

+ <% if issue_template.tracker.blank? %> + <%= f.select :tracker_id, template_target_trackers(project, issue_template), + required: true, label: l(:label_tracker), include_blank: true %> + + <%= h issue_template.tracker.present? ? issue_template.tracker.name : + l(:orphaned_template, default: 'Orphaned template from tracker') %> + <% else %> + <%= f.select :tracker_id, template_target_trackers(project, issue_template), + required: true, label: l(:label_tracker), selected: issue_template.tracker.id %> + <% unless project_tracker?(issue_template.tracker, project) %>
+ <%= non_project_tracker_msg(project_tracker?(issue_template.tracker, project)) %> + <% end %> + <% end %> +

+

<%= f.text_field :issue_title, required: false, size: 80, label: l(:issue_title) %> + + <%= l(:help_for_this_field) %> + + +

+

+ <%= f.text_area :description, cols: 78, rows: 12, + required: true, + label: l(:issue_description), class: 'wiki-edit' %> +

+ + + <% if checklist_enabled %> +

+ + + + +

    + <% issue_template.checklist.each_with_index do |content, i| %> +
  • + + <%= content %> + + + +
  • + <% end %> +
+

+ <% end %> +
+

+ <%= f.text_area :note, cols: 70, rows: 3, + required: false, + label: l(:issue_template_note) %> +

+ +

<%= f.check_box :is_default, label: l(:field_is_default) %> + + <%= l(:help_for_this_field) %> + + +

+

+ <%= f.check_box :enabled, label: l(:label_enabled) %> + + <%= l(:help_for_this_field) %> + + +

+ +

+ <%= f.check_box :enabled_sharing, label: l(:label_enabled_sharing) %> + + <%= l(:help_for_this_field) %> + + +

+ +
+ +<%= wikitoolbar_for 'issue_template_description' %> + + + + + + + + + + + + diff --git a/app/views/issue_templates/_issue_select_form.html.erb b/app/views/issue_templates/_issue_select_form.html.erb index fd7f7b3f..e5de764a 100644 --- a/app/views/issue_templates/_issue_select_form.html.erb +++ b/app/views/issue_templates/_issue_select_form.html.erb @@ -60,22 +60,22 @@ <% end %> diff --git a/app/views/issue_templates/index.html.erb b/app/views/issue_templates/index.html.erb index 2eee6835..1b65b2a0 100644 --- a/app/views/issue_templates/index.html.erb +++ b/app/views/issue_templates/index.html.erb @@ -234,3 +234,5 @@ %> + +<%= render partial: "common/template_links" %> diff --git a/app/views/issue_templates/show.html.erb b/app/views/issue_templates/show.html.erb index a7ae7741..8fb55e5e 100644 --- a/app/views/issue_templates/show.html.erb +++ b/app/views/issue_templates/show.html.erb @@ -1,116 +1,116 @@ -
- <%= link_to_if_authorized l(:button_edit), - { controller: 'issue_templates', action: 'update', id: issue_template, - project_id: project }, - class: 'icon icon-edit', accesskey: accesskey(:edit), - onclick: "$('#edit-issue_template').show(); return false;" %> - <%= link_to l(:button_copy), - { controller: 'issue_templates', - action: 'new', project_id: project, copy_from: issue_template.id }, - class: 'icon icon-copy' %> - <%= link_to_if_authorized l(:button_delete), - { controller: 'issue_templates', action: 'destroy', - id: issue_template, project_id: project }, - data: {confirm: l(:template_remove_confirm, - default: "Are you sure to remove this template? %{count} subprojects use this template.")}, - title: l(:enabled_template_cannot_destroy, default: 'Only disabled template can be destroyed.'), - method: 'delete', class: 'icon icon-del template-disabled-link', disabled: issue_template.enabled? %> - <%= link_to(l(:label_list_templates), - { controller: 'issue_templates', - action: 'index', - project_id: project }, class: 'template') %> -
- -

- <%= l(:issue_templates) %>: #<%= issue_template.id %> <%= issue_template.title %> - <%= avatar(issue_template.author, size: '24') %> -

- -<%= render partial: "common/nodata", locals: { trackers: project.trackers } %> -<% if authorize_for('issue_templates', 'update') %> -
- <%= labelled_form_for :issue_template, issue_template, - url: { controller: 'issue_templates', action: 'update', - project_id: project, id: issue_template }, - html: { id: 'issue_template-form', class: nil, multipart: false } do |f| %> - <%= render 'form', { f: f, checklist_enabled: checklist_enabled, - issue_template: issue_template, project: project } %> - - <%= submit_tag l(:button_save) %> - <% end %> - <%= link_to l(:button_cancel), { action: 'index' }, - onclick: 'Element.hide("edit-issue_template"); return false;' %> -
-
-
-<% end %> - - -
-

- - <%= h issue_template.title %> -

-
- <%= l(:label_applied_for_issue) %> -

- <%= h issue_template.tracker.present? ? issue_template.tracker.name : - l(:orphaned_template, default: 'Orphaned template from tracker') %> -
- <%= non_project_tracker_msg(project_tracker?(issue_template.tracker, project)) %> -

- -

- - <%= h issue_template.issue_title %> -

- -

- <%= l(:issue_description) %> -

- -
<%= textilizable(issue_template.description) %>
- - <% if checklist_enabled %> -

- -

    - <% issue_template.checklist.each do |content| %> -
  • - <%= content %> - -
  • - <% end %> -
-

- <% end %> - -
- -

- <%= issue_template.note.blank? ? l(:label_none) : issue_template.note %> -

- -

- <%= checked_image issue_template.is_default? %> -

- -

- <%= checked_image issue_template.enabled? %> -

- -

- <%= checked_image issue_template.enabled_sharing? %> - <%= l(:label_number_of_projects_use_this_template, count: issue_template.used_projects.count, - default: "%{count} subprojects use this template.") unless issue_template.used_projects.count.zero? || !issue_template.enabled? %> -

- -

- <%= authoring issue_template.created_on, issue_template.author %> - <% if issue_template.created_on != issue_template.updated_on %> - (<%= l(:label_updated_time, time_tag(issue_template.updated_on)).html_safe %>) - <% end %> -

- -
+
+ <%= link_to_if_authorized l(:button_edit), + { controller: 'issue_templates', action: 'update', id: issue_template, + project_id: project }, + class: 'icon icon-edit', accesskey: accesskey(:edit), + onclick: "$('#edit-issue_template').show(); return false;" %> + <%= link_to l(:button_copy), + { controller: 'issue_templates', + action: 'new', project_id: project, copy_from: issue_template.id }, + class: 'icon icon-copy' %> + <%= link_to_if_authorized l(:button_delete), + { controller: 'issue_templates', action: 'destroy', + id: issue_template, project_id: project }, + data: {confirm: l(:template_remove_confirm, + default: "Are you sure to remove this template? %{count} subprojects use this template.")}, + title: l(:enabled_template_cannot_destroy, default: 'Only disabled template can be destroyed.'), + method: 'delete', class: 'icon icon-del template-disabled-link', disabled: issue_template.enabled? %> + <%= link_to(l(:label_list_templates), + { controller: 'issue_templates', + action: 'index', + project_id: project }, class: 'template') %> +
+ +

+ <%= l(:issue_templates) %>: #<%= issue_template.id %> <%= issue_template.title %> + <%= avatar(issue_template.author, size: '24') %> +

+ +<%= render partial: "common/nodata", locals: { trackers: project.trackers } %> +<% if authorize_for('issue_templates', 'update') %> +
+ <%= labelled_form_for :issue_template, issue_template, + url: { controller: 'issue_templates', action: 'update', + project_id: project, id: issue_template }, + html: { id: 'issue_template-form', class: nil, multipart: false } do |f| %> + <%= render 'form', { f: f, checklist_enabled: checklist_enabled, + issue_template: issue_template, project: project } %> + + <%= submit_tag l(:button_save) %> + <% end %> + <%= link_to l(:button_cancel), { action: 'index' }, + onclick: 'Element.hide("edit-issue_template"); return false;' %> +
+
+
+<% end %> + + +
+

+ + <%= h issue_template.title %> +

+
+ <%= l(:label_applied_for_issue) %> +

+ <%= h issue_template.tracker.present? ? issue_template.tracker.name : + l(:orphaned_template, default: 'Orphaned template from tracker') %> +
+ <%= non_project_tracker_msg(project_tracker?(issue_template.tracker, project)) %> +

+ +

+ + <%= h issue_template.issue_title %> +

+ +

+ <%= l(:issue_description) %> +

+ +
<%= textilizable(issue_template.description) %>
+ + <% if checklist_enabled %> +

+ +

    + <% issue_template.checklist.each do |content| %> +
  • + <%= content %> + +
  • + <% end %> +
+

+ <% end %> + +
+ +

+ <%= issue_template.note.blank? ? l(:label_none) : issue_template.note %> +

+ +

+ <%= checked_image issue_template.is_default? %> +

+ +

+ <%= checked_image issue_template.enabled? %> +

+ +

+ <%= checked_image issue_template.enabled_sharing? %> + <%= l(:label_number_of_projects_use_this_template, count: issue_template.used_projects.count, + default: "%{count} subprojects use this template.") unless issue_template.used_projects.count.zero? || !issue_template.enabled? %> +

+ +

+ <%= authoring issue_template.created_on, issue_template.author %> + <% if issue_template.created_on != issue_template.updated_on %> + (<%= l(:label_updated_time, time_tag(issue_template.updated_on)).html_safe %>) + <% end %> +

+ +
diff --git a/app/views/note_templates/index.html.erb b/app/views/note_templates/index.html.erb index 70c8a82a..219a6a99 100644 --- a/app/views/note_templates/index.html.erb +++ b/app/views/note_templates/index.html.erb @@ -84,3 +84,5 @@ $(function() { $("table.table-sortable tbody").positionedItems(); }); <% end %> <% end %> +<%= render partial: "common/template_links" %> + diff --git a/assets/stylesheets/issue_templates.css b/assets/stylesheets/issue_templates.css index ae644760..478395c0 100644 --- a/assets/stylesheets/issue_templates.css +++ b/assets/stylesheets/issue_templates.css @@ -132,6 +132,8 @@ option.global { a.template_tooltip { background-image: url("../images/preview.png"); + background-repeat: no-repeat; + padding-left: 20px; } #issue_template-form textarea { diff --git a/init.rb b/init.rb index 7e0aa1ca..f1552b06 100644 --- a/init.rb +++ b/init.rb @@ -42,7 +42,7 @@ def issue_template_version_message(original_message = nil) name 'Redmine Issue Templates plugin' author 'Akiko Takano' description 'Plugin to generate and use issue templates for each project to assist issue creation.' - version '0.3.3' + version '0.3.4' author_url 'http://twitter.com/akiko_pusu' requires_redmine version_or_higher: '4.0' url 'https://github.com/akiko-pusu/redmine_issue_templates' diff --git a/spec/features/drag_and_drop_spec.rb b/spec/features/drag_and_drop_spec.rb index 6313da1c..352ee4ff 100644 --- a/spec/features/drag_and_drop_spec.rb +++ b/spec/features/drag_and_drop_spec.rb @@ -1,10 +1,11 @@ +# frozen_string_literal: true + require File.expand_path(File.dirname(__FILE__) + '/../rails_helper') require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require File.expand_path(File.dirname(__FILE__) + '/../support/login_helper') -include LoginHelper - feature 'Templates can be reorder via drag and drop', js: true do + include LoginHelper given(:user) { FactoryBot.create(:user, :password_same_login, login: 'manager', language: 'en', admin: false) } given(:project) { create(:project_with_enabled_modules) } given(:tracker) { FactoryBot.create(:tracker, :with_default_status) } @@ -22,24 +23,30 @@ member.save end - scenario 'Can drag and drop', js: true do + scenario 'Can drag and drop' do visit_template_list(user) first_target = table.find('tr:nth-child(1) > td.buttons > span') last_target = table.find('tr:nth-child(4) > td.buttons > span') + action = page.driver.browser.action + # change id: 1, 2, 3, 4 to 4, 1, 2, 3 expect do - first_target.drag_to(last_target) + action.drag_and_drop_by(first_target.native, + *offset_array(first_target, last_target)).perform sleep 0.5 end.to change { IssueTemplate.pluck(:position).to_a }.from([1, 2, 3, 4]).to([4, 1, 2, 3]) + # change id: 4, 1, 2, 3 to 3, 1, 4, 2 second_target = table.find('tr:nth-child(2) > td.buttons > span') last_target = table.find('tr:nth-child(4) > td.buttons > span') + expect do - second_target.drag_to(last_target) + action.drag_and_drop_by(second_target.native, + *offset_array(second_target, last_target)).perform sleep 0.5 end.to change { IssueTemplate.pluck(:position).to_a @@ -54,4 +61,21 @@ def visit_template_list(user) log_user(user.login, user.password) visit "/projects/#{project.identifier}/issue_templates" end + + def offset_array(from, to) + from_location = element_position(from) + to_location = element_position(to) + + [to_location[0] - from_location[0], to_location[1] - from_location[1]] + end + + def element_position(element) + Capybara.evaluate_script <<-RUBY + function() { + var element = document.evaluate('#{element.path}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; + var rect = element.getBoundingClientRect(); + return [rect.left, rect.top]; + }(); + RUBY + end end diff --git a/spec/features/update_issue_spec.rb b/spec/features/update_issue_spec.rb index 9ed7a020..e9b82bc5 100644 --- a/spec/features/update_issue_spec.rb +++ b/spec/features/update_issue_spec.rb @@ -84,6 +84,6 @@ def visit_update_issue(user) user.update_attribute(:admin, false) - log_user(user.login, user.password) + log_user(user.login, user.login) end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6e046706..fc14834a 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -12,7 +12,7 @@ config.fixture_path = "#{::Rails.root}/test/fixtures" config.include FactoryBot::Syntax::Methods - config.before :suite, type: :feature do + config.before :suite do require 'selenium-webdriver' if ENV['DRIVER'] == 'headless' Capybara.register_driver :headless_chrome do |app| @@ -46,6 +46,7 @@ config.before :each, type: :feature do Capybara.javascript_driver = :headless_chrome Capybara.current_driver = :headless_chrome + Capybara.default_max_wait_time = 30 end config.include Capybara::DSL diff --git a/spec/support/login_helper.rb b/spec/support/login_helper.rb index d1d960d9..13713a9e 100644 --- a/spec/support/login_helper.rb +++ b/spec/support/login_helper.rb @@ -3,7 +3,7 @@ module LoginHelper def log_user(login, password) visit '/login' - assert_equal '/login', current_path + within('#login-form form') do fill_in 'username', with: login fill_in 'password', with: password