Commit 1ab01e04 authored by Eulyeon Ko's avatar Eulyeon Ko

Fix the spec

parent f1321c8a
= link_to safe_params.merge(rss_url_options), class: 'btn btn-svg has-tooltip', data: { container: 'body' }, title: _('Subscribe to RSS feed') do
= link_to safe_params.merge(rss_url_options), class: 'btn btn-svg has-tooltip', data: { container: 'body', testid: 'rss-feed-link' }, title: _('Subscribe to RSS feed') do
= sprite_icon('rss', css_class: 'qa-rss-icon', size: 16)
= link_to safe_params.merge(calendar_url_options), class: 'btn has-tooltip', data: { container: 'body' }, title: _('Subscribe to calendar') do
= sprite_icon('calendar')
......@@ -11,11 +11,7 @@ RSpec.describe 'Group issues page' do
let(:project_with_issues_disabled) { create(:project, :issues_disabled, group: group) }
let(:path) { issues_group_path(group) }
before do
stub_feature_flags(vue_issuables_list: false)
end
context 'with shared examples' do
context 'with shared examples', :js do
let(:issuable) { create(:issue, project: project, title: "this is my created issuable")}
include_examples 'project features apply to issuables', Issue
......@@ -30,19 +26,33 @@ RSpec.describe 'Group issues page' do
user_in_group
end
it_behaves_like "it has an RSS button with current_user's feed token"
it_behaves_like "an autodiscoverable RSS feed with current_user's feed token"
# Note: The one from rss_shared_example.rb uses a css pseudo-class `:has`
# which is VERY experimental and only supported in Nokogiri used by Capybara
# However,`:js` option forces Capybara to use Selenium that doesn't support`:has`
context "it has an RSS button with current_user's feed token" do
it "shows the RSS button with current_user's feed token" do
expect(find('[data-testid="rss-feed-link"]')['href']).to have_content(user.feed_token)
end
end
end
context 'when signed out' do
let(:user) { nil }
it_behaves_like "it has an RSS button without a feed token"
it_behaves_like "an autodiscoverable RSS feed without a feed token"
# Note: please see the above
context "it has an RSS button without a feed token" do
it "shows the RSS button without a feed token" do
expect(find('[data-testid="rss-feed-link"]')['href']).not_to have_content('feed_token')
end
end
end
end
context 'assignee', :js do
context 'assignee' do
let(:access_level) { ProjectFeature::ENABLED }
let(:user) { user_in_group }
let(:user2) { user_outside_group }
......@@ -56,7 +66,7 @@ RSpec.describe 'Group issues page' do
end
end
context 'issues list' do
context 'issues list', :js do
let(:subgroup) { create(:group, parent: group) }
let(:subgroup_project) { create(:project, :public, group: subgroup)}
let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user }
......@@ -110,7 +120,7 @@ RSpec.describe 'Group issues page' do
end
end
context 'manual ordering' do
context 'manual ordering', :js do
let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user }
let!(:issue1) { create(:issue, project: project, title: 'Issue #1', relative_position: 1) }
......@@ -143,9 +153,11 @@ RSpec.describe 'Group issues page' do
end
end
it 'issues should be draggable and persist order', :js do
it 'issues should be draggable and persist order' do
visit issues_group_path(group, sort: 'relative_position')
wait_for_requests
drag_to(selector: '.manual-ordering',
from_index: 0,
to_index: 2)
......@@ -159,11 +171,13 @@ RSpec.describe 'Group issues page' do
check_issue_order
end
it 'issues should not be draggable when user is not logged in', :js do
it 'issues should not be draggable when user is not logged in' do
sign_out(user_in_group)
visit issues_group_path(group, sort: 'relative_position')
wait_for_requests
drag_to(selector: '.manual-ordering',
from_index: 0,
to_index: 2)
......@@ -187,7 +201,7 @@ RSpec.describe 'Group issues page' do
end
end
context 'issues pagination' do
context 'issues pagination', :js do
let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user }
let!(:issues) do
......@@ -204,7 +218,9 @@ RSpec.describe 'Group issues page' do
end
it 'first pagination item is active' do
expect(page).to have_css(".js-first-button a.page-link.active")
page.within('.gl-pagination') do
expect(find('.active')).to have_content('1')
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