Commit c57dd557 authored by Eulyeon Ko's avatar Eulyeon Ko

Fix new_issue_spec.rb for graphql boards

- use wait_for_requests to wait for graphql reqs

- fix a css selector

- match created issue's path

- add TODO links for unimplemented features
(in classics boards but not yet in graphql boards)

- use `let_it_be`

- explicitly create backlog_list
parent 04e80338
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Issue Boards new issue', :js do RSpec.describe 'Issue Boards new issue', :js do
let(:project) { create(:project, :public) } let_it_be(:user) { create(:user) }
let(:board) { create(:board, project: project) } let_it_be(:project) { create(:project, :public) }
let!(:list) { create(:list, board: board, position: 0) } let_it_be(:board) { create(:board, project: project) }
let(:user) { create(:user) } let_it_be(:backlog_list) { create(:backlog_list, board: board) }
context 'authorized user' do context 'authorized user' do
before do before do
...@@ -17,7 +17,7 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -17,7 +17,7 @@ RSpec.describe 'Issue Boards new issue', :js do
visit project_board_path(project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 2)
end end
it 'successfully assigns weight to newly-created issue' do it 'successfully assigns weight to newly-created issue' do
...@@ -32,8 +32,12 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -32,8 +32,12 @@ RSpec.describe 'Issue Boards new issue', :js do
wait_for_requests wait_for_requests
page.within(first('.board')) do
find('.board-card').click
end
page.within(first('.issue-boards-sidebar')) do page.within(first('.issue-boards-sidebar')) do
find('.weight .js-weight-edit-link').click find('.weight [data-testid="edit-button"]').click
find('.weight .form-control').set("10\n") find('.weight .form-control').set("10\n")
end end
......
...@@ -3,10 +3,12 @@ ...@@ -3,10 +3,12 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Issue Boards new issue', :js do RSpec.describe 'Issue Boards new issue', :js do
let(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
let(:board) { create(:board, project: project) } let_it_be(:board) { create(:board, project: project) }
let!(:list) { create(:list, board: board, position: 0) } let_it_be(:backlog_list) { create(:backlog_list, board: board) }
let(:user) { create(:user) } let_it_be(:label) { create(:label, project: project, name: 'Label 1') }
let_it_be(:list) { create(:list, board: board, label: label, position: 0) }
let_it_be(:user) { create(:user) }
context 'authorized user' do context 'authorized user' do
before do before do
...@@ -15,6 +17,7 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -15,6 +17,7 @@ RSpec.describe 'Issue Boards new issue', :js do
sign_in(user) sign_in(user)
visit project_board_path(project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 3)
...@@ -70,11 +73,12 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -70,11 +73,12 @@ RSpec.describe 'Issue Boards new issue', :js do
issue = project.issues.find_by_title('bug') issue = project.issues.find_by_title('bug')
expect(page).to have_content(issue.to_reference) expect(page).to have_content(issue.to_reference)
expect(page).to have_link(issue.title, href: issue_path(issue)) expect(page).to have_link(issue.title, href: /#{issue_path(issue)}/)
end end
end end
it 'shows sidebar when creating new issue' do # TODO https://gitlab.com/gitlab-org/gitlab/-/issues/323446
xit 'shows sidebar when creating new issue' do
page.within(first('.board')) do page.within(first('.board')) do
find('.issue-count-badge-add-button').click find('.issue-count-badge-add-button').click
end end
...@@ -101,12 +105,16 @@ RSpec.describe 'Issue Boards new issue', :js do ...@@ -101,12 +105,16 @@ RSpec.describe 'Issue Boards new issue', :js do
wait_for_requests wait_for_requests
page.within(first('.board')) do
find('.board-card').click
end
page.within(first('.issue-boards-sidebar')) do page.within(first('.issue-boards-sidebar')) do
find('.labels .edit-link').click find('.labels [data-testid="edit-button"]').click
wait_for_requests wait_for_requests
expect(page).to have_selector('.labels .dropdown-content li a') expect(page).to have_selector('.labels-select-contents-list .dropdown-content li a')
end end
end end
end end
......
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