diff --git a/.github/workflows/test-postgis.yml b/.github/workflows/test-postgis.yml index 893d136c..33eded0d 100644 --- a/.github/workflows/test-postgis.yml +++ b/.github/workflows/test-postgis.yml @@ -27,6 +27,10 @@ jobs: redmine_version: ${{ fromJSON(vars.PLUGIN_TEST_MATRIX_REDMINE_VERSION) }} ruby_version: ${{ fromJSON(vars.PLUGIN_TEST_MATRIX_RUBY_VERSION) }} db_version: [12-3.0, 15-3.3] + include: + - system_test: true + redmine_version: 5.2-stable + ruby_version: '3.2' exclude: - redmine_version: 5.0-stable ruby_version: '3.2' @@ -59,10 +63,17 @@ jobs: run: apt-get update --yes --quiet - name: Install package dependencies - run: > - apt-get install --yes --quiet - postgresql-client - gcc libpq-dev make patch libgeos-dev curl + run: | + apt-get install --yes --quiet \ + postgresql-client \ + gcc libpq-dev make patch libgeos-dev curl + # For system test + if [ ${{ matrix.system_test }} = "true" ]; then + wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - + sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' + apt-get -y update + apt-get install -y google-chrome-stable + fi - name: Install Node/Yarn packages run: | @@ -127,7 +138,13 @@ jobs: env: RAILS_ENV: test working-directory: redmine - run: bundle exec rake redmine:plugins:test NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + run: | + bundle exec rake redmine:plugins:test:units NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + bundle exec rake redmine:plugins:test:functionals NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + bundle exec rake redmine:plugins:test:integration NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + if [ ${{ matrix.system_test }} = "true" ]; then + bundle exec rake redmine:plugins:test:system NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + fi - name: Run uninstall test env: diff --git a/test/system/issues_map_test.rb b/test/system/issues_map_test.rb new file mode 100644 index 00000000..6b2b9ced --- /dev/null +++ b/test/system/issues_map_test.rb @@ -0,0 +1,66 @@ +require_relative '../../../../test/application_system_test_case' +require_relative '../test_helper' + +class IssuesMapTest < ApplicationSystemTestCase + fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, + :trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues, + :enumerations, :custom_fields, :custom_values, :custom_fields_trackers, + :watchers, :journals, :journal_details + + setup do + User.current = nil + @maplayer = RedmineGtt::Actions::CreateMapLayer.( + name: 'OSM Tiles', + layer: 'Tile', + source: 'OSM', + source_options_string: '{"url":"https://tile.openstreetmap.jp/{z}/{x}/{y}.png"}' + ).map_layer + @project = Project.find 'ecookbook' + @project.enabled_modules.create name: 'gtt' + @project.gtt_map_layers << @maplayer + end + + teardown do + + end + + test 'should not show issues map in gtt disabled project' do + log_user('jsmith', 'jsmith') + visit '/issues/4' + + assert_no_selector('div.ol-map') + end + + test 'should show alert box on issues map in no baselayer project' do + @project.gtt_map_layers.clear + log_user('jsmith', 'jsmith') + visit '/issues/1' + + assert_selector('div.ol-map') do + assert_no_selector('canvas') + page.has_content?('There is no baselayer available!') + end + end + + test 'should show issues new map from global scope only when selected project enables gtt module' do + log_user('jsmith', 'jsmith') + visit '/issues/new' + + # Default gtt enabled project + assert_selector('div.ol-map') do + assert_selector('canvas') + end + + # Select gtt disabled project + page.find('#issue_project_id').select('OnlineStore') + assert_no_selector('div.ol-map') + + # Select gtt enabled project again + page.find('#issue_project_id').select('eCookbook') + ## FIXME: Should replace to commented out assertions below + assert_selector('div.ol-map') + # assert_selector('div.ol-map') do + # assert_selector('canvas') + # end + end +end