diff options
Diffstat (limited to 'spec/frontend/fixtures')
-rw-r--r-- | spec/frontend/fixtures/time_estimates.rb | 61 | ||||
-rw-r--r-- | spec/frontend/fixtures/users.rb | 11 |
2 files changed, 70 insertions, 2 deletions
diff --git a/spec/frontend/fixtures/time_estimates.rb b/spec/frontend/fixtures/time_estimates.rb new file mode 100644 index 00000000000..c9591bd63ac --- /dev/null +++ b/spec/frontend/fixtures/time_estimates.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Time estimates (GraphQL fixtures)', feature_category: :team_planning do + describe GraphQL::Query, type: :request do + include ApiHelpers + include GraphqlHelpers + include JavaScriptFixturesHelpers + + let_it_be(:developer) { create(:user) } + + context 'for issues time estimate' do + let_it_be(:project) { create(:project_empty_repo, :public) } + let_it_be(:issue) { create(:issue, project: project) } + + let(:query_path) { 'sidebar/queries/issue_set_time_estimate.mutation.graphql' } + let(:query) { get_graphql_query_as_string(query_path) } + + before_all do + project.add_developer(developer) + end + + context 'when there are no errors while changing the time estimate' do + it "graphql/issue_set_time_estimate_without_errors.json" do + post_graphql( + query, + current_user: developer, + variables: { + input: { + projectPath: project.full_path, + iid: issue.iid.to_s, + timeEstimate: '1d 2h' + } + } + ) + + expect_graphql_errors_to_be_empty + end + end + + context 'when there are errors while changing the time estimate' do + it "graphql/issue_set_time_estimate_with_errors.json" do + post_graphql( + query, + current_user: developer, + variables: { + input: { + projectPath: project.full_path, + iid: issue.iid.to_s, + timeEstimate: '1egh' + } + } + ) + + expect_graphql_errors_to_include("timeEstimate must be formatted correctly, for example `1h 30m`") + end + end + end + end +end diff --git a/spec/frontend/fixtures/users.rb b/spec/frontend/fixtures/users.rb index 800a9af194e..4bdf9160083 100644 --- a/spec/frontend/fixtures/users.rb +++ b/spec/frontend/fixtures/users.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe 'Users (JavaScript fixtures)', feature_category: :user_profile do include JavaScriptFixturesHelpers include ApiHelpers + include DesignManagementTestHelpers let_it_be(:followers) { create_list(:user, 5) } let_it_be(:followees) { create_list(:user, 5) } @@ -28,16 +29,22 @@ RSpec.describe 'Users (JavaScript fixtures)', feature_category: :user_profile do let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project_empty_repo, group: group) } - include_context 'with user contribution events' + if Gitlab.ee? + include_context '[EE] with user contribution events' + else + include_context 'with user contribution events' + end before do + enable_design_management + stub_licensed_features(epics: true) group.add_owner(user) project.add_maintainer(user) sign_in(user) end it 'controller/users/activity.json' do - get :activity, params: { username: user.username, limit: 50 }, format: :json + get :activity, params: { username: user.username, limit: 100 }, format: :json expect(response).to be_successful end |