Skip to content

Commit

Permalink
Adding system test with CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sanak committed May 14, 2024
1 parent 76108d4 commit e5513d2
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 5 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/test-postgis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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:
Expand Down
66 changes: 66 additions & 0 deletions test/system/issues_map_test.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e5513d2

Please sign in to comment.