File: user_sorts_things_spec.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (47 lines) | stat: -rw-r--r-- 1,657 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true

require "spec_helper"

# The main goal of this spec is not to check whether the sorting UI works, but
# to check if the sorting option set by user is being kept persisted while going through pages.
# The `it`s are named here by convention `starting point -> some pages -> final point`.
# All those specs are moved out to this spec intentionally to keep them all in one place.
RSpec.describe "User sorts things", :js do
  include Features::SortingHelpers
  include DashboardHelper

  let_it_be(:project) { create(:project_empty_repo, :public) }
  let_it_be(:user) { create(:user) }
  let_it_be(:issue) { create(:issue, project: project, author: user) }
  let_it_be(:merge_request) { create(:merge_request, target_project: project, source_project: project, author: user) }

  before do
    project.add_developer(user)
    sign_in(user)
  end

  it "issues -> project home page -> issues", feature_category: :team_planning do
    sort_option = s_('SortOptions|Updated date')

    visit(project_issues_path(project))

    pajamas_sort_by sort_option, from: s_('SortOptions|Created date')

    visit(project_path(project))
    visit(project_issues_path(project))

    expect(page).to have_button(sort_option)
  end

  it "merge requests -> dashboard merge requests", feature_category: :code_review_workflow do
    sort_option = s_('SortOptions|Updated date')

    visit(project_merge_requests_path(project))

    pajamas_sort_by sort_option, from: s_('SortOptions|Created date')

    visit(merge_requests_dashboard_path(assignee_username: user.username))

    expect(find(".issues-filters")).to have_content(sort_option)
  end
end