Commit da99174e authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'qa/issue-boards-e2e-tests' into 'master'

Automated tests for issue boards

Closes gitlab-org/quality/testcases#83

See merge request gitlab-org/gitlab-ee!15237
parents 0311c188 b682e6c3
......@@ -83,6 +83,7 @@ export default {
}"
:index="index"
:data-issue-id="issue.id"
data-qa-selector="board_card"
class="board-card p-3 rounded"
@mousedown="mouseDown"
@mousemove="mouseMove"
......
......@@ -227,6 +227,7 @@ export default {
<div
:class="{ 'd-none': !list.isExpanded, 'd-flex flex-column': list.isExpanded }"
class="board-list-component position-relative h-100"
data-qa-selector="board_list_cards_area"
>
<div v-if="loading" class="board-list-loading text-center" :aria-label="__('Loading issues')">
<gl-loading-icon />
......
......@@ -226,6 +226,7 @@ export default {
<div class="boards-switcher js-boards-selector append-right-10">
<span class="boards-selector-wrapper js-boards-selector-wrapper">
<gl-dropdown
data-qa-selector="boards_dropdown"
toggle-class="dropdown-menu-toggle js-dropdown-toggle"
menu-class="flex-column dropdown-extended-height"
:text="board.name"
......
......@@ -16,7 +16,7 @@
#board-app.boards-app.position-relative{ "v-cloak" => "true", data: board_data, ":class" => "{ 'is-compact': detailIssueVisible }" }
= render 'shared/issuable/search_bar', type: :boards, board: board
.boards-list.w-100.py-3.px-2.text-nowrap
.boards-list.w-100.py-3.px-2.text-nowrap{ data: { qa_selector: "boards_list" } }
.boards-app-loading.w-100.text-center{ "v-if" => "loading" }
= icon("spinner spin 2x")
%board{ "v-cloak" => "true",
......
.board.d-inline-block.h-100.px-2.align-top.ws-normal{ ":class" => '{ "is-draggable": !list.preset, "is-expandable": list.isExpandable, "is-collapsed": !list.isExpanded, "board-type-assignee": list.type === "assignee" }',
":data-id" => "list.id" }
":data-id" => "list.id", data: { qa_selector: "board_list" } }
.board-inner.d-flex.flex-column.position-relative.h-100.rounded
%header.board-header{ ":class" => '{ "has-border": list.label && list.label.color, "position-relative": list.isExpanded, "position-absolute position-top-0 position-left-0 w-100 h-100": !list.isExpanded }', ":style" => "{ borderTopColor: (list.label && list.label.color ? list.label.color : null) }" }
%header.board-header{ ":class" => '{ "has-border": list.label && list.label.color, "position-relative": list.isExpanded, "position-absolute position-top-0 position-left-0 w-100 h-100": !list.isExpanded }', ":style" => "{ borderTopColor: (list.label && list.label.color ? list.label.color : null) }", data: { qa_selector: "board_list_header" } }
%h3.board-title.m-0.d-flex.js-board-handle{ ":class" => '{ "user-can-drag": (!disabled && !list.preset), "border-bottom-0": !list.isExpanded }' }
.board-title-caret.no-drag{ "v-if": "list.isExpandable",
......
......@@ -72,6 +72,10 @@ module QA
module Issue
autoload :Index, 'qa/ee/page/project/issue/index'
autoload :Show, 'qa/ee/page/project/issue/show'
module Board
autoload :Show, 'qa/ee/page/project/issue/board/show'
end
end
module Settings
......@@ -118,8 +122,12 @@ module QA
end
module Resource
autoload :Board, 'qa/ee/resource/board'
autoload :LabelBoardList, 'qa/ee/resource/label_board_list'
autoload :MilestoneBoardList, 'qa/ee/resource/milestone_board_list'
autoload :License, 'qa/ee/resource/license'
autoload :Epic, 'qa/ee/resource/epic'
autoload :ProjectMilestone, 'qa/ee/resource/project_milestone'
module Geo
autoload :Node, 'qa/ee/resource/geo/node'
......
# frozen_string_literal: true
module QA
module EE
module Page
module Project
module Issue
module Board
class Show < QA::Page::Base
view 'app/assets/javascripts/boards/components/board_card.vue' do
element :board_card
end
view 'app/assets/javascripts/boards/components/board_list.vue' do
element :board_list_cards_area
end
view 'app/assets/javascripts/boards/components/boards_selector.vue' do
element :boards_dropdown
end
view 'app/views/shared/boards/_show.html.haml' do
element :boards_list
end
view 'app/views/shared/boards/components/_board.html.haml' do
element :board_list
element :board_list_header
end
def boards_dropdown
find_element(:boards_dropdown)
end
def boards_list_cards_area_with_index(index)
wait_boards_list_finish_loading do
within_element_by_index(:board_list, index) do
find_element(:board_list_cards_area)
end
end
end
def boards_list_header_with_index(index)
wait_boards_list_finish_loading do
within_element_by_index(:board_list, index) do
find_element(:board_list_header)
end
end
end
def card_of_list_with_index(index)
wait_boards_list_finish_loading do
within_element_by_index(:board_list, index) do
find_element(:board_card)
end
end
end
private
def wait_boards_list_finish_loading
within_element(:boards_list) do
wait(reload: false, max: 5, interval: 1) do
finished_loading?
yield
end
end
end
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Resource
class Board < QA::Resource::Base
attribute :id
attribute :name
attribute :project do
QA::Resource::Project.fabricate_via_api! do |resource|
resource.name = 'project-with-board'
end
end
def resource_web_url(resource)
super
rescue ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def api_get_path
"/projects/#{project.id}/boards/#{id}"
end
def api_post_path
"/projects/#{project.id}/boards"
end
def api_post_body
{
name: name
}
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Resource
class LabelBoardList < QA::Resource::Base
attribute :id
attribute :project do
QA::Resource::Project.fabricate_via_api! do |resource|
resource.name = 'project-with-label-board-list'
end
end
attribute :board do
QA::EE::Resource::Board.fabricate_via_api! do |b|
b.project = project
b.name = 'Downstream'
end
end
attribute :label do
QA::Resource::Label.fabricate_via_api! do |l|
l.project = board.project
l.title = 'Doing'
end
end
def resource_web_url(resource)
super
rescue ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def api_get_path
"/projects/#{board.project.id}/boards/#{board.id}/lists/#{id}"
end
def api_post_path
"/projects/#{board.project.id}/boards/#{board.id}/lists"
end
def api_post_body
{
board_id: board.id,
label_id: label.id
}
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Resource
class MilestoneBoardList < QA::Resource::Base
attribute :id
attribute :project do
QA::Resource::Project.fabricate_via_api! do |resource|
resource.name = 'project-with-milestone-board-list'
end
end
attribute :board do
QA::EE::Resource::Board.fabricate_via_api! do |b|
b.project = project
b.name = 'Product development'
end
end
attribute :project_milestone do
QA::EE::Resource::ProjectMilestone.fabricate_via_api! do |m|
m.project = board.project
m.title = '1.0'
end
end
def resource_web_url(resource)
super
rescue ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def api_get_path
"/projects/#{board.project.id}/boards/#{board.id}/lists/#{id}"
end
def api_post_path
"/projects/#{board.project.id}/boards/#{board.id}/lists"
end
def api_post_body
{
board_id: board.id,
milestone_id: project_milestone.id
}
end
end
end
end
end
# frozen_string_literal: true
module QA
module EE
module Resource
class ProjectMilestone < QA::Resource::Base
attribute :id
attribute :title
attribute :project do
QA::Resource::Project.fabricate_via_api! do |resource|
resource.name = 'project-with-milestone'
end
end
def resource_web_url(resource)
super
rescue ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def api_get_path
"/projects/#{project.id}/milestones/#{id}"
end
def api_post_path
"/projects/#{project.id}/milestones"
end
def api_post_body
{
title: title
}
end
end
end
end
end
......@@ -3,7 +3,7 @@
module QA
module Resource
class Issue < Base
attr_writer :description
attr_writer :description, :milestone
attribute :project do
Project.fabricate! do |resource|
......@@ -44,7 +44,9 @@ module QA
{
labels: labels,
title: title
}
}.tap do |hash|
hash[:milestone_id] = @milestone.id if @milestone
end
end
end
end
......
......@@ -7,6 +7,7 @@ module QA
class Label < Base
attr_accessor :description, :color
attribute :id
attribute :title
attribute :project do
......
# frozen_string_literal: true
module QA
context 'Plan' do
describe 'Issue boards' do
let(:issue_title) { 'Issue to test board list' }
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
end
context 'Label issue board' do
let(:label) { 'Doing' }
let(:label_board_list) do
EE::Resource::LabelBoardList.fabricate_via_api!
end
before do
Resource::Issue.fabricate_via_api! do |issue|
issue.project = label_board_list.project
issue.title = issue_title
issue.labels = [label]
end
end
it 'shows the just created board with a "Doing" (label) list, and an issue on it' do
page.visit("#{label_board_list.project.web_url}/-/boards")
EE::Page::Project::Issue::Board::Show.perform do |show|
expect(show.boards_dropdown).to have_content(label_board_list.board.name)
expect(show.boards_list_header_with_index(1)).to have_content(label)
expect(show.boards_list_cards_area_with_index(1)).to have_content(label)
expect(show.card_of_list_with_index(1)).to have_content(issue_title)
end
end
end
context 'Milestone issue board' do
let(:milestone_board_list) do
EE::Resource::MilestoneBoardList.fabricate_via_api!
end
before do
Resource::Issue.fabricate_via_api! do |issue|
issue.project = milestone_board_list.project
issue.title = issue_title
issue.milestone = milestone_board_list.project_milestone
end
end
it 'shows the just created board with a "1.0" (milestone) list, and an issue on it' do
page.visit("#{milestone_board_list.project.web_url}/-/boards")
EE::Page::Project::Issue::Board::Show.perform do |show|
expect(show.boards_dropdown).to have_content(milestone_board_list.board.name)
expect(show.boards_list_header_with_index(1)).to have_content('1.0')
expect(show.card_of_list_with_index(1)).to have_content(issue_title)
end
end
end
end
end
end
# frozen_string_literal: true
module QA
context 'Plan' do
describe 'Editing scoped labels on issues' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment