Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
ba2d791767
commit
bf10fcacaa
32 changed files with 327 additions and 225 deletions
|
@ -167,7 +167,12 @@ export default {
|
|||
</template>
|
||||
</user-callout-dismisser>
|
||||
|
||||
<gl-tabs content-class="gl-pt-0" sync-active-tab-with-query-params lazy>
|
||||
<gl-tabs
|
||||
content-class="gl-pt-0"
|
||||
data-qa-selector="security_configuration_container"
|
||||
sync-active-tab-with-query-params
|
||||
lazy
|
||||
>
|
||||
<gl-tab
|
||||
data-testid="security-testing-tab"
|
||||
:title="$options.i18n.securityTesting"
|
||||
|
|
|
@ -32,7 +32,9 @@ module Pages
|
|||
|
||||
{
|
||||
type: 'zip',
|
||||
path: deployment.file.url_or_file_path(expire_at: 1.day.from_now),
|
||||
path: deployment.file.url_or_file_path(
|
||||
expire_at: ::Gitlab::Pages::CacheControl::DEPLOYMENT_EXPIRATION.from_now
|
||||
),
|
||||
global_id: global_id,
|
||||
sha256: deployment.file_sha256,
|
||||
file_size: deployment.size,
|
||||
|
|
|
@ -26,6 +26,7 @@ module Gitlab
|
|||
RefreshImportJidWorker.perform_in_the_future(project.id, jid)
|
||||
|
||||
info(project.id, message: "starting importer", importer: 'Importer::RepositoryImporter')
|
||||
|
||||
importer = Importer::RepositoryImporter.new(project, client)
|
||||
|
||||
importer.execute
|
||||
|
|
|
@ -306,6 +306,11 @@ To create a custom configuration, you can use passthrough chains. Passthroughs c
|
|||
to build more complex configurations. For more details, see
|
||||
[SAST Customize ruleset](../sast/customize_rulesets.md).
|
||||
|
||||
Only the following passthrough types are supported by the `secrets` analyzer:
|
||||
|
||||
- `file`
|
||||
- `raw`
|
||||
|
||||
In the `secret-detection-ruleset.toml` file, do one of the following:
|
||||
|
||||
- Define a custom ruleset, for example:
|
||||
|
|
|
@ -59,7 +59,8 @@ module API
|
|||
# Gitlab::Pages::CacheControl
|
||||
present_cached virtual_domain,
|
||||
cache_context: nil,
|
||||
with: Entities::Internal::Pages::VirtualDomain
|
||||
with: Entities::Internal::Pages::VirtualDomain,
|
||||
expires_in: ::Gitlab::Pages::CacheControl::EXPIRE
|
||||
else
|
||||
present virtual_domain, with: Entities::Internal::Pages::VirtualDomain
|
||||
end
|
||||
|
|
|
@ -60,6 +60,10 @@ module Gitlab
|
|||
work_item_type_id: issue.work_item_type_id
|
||||
}
|
||||
|
||||
Issue.with_project_iid_supply(project) do |supply|
|
||||
attributes[:iid] = supply.next_value
|
||||
end
|
||||
|
||||
insert_and_return_id(attributes, project.issues)
|
||||
rescue ActiveRecord::InvalidForeignKey
|
||||
# It's possible the project has been deleted since scheduling this
|
||||
|
|
|
@ -5,6 +5,10 @@ module Gitlab
|
|||
class CacheControl
|
||||
include Gitlab::Utils::StrongMemoize
|
||||
|
||||
EXPIRE = 12.hours
|
||||
# To avoid delivering expired deployment URL in the cached payload,
|
||||
# use a longer expiration time in the deployment URL
|
||||
DEPLOYMENT_EXPIRATION = (EXPIRE + 12.hours)
|
||||
CACHE_KEY_FORMAT = 'pages_domain_for_%{type}_%{id}_%{settings}'
|
||||
|
||||
class << self
|
||||
|
|
|
@ -9,6 +9,7 @@ module QA
|
|||
include QA::Page::Settings::Common
|
||||
|
||||
view 'app/assets/javascripts/security_configuration/components/app.vue' do
|
||||
element :security_configuration_container
|
||||
element :security_configuration_history_link
|
||||
end
|
||||
|
||||
|
@ -17,6 +18,7 @@ module QA
|
|||
element :sast_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
|
||||
element :sast_enable_button, "`${feature.type}_enable_button`" # rubocop:disable QA/ElementWithPattern
|
||||
element :dependency_scanning_mr_button, "`${feature.type}_mr_button`" # rubocop:disable QA/ElementWithPattern
|
||||
element :license_scanning_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
|
||||
end
|
||||
|
||||
view 'app/assets/javascripts/security_configuration/components/auto_dev_ops_alert.vue' do
|
||||
|
@ -67,6 +69,18 @@ module QA
|
|||
end
|
||||
end
|
||||
|
||||
def has_license_compliance_status?(status_text)
|
||||
within_element(:license_scanning_status) do
|
||||
has_text?(status_text)
|
||||
end
|
||||
end
|
||||
|
||||
def has_no_license_compliance_status?(status_text)
|
||||
within_element(:license_scanning_status) do
|
||||
has_no_text?(status_text)
|
||||
end
|
||||
end
|
||||
|
||||
def has_auto_devops_container?
|
||||
has_element?(:autodevops_container)
|
||||
end
|
||||
|
@ -80,6 +94,18 @@ module QA
|
|||
has_text?('Quickly enable all continuous testing and compliance tools by enabling Auto DevOps')
|
||||
end
|
||||
end
|
||||
|
||||
def go_to_compliance_tab
|
||||
go_to_tab('Compliance')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def go_to_tab(name)
|
||||
within_element(:security_configuration_container) do
|
||||
find('.nav-item', text: name).click
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,7 @@ module QA
|
|||
end
|
||||
|
||||
def initialize
|
||||
# Note: A Group Wiki Home page requires title = 'Home', otherwise when going /-/wikis, Rails will render a new page creation form.
|
||||
@title = 'Home'
|
||||
@content = 'This wiki page is created via API'
|
||||
end
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Create' do
|
||||
describe 'Testing wiki content creation inside a project' do
|
||||
let(:new_wiki_title) { "just_another_wiki_page" }
|
||||
let(:new_wiki_content) { "this content is changed or added" }
|
||||
let(:commit_message) { "this is a new addition to the wiki" }
|
||||
|
||||
let(:project) { Resource::Project.fabricate_via_api! }
|
||||
let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
|
||||
|
||||
before do
|
||||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
it 'by adding a home page to the wiki',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do
|
||||
project.visit!
|
||||
|
||||
Page::Project::Menu.perform(&:click_wiki)
|
||||
Page::Project::Wiki::Show.perform(&:click_create_your_first_page)
|
||||
|
||||
Page::Project::Wiki::Edit.perform do |edit|
|
||||
edit.set_title new_wiki_title
|
||||
edit.set_content new_wiki_content
|
||||
edit.set_message commit_message
|
||||
end
|
||||
|
||||
Page::Project::Wiki::Edit.perform(&:click_submit)
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
|
||||
it 'by adding a second page to the wiki',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do
|
||||
wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_new_page)
|
||||
|
||||
Page::Project::Wiki::Edit.perform do |edit|
|
||||
edit.set_title new_wiki_title
|
||||
edit.set_content new_wiki_content
|
||||
edit.set_message commit_message
|
||||
end
|
||||
|
||||
Page::Project::Wiki::Edit.perform(&:click_submit)
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
|
||||
it 'by adding a home page to the wiki using git push',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do
|
||||
empty_wiki = Resource::Wiki::ProjectPage.new do |empty_wiki|
|
||||
empty_wiki.project = project
|
||||
end
|
||||
|
||||
Resource::Repository::WikiPush.fabricate! do |push|
|
||||
push.file_name = "#{new_wiki_title}.md"
|
||||
push.file_content = new_wiki_content
|
||||
push.commit_message = commit_message
|
||||
push.wiki = empty_wiki
|
||||
push.new_branch = true
|
||||
end.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
|
||||
it 'by adding a second page to the wiki using git push',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347807' do
|
||||
Resource::Repository::WikiPush.fabricate! do |push|
|
||||
push.file_name = "#{new_wiki_title}.md"
|
||||
push.file_content = new_wiki_content
|
||||
push.commit_message = commit_message
|
||||
push.wiki = wiki
|
||||
push.new_branch = false
|
||||
end.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,51 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Create' do
|
||||
describe 'Testing wiki content manipulation inside a project' do
|
||||
let(:new_wiki_title) { "just_another_wiki_page" }
|
||||
let(:new_wiki_content) { "this content is changed or added" }
|
||||
let(:commit_message) { "this is a new addition to the wiki" }
|
||||
|
||||
let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
|
||||
|
||||
before do
|
||||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
it 'by manipulating content on the page',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347810' do
|
||||
wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_edit)
|
||||
|
||||
Page::Project::Wiki::Edit.perform do |edit|
|
||||
edit.set_title new_wiki_title
|
||||
edit.set_content new_wiki_content
|
||||
edit.set_message commit_message
|
||||
end
|
||||
|
||||
Page::Project::Wiki::Edit.perform(&:click_submit)
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
|
||||
it 'by manipulating content on the page using git push',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347811' do
|
||||
Resource::Repository::WikiPush.fabricate! do |push|
|
||||
push.file_content = new_wiki_content
|
||||
push.commit_message = commit_message
|
||||
push.wiki = wiki
|
||||
push.new_branch = false
|
||||
end.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module QA
|
||||
RSpec.describe 'Create' do
|
||||
context 'Wiki' do
|
||||
describe 'A project wiki' do
|
||||
let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
|
||||
let(:new_path) { "a/new/path-with-spaces" }
|
||||
|
||||
|
@ -10,7 +10,8 @@ module QA
|
|||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
it 'has changed the directory', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347821' do
|
||||
it 'can change the directory path of a page',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347821' do
|
||||
initial_wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_edit)
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module QA
|
||||
RSpec.describe 'Create', :reliable do
|
||||
context 'Content Editor' do
|
||||
describe 'Testing project wiki file upload' do
|
||||
let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
|
||||
let(:page_title) { 'Content Editor Page' }
|
||||
let(:heading_text) { 'My New Heading' }
|
||||
|
@ -16,7 +16,8 @@ module QA
|
|||
initial_wiki.project.remove_via_api!
|
||||
end
|
||||
|
||||
it 'creates a formatted Wiki page with an image uploaded', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347640' do
|
||||
it 'by creating a formatted page with an image uploaded',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347640' do
|
||||
initial_wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_new_page)
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module QA
|
||||
RSpec.describe 'Create' do
|
||||
context 'Wiki' do
|
||||
describe 'Project Wiki' do
|
||||
let(:small_number_of_pages) { 5 }
|
||||
let(:large_number_of_pages) { 15 }
|
||||
let(:random_page) { "bulk_#{rand(0..4)}" }
|
||||
|
@ -14,8 +14,9 @@ module QA
|
|||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
context 'Sidebar' do
|
||||
it 'has all expected links that work', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347814' do
|
||||
context 'with Wiki Sidebar' do
|
||||
it 'has all expected links that work',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347814' do
|
||||
small_wiki.visit!
|
||||
|
||||
small_number_of_pages.times do |index|
|
||||
|
@ -34,8 +35,9 @@ module QA
|
|||
end
|
||||
end
|
||||
|
||||
context 'Page List' do
|
||||
it 'has all expected links that work', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347813' do
|
||||
context 'with Wiki Page List' do
|
||||
it 'has all expected links that work',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347813' do
|
||||
large_wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_view_all_pages)
|
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Create' do
|
||||
describe 'Testing project wiki'
|
||||
let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
|
||||
|
||||
before do
|
||||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
it 'can delete a page',
|
||||
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347815' do
|
||||
initial_wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_edit)
|
||||
Page::Project::Wiki::Edit.perform(&:delete_page)
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_no_page
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,93 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Create' do
|
||||
context 'Wiki' do
|
||||
describe 'testing wiki content creation inside a project' do
|
||||
let(:new_wiki_title) { "just_another_wiki_page" }
|
||||
let(:new_wiki_content) { "this content is changed or added" }
|
||||
let(:commit_message) { "this is a new addition to the wiki" }
|
||||
|
||||
let(:project) { Resource::Project.fabricate_via_api! }
|
||||
let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
|
||||
|
||||
before do
|
||||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
it 'by adding a home page to the wiki', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do
|
||||
project.visit!
|
||||
|
||||
Page::Project::Menu.perform(&:click_wiki)
|
||||
Page::Project::Wiki::Show.perform(&:click_create_your_first_page)
|
||||
|
||||
Page::Project::Wiki::Edit.perform do |edit|
|
||||
edit.set_title new_wiki_title
|
||||
edit.set_content new_wiki_content
|
||||
edit.set_message commit_message
|
||||
end
|
||||
|
||||
Page::Project::Wiki::Edit.perform(&:click_submit)
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
|
||||
it 'by adding a second page to the wiki', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do
|
||||
wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_new_page)
|
||||
|
||||
Page::Project::Wiki::Edit.perform do |edit|
|
||||
edit.set_title new_wiki_title
|
||||
edit.set_content new_wiki_content
|
||||
edit.set_message commit_message
|
||||
end
|
||||
|
||||
Page::Project::Wiki::Edit.perform(&:click_submit)
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
|
||||
it 'by adding a home page to the wiki using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do
|
||||
empty_wiki = Resource::Wiki::ProjectPage.new do |empty_wiki|
|
||||
empty_wiki.project = project
|
||||
end
|
||||
|
||||
Resource::Repository::WikiPush.fabricate! do |push|
|
||||
push.file_name = "#{new_wiki_title}.md"
|
||||
push.file_content = new_wiki_content
|
||||
push.commit_message = commit_message
|
||||
push.wiki = empty_wiki
|
||||
push.new_branch = true
|
||||
end.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
|
||||
it 'by adding a second page to the wiki using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347807' do
|
||||
Resource::Repository::WikiPush.fabricate! do |push|
|
||||
push.file_name = "#{new_wiki_title}.md"
|
||||
push.file_content = new_wiki_content
|
||||
push.commit_message = commit_message
|
||||
push.wiki = wiki
|
||||
push.new_branch = false
|
||||
end.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,51 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Create' do
|
||||
context 'Wiki' do
|
||||
describe 'testing wiki content manipulation inside a project' do
|
||||
let(:new_wiki_title) { "just_another_wiki_page" }
|
||||
let(:new_wiki_content) { "this content is changed or added" }
|
||||
let(:commit_message) { "this is a new addition to the wiki" }
|
||||
|
||||
let(:wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
|
||||
|
||||
before do
|
||||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
it 'by manipulating content on the page', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347810' do
|
||||
wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_edit)
|
||||
|
||||
Page::Project::Wiki::Edit.perform do |edit|
|
||||
edit.set_title new_wiki_title
|
||||
edit.set_content new_wiki_content
|
||||
edit.set_message commit_message
|
||||
end
|
||||
|
||||
Page::Project::Wiki::Edit.perform(&:click_submit)
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_title new_wiki_title
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
|
||||
it 'by manipulating content on the page using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347811' do
|
||||
Resource::Repository::WikiPush.fabricate! do |push|
|
||||
push.file_content = new_wiki_content
|
||||
push.commit_message = commit_message
|
||||
push.wiki = wiki
|
||||
push.new_branch = false
|
||||
end.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_content new_wiki_content
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Create' do
|
||||
context 'Wiki' do
|
||||
let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! }
|
||||
|
||||
before do
|
||||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
context 'Page deletion' do
|
||||
it 'has removed the deleted page correctly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347815' do
|
||||
initial_wiki.visit!
|
||||
|
||||
Page::Project::Wiki::Show.perform(&:click_edit)
|
||||
Page::Project::Wiki::Edit.perform(&:delete_page)
|
||||
|
||||
Page::Project::Wiki::Show.perform do |wiki|
|
||||
expect(wiki).to have_no_page
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +1,7 @@
|
|||
/* Common setup for both unit and integration test environments */
|
||||
import * as jqueryMatchers from 'custom-jquery-matchers';
|
||||
import Vue from 'vue';
|
||||
import { enableAutoDestroy } from '@vue/test-utils';
|
||||
import 'jquery';
|
||||
import Translate from '~/vue_shared/translate';
|
||||
import setWindowLocation from './set_window_location_helper';
|
||||
|
@ -12,6 +13,8 @@ import './dom_shims';
|
|||
import './jquery';
|
||||
import '~/commons/bootstrap';
|
||||
|
||||
enableAutoDestroy(afterEach);
|
||||
|
||||
// This module has some fairly decent visual test coverage in it's own repository.
|
||||
jest.mock('@gitlab/favicon-overlay');
|
||||
jest.mock('~/lib/utils/axios_utils', () => jest.requireActual('helpers/mocks/axios_utils'));
|
||||
|
|
|
@ -140,11 +140,12 @@ describe('Vue test utils helpers', () => {
|
|||
const text = 'foo bar';
|
||||
const options = { selector: 'div' };
|
||||
const mockDiv = document.createElement('div');
|
||||
const mockVm = new Vue({ render: (h) => h('div') }).$mount();
|
||||
let mockVm;
|
||||
|
||||
let wrapper;
|
||||
beforeEach(() => {
|
||||
jest.spyOn(vtu, 'createWrapper');
|
||||
mockVm = new Vue({ render: (h) => h('div') }).$mount();
|
||||
|
||||
wrapper = extendedWrapper(
|
||||
shallowMount({
|
||||
|
|
|
@ -170,6 +170,14 @@ describe('Design overlay component', () => {
|
|||
});
|
||||
|
||||
it('should call an update active discussion mutation when clicking a note without moving it', async () => {
|
||||
createComponent({
|
||||
notes,
|
||||
dimensions: {
|
||||
width: 400,
|
||||
height: 400,
|
||||
},
|
||||
});
|
||||
|
||||
const note = notes[0];
|
||||
const { position } = note;
|
||||
const mutationVariables = {
|
||||
|
|
|
@ -2,13 +2,21 @@ import { mount } from '@vue/test-utils';
|
|||
import FileRowStats from '~/diffs/components/file_row_stats.vue';
|
||||
|
||||
describe('Diff file row stats', () => {
|
||||
const wrapper = mount(FileRowStats, {
|
||||
propsData: {
|
||||
file: {
|
||||
addedLines: 20,
|
||||
removedLines: 10,
|
||||
let wrapper;
|
||||
|
||||
const createComponent = () => {
|
||||
wrapper = mount(FileRowStats, {
|
||||
propsData: {
|
||||
file: {
|
||||
addedLines: 20,
|
||||
removedLines: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
createComponent();
|
||||
});
|
||||
|
||||
it('renders added lines count', () => {
|
||||
|
|
|
@ -2,14 +2,21 @@ import { shallowMount } from '@vue/test-utils';
|
|||
import RequestWarning from '~/performance_bar/components/request_warning.vue';
|
||||
|
||||
describe('request warning', () => {
|
||||
let wrapper;
|
||||
const htmlId = 'request-123';
|
||||
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
describe('when the request has warnings', () => {
|
||||
const wrapper = shallowMount(RequestWarning, {
|
||||
propsData: {
|
||||
htmlId,
|
||||
warnings: ['gitaly calls: 30 over 10', 'gitaly duration: 1500 over 1000'],
|
||||
},
|
||||
beforeEach(() => {
|
||||
wrapper = shallowMount(RequestWarning, {
|
||||
propsData: {
|
||||
htmlId,
|
||||
warnings: ['gitaly calls: 30 over 10', 'gitaly duration: 1500 over 1000'],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('adds a warning emoji with the correct ID', () => {
|
||||
|
@ -19,11 +26,13 @@ describe('request warning', () => {
|
|||
});
|
||||
|
||||
describe('when the request does not have warnings', () => {
|
||||
const wrapper = shallowMount(RequestWarning, {
|
||||
propsData: {
|
||||
htmlId,
|
||||
warnings: [],
|
||||
},
|
||||
beforeEach(() => {
|
||||
wrapper = shallowMount(RequestWarning, {
|
||||
propsData: {
|
||||
htmlId,
|
||||
warnings: [],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('does nothing', () => {
|
||||
|
|
|
@ -211,7 +211,7 @@ describe('Pipeline Wizard - Commit Page', () => {
|
|||
}) => {
|
||||
let consoleSpy;
|
||||
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
createComponent(
|
||||
{
|
||||
filename,
|
||||
|
@ -246,7 +246,7 @@ describe('Pipeline Wizard - Commit Page', () => {
|
|||
await waitForPromises();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
|
|
|
@ -3,12 +3,20 @@ import { Document } from 'yaml';
|
|||
import YamlEditor from '~/pipeline_wizard/components/editor.vue';
|
||||
|
||||
describe('Pages Yaml Editor wrapper', () => {
|
||||
let wrapper;
|
||||
|
||||
const defaultOptions = {
|
||||
propsData: { doc: new Document({ foo: 'bar' }), filename: 'foo.yml' },
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
describe('mount hook', () => {
|
||||
const wrapper = mount(YamlEditor, defaultOptions);
|
||||
beforeEach(() => {
|
||||
wrapper = mount(YamlEditor, defaultOptions);
|
||||
});
|
||||
|
||||
it('editor is mounted', () => {
|
||||
expect(wrapper.vm.editor).not.toBeUndefined();
|
||||
|
@ -19,16 +27,11 @@ describe('Pages Yaml Editor wrapper', () => {
|
|||
describe('watchers', () => {
|
||||
describe('doc', () => {
|
||||
const doc = new Document({ baz: ['bar'] });
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(YamlEditor, defaultOptions);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it("causes the editor's value to be set to the stringified document", async () => {
|
||||
await wrapper.setProps({ doc });
|
||||
expect(wrapper.vm.editor.getValue()).toEqual(doc.toString());
|
||||
|
@ -48,7 +51,10 @@ describe('Pages Yaml Editor wrapper', () => {
|
|||
|
||||
describe('highlight', () => {
|
||||
const highlight = 'foo';
|
||||
const wrapper = mount(YamlEditor, defaultOptions);
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(YamlEditor, defaultOptions);
|
||||
});
|
||||
|
||||
it('calls editor.highlight(path, keep=true)', async () => {
|
||||
const highlightSpy = jest.spyOn(wrapper.vm.yamlEditorExtension.obj, 'highlight');
|
||||
|
|
|
@ -132,7 +132,7 @@ describe('Pipeline Wizard - wrapper.vue', () => {
|
|||
expectStepDef,
|
||||
expectProgressBarValue,
|
||||
}) => {
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
createComponent();
|
||||
|
||||
for (const emittedValue of navigationEventChain) {
|
||||
|
@ -145,7 +145,7 @@ describe('Pipeline Wizard - wrapper.vue', () => {
|
|||
}
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
|
@ -184,11 +184,11 @@ describe('Pipeline Wizard - wrapper.vue', () => {
|
|||
});
|
||||
|
||||
describe('editor overlay', () => {
|
||||
beforeAll(() => {
|
||||
beforeEach(() => {
|
||||
createComponent();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
|
@ -236,11 +236,11 @@ describe('Pipeline Wizard - wrapper.vue', () => {
|
|||
});
|
||||
|
||||
describe('line highlights', () => {
|
||||
beforeAll(() => {
|
||||
beforeEach(() => {
|
||||
createComponent();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
|
@ -266,7 +266,7 @@ describe('Pipeline Wizard - wrapper.vue', () => {
|
|||
});
|
||||
|
||||
describe('integration test', () => {
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
createComponent({}, mountExtended);
|
||||
});
|
||||
|
||||
|
@ -290,14 +290,25 @@ describe('Pipeline Wizard - wrapper.vue', () => {
|
|||
describe('navigating back', () => {
|
||||
let inputField;
|
||||
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
createComponent({}, mountExtended);
|
||||
|
||||
findFirstInputFieldForTarget('$FOO').setValue('fooVal');
|
||||
await nextTick();
|
||||
|
||||
findFirstVisibleStep().vm.$emit('next');
|
||||
await nextTick();
|
||||
|
||||
findFirstInputFieldForTarget('$BAR').setValue('barVal');
|
||||
await nextTick();
|
||||
|
||||
findFirstVisibleStep().vm.$emit('back');
|
||||
await nextTick();
|
||||
|
||||
inputField = findFirstInputFieldForTarget('$FOO');
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
inputField = undefined;
|
||||
});
|
||||
|
|
|
@ -62,8 +62,7 @@ export const steps = `
|
|||
export const compiledScenario1 = `foo: fooVal
|
||||
`;
|
||||
|
||||
export const compiledScenario2 = `foo: fooVal
|
||||
bar: barVal
|
||||
export const compiledScenario2 = `bar: barVal
|
||||
`;
|
||||
|
||||
export const compiledScenario3 = `foo: newFooVal
|
||||
|
|
|
@ -29,6 +29,8 @@ describe('RunnerStackedLayoutBanner', () => {
|
|||
});
|
||||
|
||||
it('Does not display a banner when dismissed', async () => {
|
||||
createComponent();
|
||||
|
||||
findLocalStorageSync().vm.$emit('input', true);
|
||||
|
||||
await nextTick();
|
||||
|
|
|
@ -127,6 +127,8 @@ describe('SetStatusForm', () => {
|
|||
|
||||
describe('when `Clear status after` dropdown is changed', () => {
|
||||
it('emits `clear-status-after-click`', async () => {
|
||||
await createComponent();
|
||||
|
||||
await wrapper.findByTestId('thirtyMinutes').trigger('click');
|
||||
|
||||
expect(wrapper.emitted('clear-status-after-click')).toEqual([[timeRanges[0]]]);
|
||||
|
|
|
@ -1004,7 +1004,7 @@ describe('MrWidgetOptions', () => {
|
|||
|
||||
await createComponent();
|
||||
|
||||
expect(pollRequest).toHaveBeenCalledTimes(4);
|
||||
expect(pollRequest).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1042,7 +1042,7 @@ describe('MrWidgetOptions', () => {
|
|||
registerExtension(pollingErrorExtension);
|
||||
await createComponent();
|
||||
|
||||
expect(pollRequest).toHaveBeenCalledTimes(4);
|
||||
expect(pollRequest).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('captures sentry error and displays error when poll has failed', async () => {
|
||||
|
|
|
@ -106,11 +106,11 @@ describe('Diff Stats Dropdown', () => {
|
|||
expectedAddedDeletedExpanded,
|
||||
expectedAddedDeletedCollapsed,
|
||||
}) => {
|
||||
beforeAll(() => {
|
||||
beforeEach(() => {
|
||||
createComponent({ changed, added, deleted });
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ RSpec.describe Gitlab::GithubImport::Importer::IssueImporter, :clean_gitlab_redi
|
|||
.to receive(:insert_and_return_id)
|
||||
.with(
|
||||
{
|
||||
iid: 42,
|
||||
iid: 1,
|
||||
title: 'My Issue',
|
||||
author_id: user.id,
|
||||
project_id: project.id,
|
||||
|
@ -172,7 +172,7 @@ RSpec.describe Gitlab::GithubImport::Importer::IssueImporter, :clean_gitlab_redi
|
|||
.to receive(:insert_and_return_id)
|
||||
.with(
|
||||
{
|
||||
iid: 42,
|
||||
iid: 1,
|
||||
title: 'My Issue',
|
||||
author_id: project.creator_id,
|
||||
project_id: project.id,
|
||||
|
|
Loading…
Reference in a new issue