parent
992476aff4
commit
32c692f5e2
@ -1,83 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject is an open source project management software. |
||||
# Copyright (C) 2012-2020 the OpenProject GmbH |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
|
||||
Feature: export card configurations Admin |
||||
As an Admin |
||||
I want to administer the export card configurations |
||||
So that CRUD operations can be performed on them |
||||
|
||||
@javascript |
||||
Scenario: View Configurations |
||||
Given there are multiple export card configurations |
||||
And I am admin |
||||
And I am on the export card configurations index page |
||||
Then I should see "Default" |
||||
And I should see "Custom" |
||||
And I should see "Custom 2" |
||||
|
||||
@javascript |
||||
Scenario: Create New Configuration |
||||
Given there are multiple export card configurations |
||||
And I am admin |
||||
And I am on the export card configurations index page |
||||
When I follow "New Export Card Config" |
||||
And I fill in "Config 1" for "export_card_configuration_name" |
||||
And I fill in "5" for "export_card_configuration_per_page" |
||||
And I select "landscape" from "export_card_configuration_orientation" |
||||
And I fill in valid YAML for export config rows |
||||
And I submit the form by the "Create" button |
||||
Then I should see "Successful creation." within ".flash.notice" |
||||
|
||||
@javascript |
||||
Scenario: Edit Existing Configuration |
||||
Given there are multiple export card configurations |
||||
And I am admin |
||||
And I am on the export card configurations index page |
||||
When I follow first "Custom 2" |
||||
And I fill in "5" for "export_card_configuration_per_page" |
||||
And I select "portrait" from "export_card_configuration_orientation" |
||||
And I fill in valid YAML for export config rows |
||||
And I submit the form by the "Save" button |
||||
Then I should see "Successful update." within ".flash.notice" |
||||
|
||||
@javascript |
||||
Scenario: Activate Existing Configuration |
||||
Given there are multiple export card configurations |
||||
And I am admin |
||||
And I am on the export card configurations index page |
||||
When I follow first "Activate" |
||||
Then I should see "Config succesfully activated" within ".flash.notice" |
||||
|
||||
@javascript |
||||
Scenario: Deactivate Existing Configuration |
||||
Given there are multiple export card configurations |
||||
And I am admin |
||||
And I am on the export card configurations index page |
||||
When I follow first "De-activate" |
||||
Then I should see "Config succesfully de-activated" within ".flash.notice" |
@ -1,85 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject is an open source project management software. |
||||
# Copyright (C) 2012-2020 the OpenProject GmbH |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
Given /^there are multiple export card configurations$/ do |
||||
config1 = ExportCardConfiguration.create!({ |
||||
name: "Default", |
||||
description: "This is a description", |
||||
active: true, |
||||
per_page: 1, |
||||
page_size: "A4", |
||||
orientation: "landscape", |
||||
rows: "group1:\n has_border: false\n rows:\n row1:\n height: 50\n priority: 1\n columns:\n id:\n has_label: false" |
||||
}) |
||||
config2 = ExportCardConfiguration.create!({ |
||||
name: "Custom", |
||||
description: "This is a description", |
||||
active: true, |
||||
per_page: 1, |
||||
page_size: "A4", |
||||
orientation: "landscape", |
||||
rows: "group1:\n has_border: false\n rows:\n row1:\n height: 50\n priority: 1\n columns:\n id:\n has_label: false" |
||||
}) |
||||
config3 = ExportCardConfiguration.create!({ |
||||
name: "Custom 2", |
||||
description: "This is a description", |
||||
active: true, |
||||
per_page: 1, |
||||
page_size: "A4", |
||||
orientation: "landscape", |
||||
rows: "group1:\n has_border: false\n rows:\n row1:\n height: 50\n priority: 1\n columns:\n id:\n has_label: false" |
||||
}) |
||||
config4 = ExportCardConfiguration.create!({ |
||||
name: "Custom Inactive", |
||||
description: "This is a description", |
||||
active: false, |
||||
per_page: 1, |
||||
page_size: "A4", |
||||
orientation: "landscape", |
||||
rows: "group1:\n has_border: false\n rows:\n row1:\n height: 50\n priority: 1\n columns:\n id:\n has_label: false" |
||||
}) |
||||
[config1, config2, config3, config4] |
||||
end |
||||
|
||||
Given /^there is the default export card configuration$/ do |
||||
config1 = ExportCardConfiguration.create!({ |
||||
name: "Default", |
||||
description: "This is a description", |
||||
active: true, |
||||
per_page: 1, |
||||
page_size: "A4", |
||||
orientation: "landscape", |
||||
rows: "group1:\n has_border: false\n rows:\n row1:\n height: 50\n priority: 1\n columns:\n id:\n has_label: false" |
||||
}) |
||||
[config1] |
||||
end |
||||
|
||||
Given /^I fill in valid YAML for export config rows$/ do |
||||
valid_yaml = "groups:\n rows:\n row1:\n columns:\n id:\n has_label: false" |
||||
fill_in("export_card_configuration_rows", :with => valid_yaml) |
||||
end |
@ -1,27 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject is an open source project management software. |
||||
# Copyright (C) 2012-2020 the OpenProject GmbH |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
@ -1,31 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject is an open source project management software. |
||||
# Copyright (C) 2012-2020 the OpenProject GmbH |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
When /^(?:|I )follow first "([^"]*)"$/ do |link| |
||||
first(:link, link).click |
||||
end |
@ -1,48 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject is an open source project management software. |
||||
# Copyright (C) 2012-2020 the OpenProject GmbH |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
|
||||
module PdfExportNavigationHelpers |
||||
# Maps a name to a path. Used by the |
||||
# |
||||
# When /^I go to (.+)$/ do |page_name| |
||||
# |
||||
# step definition in web_steps.rb |
||||
# |
||||
def path_to(page_name) |
||||
case page_name |
||||
when /^the export card configurations index page$/ |
||||
"/export_card_configurations" |
||||
|
||||
else |
||||
super |
||||
end |
||||
end |
||||
end |
||||
|
||||
World(PdfExportNavigationHelpers) |
@ -0,0 +1,78 @@ |
||||
#-- copyright |
||||
# OpenProject is an open source project management software. |
||||
# Copyright (C) 2012-2020 the OpenProject GmbH |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
require 'spec_helper' |
||||
|
||||
describe "export card configurations Admin", type: :feature, js: true do |
||||
let(:user) { FactoryBot.create :admin } |
||||
|
||||
let!(:config1) { FactoryBot.create :export_card_configuration } |
||||
let!(:config_default) { FactoryBot.create :default_export_card_configuration } |
||||
let!(:config_active) { FactoryBot.create :active_export_card_configuration } |
||||
|
||||
before do |
||||
login_as user |
||||
visit pdf_export_export_card_configurations_path |
||||
end |
||||
|
||||
it 'can manage export card configurations' do |
||||
# INDEX |
||||
expect(page).to have_text 'Config 1' |
||||
expect(page).to have_text 'Default ' |
||||
expect(page).to have_text 'Config active' |
||||
|
||||
# CREATE |
||||
click_on 'New Export Card Config' |
||||
fill_in 'export_card_configuration_name', with: 'New config' |
||||
fill_in 'export_card_configuration_per_page', with: '5' |
||||
select 'landscape', from: 'export_card_configuration_orientation' |
||||
valid_yaml = "groups:\n rows:\n row1:\n columns:\n id:\n has_label: false" |
||||
fill_in 'export_card_configuration_rows', with: valid_yaml |
||||
click_on 'Create' |
||||
expect(page).to have_text 'Successful creation.' |
||||
|
||||
# EDIT |
||||
page.first('a', text: 'Config 1').click |
||||
fill_in 'export_card_configuration_name', with: 'New name' |
||||
fill_in 'export_card_configuration_per_page', with: '5' |
||||
select 'portrait', from: 'export_card_configuration_orientation' |
||||
fill_in 'export_card_configuration_rows', with: valid_yaml |
||||
click_on 'Save' |
||||
expect(page).to have_text 'Successful update.' |
||||
|
||||
expect(config1.reload.name).to eq 'New name' |
||||
expect(config1.reload).to be_portrait |
||||
|
||||
# DEACTIVATE |
||||
page.first('a', text: 'De-activate').click |
||||
expect(page).to have_text 'Config succesfully de-activated' |
||||
|
||||
# ACTIVATE |
||||
page.first('a', text: 'Activate').click |
||||
expect(page).to have_text 'Config succesfully activated' |
||||
end |
||||
end |
Loading…
Reference in new issue