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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 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-2013 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 COPYRIGHT and LICENSE files for more details.
#++
require "support/pages/page"
module Pages
module Projects
class Show < ::Pages::Page
attr_reader :project
def initialize(project)
@project = project
end
def path
project_path(project)
end
def within_sidebar(&)
within("#menu-sidebar", &)
end
def visit_page
visit path
end
def expect_no_visible_sidebar
expect_angular_frontend_initialized
expect(page).to have_no_css(".Layout-sidebar")
end
def expect_visible_sidebar
expect_angular_frontend_initialized
expect(page).to have_css(".Layout-sidebar")
end
def within_project_attributes_sidebar(&)
within_test_selector("project-custom-fields-sidebar", &)
end
def within_custom_field_section_container(section, &)
within_test_selector("project-custom-field-section-#{section.id}", &)
end
def within_custom_field_container(custom_field, &)
within_test_selector("project-custom-field-#{custom_field.id}", &)
end
def expect_no_custom_field(custom_field)
expect(page).to have_no_css("[data-test-selector='project-custom-field-#{custom_field.id}']")
end
def open_edit_dialog_for_section(section)
within_project_attributes_sidebar do
scroll_to_element(page.find("[data-test-selector='project-custom-field-section-#{section.id}']"))
within_custom_field_section_container(section) do
page.find("[data-test-selector='project-custom-field-section-edit-button']").click
end
end
wait_for_size_animation_completion("[data-test-selector='async-dialog-content']")
end
def open_edit_dialog_for_life_cycle(life_cycle, wait_angular: false)
within_life_cycle_sidebar do
page.find("[data-test-selector='project-life-cycle-edit-button-#{life_cycle.id}']").click
end
Components::Projects::ProjectLifeCycle::EditDialog.new.tap do |dialog|
dialog.expect_open
expect_angular_frontend_initialized if wait_angular
end
end
def within_life_cycle_sidebar(&)
within_test_selector("project-life-cycle-sidebar-async-content", &)
end
def within_life_cycle_container(life_cycle, &)
within("[data-test-selector='project-life-cycle-#{life_cycle.id}']", &)
end
def expand_text(custom_field)
within_custom_field_container(custom_field) do
page.find('[data-test-selector="expand-button"]').click
end
end
def expect_text_not_truncated(custom_field)
within_custom_field_container(custom_field) do
expect(page).to have_no_css('[data-test-selector="expand-button"]')
end
end
def expect_text_truncated(custom_field)
within_custom_field_container(custom_field) do
expect(page).to have_css('[data-test-selector="expand-button"]')
end
end
def expect_full_text_in_dialog(text)
within('[data-test-selector="attribute-dialog"]') do
expect(page)
.to have_content(text)
end
end
end
end
end