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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Merge Requests > User filters by deployments', :js, feature_category: :code_review do
include FilteredSearchHelpers
let!(:project) { create(:project, :public, :repository) }
let!(:user) { project.creator }
let!(:gstg) { create(:environment, project: project, name: 'gstg') }
let!(:gprd) { create(:environment, project: project, name: 'gprd') }
let(:mr1) do
create(
:merge_request,
:simple,
:merged,
author: user,
source_project: project,
target_project: project
)
end
let(:mr2) do
create(
:merge_request,
:simple,
:merged,
author: user,
source_project: project,
target_project: project
)
end
let(:deploy1) do
create(
:deployment,
:success,
deployable: nil,
environment: gstg,
project: project,
sha: mr1.diff_head_sha,
finished_at: Time.utc(2020, 10, 1, 0, 0)
)
end
let(:deploy2) do
create(
:deployment,
:success,
deployable: nil,
environment: gprd,
project: project,
sha: mr2.diff_head_sha,
finished_at: Time.utc(2020, 10, 2, 0, 0)
)
end
before do
deploy1.link_merge_requests(MergeRequest.where(id: mr1.id))
deploy2.link_merge_requests(MergeRequest.where(id: mr2.id))
sign_in(user)
visit(project_merge_requests_path(project, state: :merged))
end
describe 'filtering by deployed-before' do
it 'applies the filter' do
input_filtered_search('deployed-before:=2020-10-02')
expect(page).to have_issuable_counts(open: 0, merged: 1, all: 1)
expect(page).to have_content mr1.title
end
end
describe 'filtering by deployed-after' do
it 'applies the filter' do
input_filtered_search('deployed-after:=2020-10-01')
expect(page).to have_issuable_counts(open: 0, merged: 1, all: 1)
expect(page).to have_content mr2.title
end
end
describe 'filtering by environment' do
it 'applies the filter' do
input_filtered_search('environment:=gstg')
expect(page).to have_issuable_counts(open: 0, merged: 1, all: 1)
expect(page).to have_content mr1.title
end
end
end
|