Add shared example for query management in a module

pull/9957/head
Henriette Darge 3 years ago
parent 61ef494bb2
commit 427c597d87
  1. 2
      frontend/src/app/shared/components/calendar/op-calendar.service.ts
  2. 2
      frontend/src/app/shared/components/op-view-select/op-view-select.component.ts
  3. 13
      modules/team_planner/spec/features/query_handling_spec.rb
  4. 56
      spec/features/views/shared_examples.rb

@ -293,7 +293,7 @@ export class OpCalendarService extends UntilDestroyedMixin {
private get initializingWithQueryProps():boolean {
return (this.areFiltersEmpty && this.urlParams.query_props) as boolean;
}
}
private get urlParams() {
return this.$state.params;

@ -212,7 +212,7 @@ export class ViewSelectComponent extends UntilDestroyedMixin implements OnInit {
}
private toOpSideMenuItem(view:View):IOpSidemenuItem {
const {query} = view._links;
const { query } = view._links;
return {
title: query.title,
uiSref: this.baseRoute,

@ -30,6 +30,7 @@
require 'spec_helper'
require_relative '../support/pages/team_planner'
require_relative '../../../../spec/features/views/shared_examples'
describe 'Team planner query handling', type: :feature, js: true do
shared_let(:type_task) { FactoryBot.create(:type_task) }
@ -80,16 +81,18 @@ describe 'Team planner query handling', type: :feature, js: true do
current_user { user }
it 'allows saving the team planner' do
before do
login_as user
team_planner.visit!
team_planner.expect_assignee user
team_planner.within_lane(user) do
team_planner.expect_event bug
team_planner.expect_event task
end
end
it 'allows saving the team planner' do
filters.expect_filter_count("1")
filters.open
@ -111,7 +114,6 @@ describe 'Team planner query handling', type: :feature, js: true do
it 'shows only team planner queries' do
# Go to team planner where no query is shown
team_planner.visit!
query_menu.expect_no_menu_entry
# Change filter
@ -131,4 +133,9 @@ describe 'Team planner query handling', type: :feature, js: true do
work_package_page.visit!
query_menu.expect_menu_entry_not_visible 'I am your Query'
end
it_behaves_like 'module specific query view management' do
let(:module_page) { team_planner }
let(:default_name) { 'Unnamed team planner' }
end
end

@ -0,0 +1,56 @@
shared_examples 'module specific query view management' do
describe 'within a module' do
let(:query_title) { ::Components::WorkPackages::QueryTitle.new }
let(:query_menu) { ::Components::WorkPackages::QueryMenu.new }
let(:settings_menu) { Components::WorkPackages::SettingsMenu.new }
let(:filters) { module_page.filters }
it 'allows to save, rename and delete a query' do
# Change the query
filters.open
filters.add_filter_by 'Subject', 'contains', ['Test']
# Save it
query_title.expect_changed
settings_menu.open_and_save_query 'My first query'
query_title.expect_not_changed
query_title.expect_title 'My first query'
query_menu.expect_menu_entry 'My first query'
# Change the filter again
filters.add_filter_by 'Progress (%)', 'is', ['25'], 'percentageDone'
# Save as another query
query_title.expect_changed
settings_menu.open_and_choose 'Save as ...'
fill_in 'save-query-name', with: 'My second query'
click_button 'Save'
query_title.expect_not_changed
query_title.expect_title 'My second query'
query_menu.expect_menu_entry 'My second query'
query_menu.expect_menu_entry 'My first query'
# Rename a query
settings_menu.open_and_choose 'Rename view ...'
expect(page).to have_focus_on('.editable-toolbar-title--input')
page.driver.browser.switch_to.active_element.send_keys('My second query (renamed)')
page.driver.browser.switch_to.active_element.send_keys(:return)
module_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')
query_title.expect_not_changed
query_title.expect_title 'My second query (renamed)'
query_menu.expect_menu_entry 'My second query (renamed)'
query_menu.expect_menu_entry 'My first query'
# Delete a query
settings_menu.open_and_choose 'Delete'
module_page.accept_alert_dialog!
module_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_delete')
query_title.expect_title default_name
query_menu.expect_menu_entry_not_visible 'My query planner (renamed)'
query_menu.expect_menu_entry 'My first query'
end
end
end
Loading…
Cancel
Save