Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Replace export card config cukes

Oliver Günther32c692f5e269
diff --git a/modules/pdf_export/features/export_card_configurations_admin.feature b/modules/pdf_export/features/export_card_configurations_admin.feature
deleted file mode 100644
index 4e7f1284278..00000000000
--- a/modules/pdf_export/features/export_card_configurations_admin.feature
+++ /dev/null
@@ -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"
\ No newline at end of file
diff --git a/modules/pdf_export/features/step_definitions/given.rb b/modules/pdf_export/features/step_definitions/given.rb
deleted file mode 100644
index 54e4fc52218..00000000000
--- a/modules/pdf_export/features/step_definitions/given.rb
+++ /dev/null
@@ -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
diff --git a/modules/pdf_export/features/step_definitions/then.rb b/modules/pdf_export/features/step_definitions/then.rb
deleted file mode 100644
index 8630297d4ad..00000000000
--- a/modules/pdf_export/features/step_definitions/then.rb
+++ /dev/null
@@ -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.
-#++
diff --git a/modules/pdf_export/features/step_definitions/when.rb b/modules/pdf_export/features/step_definitions/when.rb
deleted file mode 100644
index ddf8f7a1442..00000000000
--- a/modules/pdf_export/features/step_definitions/when.rb
+++ /dev/null
@@ -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
diff --git a/modules/pdf_export/features/support/paths.rb b/modules/pdf_export/features/support/paths.rb
deleted file mode 100644
index 57001a035f6..00000000000
--- a/modules/pdf_export/features/support/paths.rb
+++ /dev/null
@@ -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)
diff --git a/modules/pdf_export/spec/features/export_card_configurations_admin_spec.rb b/modules/pdf_export/spec/features/export_card_configurations_admin_spec.rb
new file mode 100644
index 00000000000..48632367811
--- /dev/null
+++ b/modules/pdf_export/spec/features/export_card_configurations_admin_spec.rb
@@ -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
\ No newline at end of file