diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /spec/frontend/fixtures | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) | |
download | gitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'spec/frontend/fixtures')
-rw-r--r-- | spec/frontend/fixtures/api_deploy_keys.rb | 24 | ||||
-rw-r--r-- | spec/frontend/fixtures/api_markdown.rb | 65 | ||||
-rw-r--r-- | spec/frontend/fixtures/api_markdown.yml | 289 | ||||
-rw-r--r-- | spec/frontend/fixtures/blob.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/projects.rb | 26 | ||||
-rw-r--r-- | spec/frontend/fixtures/raw.rb | 22 | ||||
-rw-r--r-- | spec/frontend/fixtures/tabs.rb | 26 | ||||
-rw-r--r-- | spec/frontend/fixtures/timezones.rb | 10 |
8 files changed, 68 insertions, 396 deletions
diff --git a/spec/frontend/fixtures/api_deploy_keys.rb b/spec/frontend/fixtures/api_deploy_keys.rb new file mode 100644 index 00000000000..7027b8c975b --- /dev/null +++ b/spec/frontend/fixtures/api_deploy_keys.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe API::DeployKeys, '(JavaScript fixtures)', type: :request do + include ApiHelpers + include JavaScriptFixturesHelpers + + let_it_be(:admin) { create(:admin) } + let_it_be(:project) { create(:project) } + let_it_be(:project2) { create(:project) } + let_it_be(:deploy_key) { create(:deploy_key, public: true) } + let_it_be(:deploy_key2) { create(:deploy_key, public: true) } + let_it_be(:deploy_keys_project) { create(:deploy_keys_project, :write_access, project: project, deploy_key: deploy_key) } + let_it_be(:deploy_keys_project2) { create(:deploy_keys_project, :write_access, project: project2, deploy_key: deploy_key) } + let_it_be(:deploy_keys_project3) { create(:deploy_keys_project, :write_access, project: project, deploy_key: deploy_key2) } + let_it_be(:deploy_keys_project4) { create(:deploy_keys_project, :write_access, project: project2, deploy_key: deploy_key2) } + + it 'api/deploy_keys/index.json' do + get api("/deploy_keys", admin) + + expect(response).to be_successful + end +end diff --git a/spec/frontend/fixtures/api_markdown.rb b/spec/frontend/fixtures/api_markdown.rb deleted file mode 100644 index 89f012a5110..00000000000 --- a/spec/frontend/fixtures/api_markdown.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe API::MergeRequests, '(JavaScript fixtures)', type: :request do - include ApiHelpers - include WikiHelpers - include JavaScriptFixturesHelpers - - let_it_be(:user) { create(:user, username: 'gitlab') } - - let_it_be(:group) { create(:group, :public) } - let_it_be(:project) { create(:project, :public, :repository, group: group) } - - let_it_be(:label) { create(:label, project: project, title: 'bug') } - let_it_be(:milestone) { create(:milestone, project: project, title: '1.1') } - let_it_be(:issue) { create(:issue, project: project) } - let_it_be(:merge_request) { create(:merge_request, source_project: project) } - - let_it_be(:project_wiki) { create(:project_wiki, project: project, user: user) } - - let(:project_wiki_page) { create(:wiki_page, wiki: project_wiki) } - - before(:all) do - group.add_owner(user) - project.add_maintainer(user) - end - - before do - sign_in(user) - end - - markdown_examples = begin - yaml_file_path = File.expand_path('api_markdown.yml', __dir__) - yaml = File.read(yaml_file_path) - YAML.safe_load(yaml, symbolize_names: true) - end - - markdown_examples.each do |markdown_example| - context = markdown_example.fetch(:context, '') - name = markdown_example.fetch(:name) - - context "for #{name}#{!context.empty? ? " (context: #{context})" : ''}" do - let(:markdown) { markdown_example.fetch(:markdown) } - - name = "#{context}_#{name}" unless context.empty? - - it "api/markdown/#{name}.json" do - api_url = case context - when 'project' - "/#{project.full_path}/preview_markdown" - when 'group' - "/groups/#{group.full_path}/preview_markdown" - when 'project_wiki' - "/#{project.full_path}/-/wikis/#{project_wiki_page.slug}/preview_markdown" - else - api "/markdown" - end - - post api_url, params: { text: markdown, gfm: true } - expect(response).to be_successful - end - end - end -end diff --git a/spec/frontend/fixtures/api_markdown.yml b/spec/frontend/fixtures/api_markdown.yml deleted file mode 100644 index 8fd6a5531db..00000000000 --- a/spec/frontend/fixtures/api_markdown.yml +++ /dev/null @@ -1,289 +0,0 @@ -# This data file drives the specs in -# spec/frontend/fixtures/api_markdown.rb and -# spec/frontend/content_editor/extensions/markdown_processing_spec.js ---- -- name: attachment_image - context: group - markdown: '![test-file](/uploads/aa45a38ec2cfe97433281b10bbff042c/test-file.png)' -- name: attachment_image - context: project - markdown: '![test-file](/uploads/aa45a38ec2cfe97433281b10bbff042c/test-file.png)' -- name: attachment_image - context: project_wiki - markdown: '![test-file](test-file.png)' -- name: attachment_link - context: group - markdown: '[test-file](/uploads/aa45a38ec2cfe97433281b10bbff042c/test-file.zip)' -- name: attachment_link - context: project - markdown: '[test-file](/uploads/aa45a38ec2cfe97433281b10bbff042c/test-file.zip)' -- name: attachment_link - context: project_wiki - markdown: '[test-file](test-file.zip)' -- name: audio - markdown: '![Sample Audio](https://gitlab.com/gitlab.mp3)' -- name: audio_and_video_in_lists - markdown: |- - * ![Sample Audio](https://gitlab.com/1.mp3) - * ![Sample Video](https://gitlab.com/2.mp4) - - 1. ![Sample Video](https://gitlab.com/1.mp4) - 2. ![Sample Audio](https://gitlab.com/2.mp3) - - * [x] ![Sample Audio](https://gitlab.com/1.mp3) - * [x] ![Sample Audio](https://gitlab.com/2.mp3) - * [x] ![Sample Video](https://gitlab.com/3.mp4) -- name: blockquote - markdown: |- - > This is a blockquote - > - > This is another one -- name: bold - markdown: '**bold**' -- name: bullet_list_style_1 - markdown: |- - * list item 1 - * list item 2 - * embedded list item 3 -- name: bullet_list_style_2 - markdown: |- - - list item 1 - - list item 2 - * embedded list item 3 -- name: bullet_list_style_3 - markdown: |- - + list item 1 - + list item 2 - - embedded list item 3 -- name: code_block - markdown: |- - ```javascript - console.log('hello world') - ``` -- name: color_chips - markdown: |- - - `#F00` - - `#F00A` - - `#FF0000` - - `#FF0000AA` - - `RGB(0,255,0)` - - `RGB(0%,100%,0%)` - - `RGBA(0,255,0,0.3)` - - `HSL(540,70%,50%)` - - `HSLA(540,70%,50%,0.3)` -- name: description_list - markdown: |- - <dl> - <dt>Frog</dt> - <dd>Wet green thing</dd> - <dt>Rabbit</dt> - <dd>Warm fluffy thing</dd> - <dt>Punt</dt> - <dd>Kick a ball</dd> - <dd>Take a bet</dd> - <dt>Color</dt> - <dt>Colour</dt> - <dd> - - Any hue except _white_ or **black** - - </dd> - </dl> -- name: details - markdown: |- - <details> - <summary>Apply this patch</summary> - - ```diff - diff --git a/spec/frontend/fixtures/api_markdown.yml b/spec/frontend/fixtures/api_markdown.yml - index 8433efaf00c..69b12c59d46 100644 - --- a/spec/frontend/fixtures/api_markdown.yml - +++ b/spec/frontend/fixtures/api_markdown.yml - @@ -33,6 +33,13 @@ - * <ruby>漢<rt>ㄏㄢˋ</rt></ruby> - * C<sub>7</sub>H<sub>16</sub> + O<sub>2</sub> → CO<sub>2</sub> + H<sub>2</sub>O - * The **Pythagorean theorem** is often expressed as <var>a<sup>2</sup></var> + <var>b<sup>2</sup></var> = <var>c<sup>2</sup></var>.The **Pythagorean theorem** is often expressed as <var>a<sup>2</sup></var> + <var>b<sup>2</sup></var> = <var>c<sup>2</sup></var> - +- name: details - + markdown: |- - + <details> - + <summary>Apply this patch</summary> - + - + 🐶 much meta, 🐶 many patch - + 🐶 such diff, 🐶 very meme - + 🐶 wow! - + </details> - - name: link - markdown: '[GitLab](https://gitlab.com)' - - name: attachment_link - ``` - - </details> -- name: div - markdown: |- - <div>plain text</div> - <div> - - just a plain ol' div, not much to _expect_! - - </div> -- name: emoji - markdown: ':sparkles: :heart: :100:' -- name: emphasis - markdown: '_emphasized text_' -- name: figure - markdown: |- - <figure> - - ![Elephant at sunset](elephant-sunset.jpg) - - <figcaption>An elephant at sunset</figcaption> - </figure> - <figure> - - ![A crocodile wearing crocs](croc-crocs.jpg) - - <figcaption> - - A crocodile wearing _crocs_! - - </figcaption> - </figure> -- name: frontmatter_json - markdown: |- - ;;; - { - "title": "Page title" - } - ;;; -- name: frontmatter_toml - markdown: |- - +++ - title = "Page title" - +++ -- name: frontmatter_yaml - markdown: |- - --- - title: Page title - --- -- name: hard_break - markdown: |- - This is a line after a\ - hard break -- name: headings - markdown: |- - # Heading 1 - - ## Heading 2 - - ### Heading 3 - - #### Heading 4 - - ##### Heading 5 - - ###### Heading 6 -- name: horizontal_rule - markdown: '---' -- name: html_marks - markdown: |- - * Content editor is ~~great~~<ins>amazing</ins>. - * If the changes <abbr title="Looks good to merge">LGTM</abbr>, please <abbr title="Merge when pipeline succeeds">MWPS</abbr>. - * The English song <q>Oh I do like to be beside the seaside</q> looks like this in Hebrew: <span dir="rtl">אה, אני אוהב להיות ליד חוף הים</span>. In the computer's memory, this is stored as <bdo dir="ltr">אה, אני אוהב להיות ליד חוף הים</bdo>. - * <cite>The Scream</cite> by Edvard Munch. Painted in 1893. - * <dfn>HTML</dfn> is the standard markup language for creating web pages. - * Do not forget to buy <mark>milk</mark> today. - * This is a paragraph and <small>smaller text goes here</small>. - * The concert starts at <time datetime="20:00">20:00</time> and you'll be able to enjoy the band for at least <time datetime="PT2H30M">2h 30m</time>. - * Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy text (Windows). - * WWF's goal is to: <q>Build a future where people live in harmony with nature.</q> We hope they succeed. - * The error occured was: <samp>Keyboard not found. Press F1 to continue.</samp> - * The area of a triangle is: 1/2 x <var>b</var> x <var>h</var>, where <var>b</var> is the base, and <var>h</var> is the vertical height. - * <ruby>漢<rt>ㄏㄢˋ</rt></ruby> - * C<sub>7</sub>H<sub>16</sub> + O<sub>2</sub> → CO<sub>2</sub> + H<sub>2</sub>O - * The **Pythagorean theorem** is often expressed as <var>a<sup>2</sup></var> + <var>b<sup>2</sup></var> = <var>c<sup>2</sup></var> -- name: image - markdown: '![alt text](https://gitlab.com/logo.png)' -- name: inline_code - markdown: '`code`' -- name: inline_diff - markdown: |- - * {-deleted-} - * {+added+} -- name: link - markdown: '[GitLab](https://gitlab.com)' -- name: math - markdown: |- - This math is inline $`a^2+b^2=c^2`$. - - This is on a separate line: - - ```math - a^2+b^2=c^2 - ``` -- name: ordered_list - markdown: |- - 1. list item 1 - 2. list item 2 - 3. list item 3 -- name: ordered_list_with_start_order - markdown: |- - 134. list item 1 - 135. list item 2 - 136. list item 3 -- name: ordered_task_list - markdown: |- - 1. [x] hello - 2. [x] world - 3. [ ] example - 1. [ ] of nested - 1. [x] task list - 2. [ ] items -- name: ordered_task_list_with_order - markdown: |- - 4893. [x] hello - 4894. [x] world - 4895. [ ] example -- name: reference - context: project_wiki - markdown: |- - Hi @gitlab - thank you for reporting this ~bug (#1) we hope to fix it in %1.1 as part of !1 -- name: strike - markdown: '~~del~~' -- name: table - markdown: |- - | header | header | - |--------|--------| - | `code` | cell with **bold** | - | ~~strike~~ | cell with _italic_ | - - # content after table -- name: table_of_contents - markdown: |- - [[_TOC_]] - - # Lorem - - Well, that's just like... your opinion.. man. - - ## Ipsum - - ### Dolar - - # Sit amit - - ### I don't know -- name: task_list - markdown: |- - * [x] hello - * [x] world - * [ ] example - * [ ] of nested - * [x] task list - * [ ] items -- name: thematic_break - markdown: |- - --- -- name: video - markdown: '![Sample Video](https://gitlab.com/gitlab.mp4)' -- name: word_break - markdown: Fernstraßen<wbr>bau<wbr>privat<wbr>finanzierungs<wbr>gesetz diff --git a/spec/frontend/fixtures/blob.rb b/spec/frontend/fixtures/blob.rb index f90e3662e98..bfdeee0881b 100644 --- a/spec/frontend/fixtures/blob.rb +++ b/spec/frontend/fixtures/blob.rb @@ -34,7 +34,7 @@ RSpec.describe Projects::BlobController, '(JavaScript fixtures)', type: :control get(:show, params: { namespace_id: project.namespace, project_id: project, - id: 'master/README.md' + id: "#{project.default_branch}/README.md" }) expect(response).to be_successful diff --git a/spec/frontend/fixtures/projects.rb b/spec/frontend/fixtures/projects.rb index 23c18c97df2..3c8964d398a 100644 --- a/spec/frontend/fixtures/projects.rb +++ b/spec/frontend/fixtures/projects.rb @@ -65,31 +65,5 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do expect_graphql_errors_to_be_empty end end - - context 'project storage count query' do - before do - project.statistics.update!( - repository_size: 3900000, - lfs_objects_size: 4800000, - build_artifacts_size: 400000, - pipeline_artifacts_size: 400000, - wiki_size: 300000, - packages_size: 3800000, - uploads_size: 900000 - ) - end - - base_input_path = 'projects/storage_counter/queries/' - base_output_path = 'graphql/projects/storage_counter/' - query_name = 'project_storage.query.graphql' - - it "#{base_output_path}#{query_name}.json" do - query = get_graphql_query_as_string("#{base_input_path}#{query_name}") - - post_graphql(query, current_user: user, variables: { fullPath: project.full_path }) - - expect_graphql_errors_to_be_empty - end - end end end diff --git a/spec/frontend/fixtures/raw.rb b/spec/frontend/fixtures/raw.rb index 211c4e7c048..b117cfea5fa 100644 --- a/spec/frontend/fixtures/raw.rb +++ b/spec/frontend/fixtures/raw.rb @@ -7,41 +7,45 @@ RSpec.describe 'Raw files', '(JavaScript fixtures)' do let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'raw-project') } - let(:response) { @blob.data.force_encoding('UTF-8') } + let(:response) { @response } + + def blob_at(commit, path) + @response = project.repository.blob_at(commit, path).data.force_encoding('UTF-8') + end after do remove_repository(project) end it 'blob/notebook/basic.json' do - @blob = project.repository.blob_at('6d85bb69', 'files/ipython/basic.ipynb') + blob_at('6d85bb69', 'files/ipython/basic.ipynb') end it 'blob/notebook/markdown-table.json' do - @blob = project.repository.blob_at('f6b7a707', 'files/ipython/markdown-table.ipynb') + blob_at('f6b7a707', 'files/ipython/markdown-table.ipynb') end it 'blob/notebook/worksheets.json' do - @blob = project.repository.blob_at('6d85bb69', 'files/ipython/worksheets.ipynb') + blob_at('6d85bb69', 'files/ipython/worksheets.ipynb') end it 'blob/notebook/math.json' do - @blob = project.repository.blob_at('93ee732', 'files/ipython/math.ipynb') + blob_at('93ee732', 'files/ipython/math.ipynb') end it 'blob/pdf/test.pdf' do - @blob = project.repository.blob_at('e774ebd33', 'files/pdf/test.pdf') + blob_at('e774ebd33', 'files/pdf/test.pdf') end it 'blob/text/README.md' do - @blob = project.repository.blob_at('e774ebd33', 'README.md') + blob_at('e774ebd33', 'README.md') end it 'blob/images/logo-white.png' do - @blob = project.repository.blob_at('e774ebd33', 'files/images/logo-white.png') + blob_at('e774ebd33', 'files/images/logo-white.png') end it 'blob/binary/Gemfile.zip' do - @blob = project.repository.blob_at('e774ebd33', 'Gemfile.zip') + blob_at('e774ebd33', 'Gemfile.zip') end end diff --git a/spec/frontend/fixtures/tabs.rb b/spec/frontend/fixtures/tabs.rb new file mode 100644 index 00000000000..697ff1c7c20 --- /dev/null +++ b/spec/frontend/fixtures/tabs.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'GlTabsBehavior', '(JavaScript fixtures)', type: :helper do + include JavaScriptFixturesHelpers + include TabHelper + + let(:response) { @tabs } + + it 'tabs/tabs.html' do + tabs = gl_tabs_nav({ data: { testid: 'tabs' } }) do + gl_tab_link_to('Foo', '#foo', item_active: true, data: { testid: 'foo-tab' }) + + gl_tab_link_to('Bar', '#bar', item_active: false, data: { testid: 'bar-tab' }) + + gl_tab_link_to('Qux', '#qux', item_active: false, data: { testid: 'qux-tab' }) + end + + panels = content_tag(:div, class: 'tab-content') do + content_tag(:div, 'Foo', { id: 'foo', class: 'tab-pane active', data: { testid: 'foo-panel' } }) + + content_tag(:div, 'Bar', { id: 'bar', class: 'tab-pane', data: { testid: 'bar-panel' } }) + + content_tag(:div, 'Qux', { id: 'qux', class: 'tab-pane', data: { testid: 'qux-panel' } }) + end + + @tabs = tabs + panels + end +end diff --git a/spec/frontend/fixtures/timezones.rb b/spec/frontend/fixtures/timezones.rb index 157f47855ea..2393f4e797d 100644 --- a/spec/frontend/fixtures/timezones.rb +++ b/spec/frontend/fixtures/timezones.rb @@ -8,11 +8,9 @@ RSpec.describe TimeZoneHelper, '(JavaScript fixtures)' do let(:response) { @timezones.sort_by! { |tz| tz[:name] }.to_json } - it 'timezones/short.json' do - @timezones = timezone_data(format: :short) - end - - it 'timezones/full.json' do - @timezones = timezone_data(format: :full) + %I[short abbr full].each do |format| + it "timezones/#{format}.json" do + @timezones = timezone_data(format: format) + end end end |