diff options
Diffstat (limited to 'spec/frontend/fixtures')
-rw-r--r-- | spec/frontend/fixtures/api_markdown.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/releases.rb | 11 | ||||
-rw-r--r-- | spec/frontend/fixtures/runner.rb | 75 | ||||
-rw-r--r-- | spec/frontend/fixtures/services.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/startup_css.rb | 88 | ||||
-rw-r--r-- | spec/frontend/fixtures/static/projects.json | 9 |
6 files changed, 185 insertions, 2 deletions
diff --git a/spec/frontend/fixtures/api_markdown.rb b/spec/frontend/fixtures/api_markdown.rb index e012d922aad..1c3967b2c36 100644 --- a/spec/frontend/fixtures/api_markdown.rb +++ b/spec/frontend/fixtures/api_markdown.rb @@ -25,7 +25,7 @@ RSpec.describe API::MergeRequests, '(JavaScript fixtures)', type: :request do let(:markdown) { markdown_example.fetch(:markdown) } it "#{fixture_subdir}/#{name}.json" do - post api("/markdown"), params: { text: markdown } + post api("/markdown"), params: { text: markdown, gfm: true } expect(response).to be_successful end diff --git a/spec/frontend/fixtures/releases.rb b/spec/frontend/fixtures/releases.rb index 7ec155fcb10..1882ac49fd6 100644 --- a/spec/frontend/fixtures/releases.rb +++ b/spec/frontend/fixtures/releases.rb @@ -100,6 +100,17 @@ RSpec.describe 'Releases (JavaScript fixtures)' do link_type: :image) end + let_it_be(:another_release) do + create(:release, + project: project, + tag: 'v1.2', + name: 'The second release', + author: admin, + description: 'An okay release :shrug:', + created_at: Time.zone.parse('2019-01-03'), + released_at: Time.zone.parse('2019-01-10')) + end + after(:all) do remove_repository(project) end diff --git a/spec/frontend/fixtures/runner.rb b/spec/frontend/fixtures/runner.rb new file mode 100644 index 00000000000..b88fb840137 --- /dev/null +++ b/spec/frontend/fixtures/runner.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Runner (JavaScript fixtures)' do + include AdminModeHelper + include ApiHelpers + include JavaScriptFixturesHelpers + include GraphqlHelpers + + let_it_be(:admin) { create(:admin) } + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, :repository, :public) } + + let_it_be(:instance_runner) { create(:ci_runner, :instance, version: '1.0.0', revision: '123', description: 'Instance runner', ip_address: '127.0.0.1') } + let_it_be(:group_runner) { create(:ci_runner, :group, groups: [group], active: false, version: '2.0.0', revision: '456', description: 'Group runner', ip_address: '127.0.0.1') } + let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project], active: false, version: '2.0.0', revision: '456', description: 'Project runner', ip_address: '127.0.0.1') } + + query_path = 'runner/graphql/' + fixtures_path = 'graphql/runner/' + + before(:all) do + clean_frontend_fixtures(fixtures_path) + end + + after(:all) do + remove_repository(project) + end + + before do + sign_in(admin) + enable_admin_mode!(admin) + end + + describe GraphQL::Query, type: :request do + get_runners_query_name = 'get_runners.query.graphql' + + let_it_be(:query) do + get_graphql_query_as_string("#{query_path}#{get_runners_query_name}", [ + 'runner/graphql/runner_node.fragment.graphql', + 'graphql_shared/fragments/pageInfo.fragment.graphql' + ]) + end + + it "#{fixtures_path}#{get_runners_query_name}.json" do + post_graphql(query, current_user: admin, variables: {}) + + expect_graphql_errors_to_be_empty + end + + it "#{fixtures_path}#{get_runners_query_name}.paginated.json" do + post_graphql(query, current_user: admin, variables: { first: 2 }) + + expect_graphql_errors_to_be_empty + end + end + + describe GraphQL::Query, type: :request do + get_runner_query_name = 'get_runner.query.graphql' + + let_it_be(:query) do + get_graphql_query_as_string("#{query_path}#{get_runner_query_name}", [ + 'runner/graphql/runner_details.fragment.graphql' + ]) + end + + it "#{fixtures_path}#{get_runner_query_name}.json" do + post_graphql(query, current_user: admin, variables: { + id: instance_runner.to_global_id.to_s + }) + + expect_graphql_errors_to_be_empty + end + end +end diff --git a/spec/frontend/fixtures/services.rb b/spec/frontend/fixtures/services.rb index 7472af802f3..91e6c2eb280 100644 --- a/spec/frontend/fixtures/services.rb +++ b/spec/frontend/fixtures/services.rb @@ -7,7 +7,7 @@ RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :con let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') } - let!(:service) { create(:custom_issue_tracker_service, project: project) } + let!(:service) { create(:custom_issue_tracker_integration, project: project) } let(:user) { project.owner } render_views diff --git a/spec/frontend/fixtures/startup_css.rb b/spec/frontend/fixtures/startup_css.rb new file mode 100644 index 00000000000..003f7b768dd --- /dev/null +++ b/spec/frontend/fixtures/startup_css.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Startup CSS fixtures', type: :controller do + include JavaScriptFixturesHelpers + + let(:use_full_html) { true } + + render_views + + before(:all) do + stub_feature_flags(combined_menu: true) + stub_feature_flags(sidebar_refactor: true) + clean_frontend_fixtures('startup_css/') + end + + shared_examples 'startup css project fixtures' do |type| + let(:user) { create(:user, :admin) } + let(:project) { create(:project, :public, :repository, description: 'Code and stuff', creator: user) } + + before do + sign_in(user) + end + + it "startup_css/project-#{type}-legacy-menu.html" do + stub_feature_flags(combined_menu: false) + + get :show, params: { + namespace_id: project.namespace.to_param, + id: project + } + + expect(response).to be_successful + end + + it "startup_css/project-#{type}.html" do + get :show, params: { + namespace_id: project.namespace.to_param, + id: project + } + + expect(response).to be_successful + end + + it "startup_css/project-#{type}-legacy-sidebar.html" do + stub_feature_flags(sidebar_refactor: false) + + get :show, params: { + namespace_id: project.namespace.to_param, + id: project + } + + expect(response).to be_successful + end + + it "startup_css/project-#{type}-signed-out.html" do + sign_out(user) + + get :show, params: { + namespace_id: project.namespace.to_param, + id: project + } + + expect(response).to be_successful + end + end + + describe ProjectsController, '(Startup CSS fixtures)', type: :controller do + it_behaves_like 'startup css project fixtures', 'general' + end + + describe ProjectsController, '(Startup CSS fixtures)', type: :controller do + before do + user.update!(theme_id: 11) + end + + it_behaves_like 'startup css project fixtures', 'dark' + end + + describe RegistrationsController, '(Startup CSS fixtures)', type: :controller do + it 'startup_css/sign-in.html' do + get :new + + expect(response).to be_successful + end + end +end diff --git a/spec/frontend/fixtures/static/projects.json b/spec/frontend/fixtures/static/projects.json index f28d9899099..d843549039b 100644 --- a/spec/frontend/fixtures/static/projects.json +++ b/spec/frontend/fixtures/static/projects.json @@ -3,6 +3,7 @@ "description": "", "default_branch": null, "tag_list": [], + "topics": [], "public": true, "archived": false, "visibility_level": 20, @@ -54,6 +55,7 @@ "description": "Voluptatem quae nulla eius numquam ullam voluptatibus quia modi.", "default_branch": "master", "tag_list": [], + "topics": [], "public": false, "archived": false, "visibility_level": 0, @@ -114,6 +116,7 @@ "description": "Modi odio mollitia dolorem qui.", "default_branch": "master", "tag_list": [], + "topics": [], "public": false, "archived": false, "visibility_level": 0, @@ -162,6 +165,7 @@ "description": "Omnis asperiores ipsa et beatae quidem necessitatibus quia.", "default_branch": "master", "tag_list": [], + "topics": [], "public": true, "archived": false, "visibility_level": 20, @@ -210,6 +214,7 @@ "description": "Voluptatem commodi voluptate placeat architecto beatae illum dolores fugiat.", "default_branch": "master", "tag_list": [], + "topics": [], "public": false, "archived": false, "visibility_level": 0, @@ -258,6 +263,7 @@ "description": "Aut molestias quas est ut aperiam officia quod libero.", "default_branch": "master", "tag_list": [], + "topics": [], "public": true, "archived": false, "visibility_level": 20, @@ -309,6 +315,7 @@ "description": "Excepturi molestiae quia repellendus omnis est illo illum eligendi.", "default_branch": "master", "tag_list": [], + "topics": [], "public": true, "archived": false, "visibility_level": 20, @@ -357,6 +364,7 @@ "description": "Adipisci quaerat dignissimos enim sed ipsam dolorem quia.", "default_branch": "master", "tag_list": [], + "topics": [], "public": false, "archived": false, "visibility_level": 10, @@ -408,6 +416,7 @@ "description": "Vel voluptatem maxime saepe ex quia.", "default_branch": "master", "tag_list": [], + "topics": [], "public": false, "archived": false, "visibility_level": 0, |