Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2019-11-19 00:06:28 +00:00
parent aaf124b0f7
commit 8d0aed5e4a
10 changed files with 45 additions and 48 deletions

View file

@ -4,7 +4,7 @@ type: reference, how-to
# Sourcegraph integration # Sourcegraph integration
> [Introduced](https://gitlab.com/gitlab-org/gitlab/merge_requests/16556) in GitLab 12.5. Please note that this integration is [behind a feature flag](#enable-the-sourcegraph-feature-flag). > [Introduced](https://gitlab.com/gitlab-org/gitlab/merge_requests/16556) in GitLab 12.5. Please note that this integration is in BETA and [behind a feature flag](#enable-the-sourcegraph-feature-flag).
[Sourcegraph](https://sourcegraph.com) provides code intelligence features, natively integrated into the GitLab UI. [Sourcegraph](https://sourcegraph.com) provides code intelligence features, natively integrated into the GitLab UI.
@ -12,6 +12,9 @@ For GitLab.com users, see [Sourcegraph for GitLab.com](#sourcegraph-for-gitlabco
![Sourcegraph demo](img/sourcegraph_demo_v12_5.png) ![Sourcegraph demo](img/sourcegraph_demo_v12_5.png)
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
For an overview, watch the video [Sourcegraph's new GitLab native integration](https://www.youtube.com/watch?v=LjVxkt4_sEA).
NOTE: **Note:** NOTE: **Note:**
This feature requires user opt-in. After Sourcegraph has been enabled for your GitLab instance, This feature requires user opt-in. After Sourcegraph has been enabled for your GitLab instance,
you can choose to enable Sourcegraph [through your user preferences](#enable-sourcegraph-in-user-preferences). you can choose to enable Sourcegraph [through your user preferences](#enable-sourcegraph-in-user-preferences).
@ -103,12 +106,18 @@ When visiting one of these views, you can now hover over a code reference to see
## Sourcegraph for GitLab.com ## Sourcegraph for GitLab.com
Sourcegraph powered code intelligence will be incrementally rolled out on GitLab.com. It will eventually be Sourcegraph powered code intelligence will be incrementally rolled out on GitLab.com.
available for all public projects, but for now, it is only available for some specific [`gitlab-org` projects](https://gitlab.com/gitlab-org/). It will eventually become available for all public projects, but for now, it is only
available for some specific [`gitlab-org` projects](https://gitlab.com/gitlab-org/).
This means that you can see it working and use it to dig into the code of these projects,
but you cannot use it on your own project on GitLab.com yet.
If you have a private or internal project and would like integrated code intelligence, please consider If you would like to use it in your own projects as of GitLab 12.5, you can do so by
setting up a self-managed GitLab instance. setting up a self-managed GitLab instance.
Follow the epic [&2201](https://gitlab.com/groups/gitlab-org/-/epics/2201) for
updates.
## Sourcegraph and Privacy ## Sourcegraph and Privacy
From Sourcegraph's [extension documentation](https://docs.sourcegraph.com/integration/browser_extension#privacy) which is the From Sourcegraph's [extension documentation](https://docs.sourcegraph.com/integration/browser_extension#privacy) which is the

View file

@ -29,6 +29,10 @@ module QA
def sign_in_as_admin def sign_in_as_admin
sign_in(as: Runtime::User.admin) sign_in(as: Runtime::User.admin)
end end
def sign_in_unless_signed_in(as: nil)
sign_in(as: as) unless Page::Main::Menu.perform(&:signed_in?)
end
end end
end end
end end

View file

@ -8,7 +8,10 @@ module QA
attr_accessor :path, :description attr_accessor :path, :description
attribute :sandbox do attribute :sandbox do
Sandbox.fabricate! Sandbox.fabricate_via_api! do |sandbox|
sandbox.user = user
sandbox.api_client = api_client
end
end end
attribute :id attribute :id

View file

@ -26,8 +26,6 @@ module QA
end end
attribute :target do attribute :target do
project.visit!
Repository::ProjectPush.fabricate! do |resource| Repository::ProjectPush.fabricate! do |resource|
resource.project = project resource.project = project
resource.branch_name = 'master' resource.branch_name = 'master'

View file

@ -46,19 +46,24 @@ module QA
end end
def create_personal_access_token def create_personal_access_token
Page::Main::Menu.perform(&:sign_out) if @is_new_session && Page::Main::Menu.perform { |p| p.has_personal_area?(wait: 0) } signed_in_initially = Page::Main::Menu.perform(&:signed_in?)
unless Page::Main::Menu.perform { |p| p.has_personal_area?(wait: 0) } Page::Main::Menu.perform(&:sign_out) if @is_new_session && signed_in_initially
Runtime::Browser.visit(@address, Page::Main::Login)
Page::Main::Login.perform { |login| login.sign_in_using_credentials(user: @user) } Flow::Login.sign_in_unless_signed_in(as: @user)
end
token = Resource::PersonalAccessToken.fabricate!.access_token token = Resource::PersonalAccessToken.fabricate!.access_token
# If this is a new session, that tests that follow could fail if they # If this is a new session, that tests that follow could fail if they
# try to sign in without starting a new session # try to sign in without starting a new session.
# Also, if the browser wasn't already signed in, leaving it
# signed in could cause tests to fail when they try to sign
# in again. For example, that would happen if a test has a
# before(:context) block that fabricates via the API, and
# it's the first test to run so it creates an access token
#
# Sign out so the tests can successfully sign in # Sign out so the tests can successfully sign in
Page::Main::Menu.perform(&:sign_out) if @is_new_session Page::Main::Menu.perform(&:sign_out) if @is_new_session || !signed_in_initially
token token
end end

View file

@ -4,9 +4,6 @@ module QA
context 'Create' do context 'Create' do
describe 'Download merge request patch and diff' do describe 'Download merge request patch and diff' do
before(:context) do before(:context) do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
project = Resource::Project.fabricate_via_api! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.name = 'project' project.name = 'project'
end end
@ -19,6 +16,8 @@ module QA
end end
it 'views the merge request email patches' do it 'views the merge request email patches' do
Flow::Login.sign_in
@merge_request.visit! @merge_request.visit!
Page::MergeRequest::Show.perform(&:view_email_patches) Page::MergeRequest::Show.perform(&:view_email_patches)
@ -28,6 +27,8 @@ module QA
end end
it 'views the merge request plain diff' do it 'views the merge request plain diff' do
Flow::Login.sign_in
@merge_request.visit! @merge_request.visit!
Page::MergeRequest::Show.perform(&:view_plain_diff) Page::MergeRequest::Show.perform(&:view_plain_diff)

View file

@ -6,23 +6,12 @@ module QA
describe 'File templates' do describe 'File templates' do
include Runtime::Fixtures include Runtime::Fixtures
def login
unless Page::Main::Menu.perform(&:signed_in?)
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
end
end
before(:all) do before(:all) do
login @project = Resource::Project.fabricate_via_api! do |project|
@project = Resource::Project.fabricate! do |project|
project.name = 'file-template-project' project.name = 'file-template-project'
project.description = 'Add file templates via the Files view' project.description = 'Add file templates via the Files view'
project.initialize_with_readme = true project.initialize_with_readme = true
end end
Page::Main::Menu.perform(&:sign_out)
end end
templates = [ templates = [
@ -56,7 +45,8 @@ module QA
it "user adds #{template[:file_name]} via file template #{template[:name]}" do it "user adds #{template[:file_name]} via file template #{template[:name]}" do
content = fetch_template_from_api(template[:api_path], template[:api_key]) content = fetch_template_from_api(template[:api_path], template[:api_key])
login Flow::Login.sign_in
@project.visit! @project.visit!
Page::Project::Show.perform(&:create_new_file!) Page::Project::Show.perform(&:create_new_file!)

View file

@ -4,14 +4,10 @@ module QA
context 'Create' do context 'Create' do
describe 'Git clone over HTTP', :ldap_no_tls do describe 'Git clone over HTTP', :ldap_no_tls do
before(:all) do before(:all) do
Runtime::Browser.visit(:gitlab, Page::Main::Login) @project = Resource::Project.fabricate_via_api! do |scenario|
Page::Main::Login.perform(&:sign_in_using_credentials)
@project = Resource::Project.fabricate! do |scenario|
scenario.name = 'project-with-code' scenario.name = 'project-with-code'
scenario.description = 'project for git clone tests' scenario.description = 'project for git clone tests'
end end
@project.visit!
Git::Repository.perform do |repository| Git::Repository.perform do |repository|
repository.uri = @project.repository_http_location.uri repository.uri = @project.repository_http_location.uri

View file

@ -31,8 +31,7 @@ module QA
end end
def view_commit def view_commit
Runtime::Browser.visit(:gitlab, Page::Main::Login) Flow::Login.sign_in
Page::Main::Login.perform(&:sign_in_using_credentials)
@project.visit! @project.visit!
Page::Project::Show.perform do |show| Page::Project::Show.perform do |show|

View file

@ -6,21 +6,12 @@ module QA
describe 'Web IDE file templates' do describe 'Web IDE file templates' do
include Runtime::Fixtures include Runtime::Fixtures
def login
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
end
before(:all) do before(:all) do
login @project = Resource::Project.fabricate_via_api! do |project|
@project = Resource::Project.fabricate! do |project|
project.name = 'file-template-project' project.name = 'file-template-project'
project.description = 'Add file templates via the Web IDE' project.description = 'Add file templates via the Web IDE'
project.initialize_with_readme = true project.initialize_with_readme = true
end end
Page::Main::Menu.perform(&:sign_out)
end end
templates = [ templates = [
@ -54,7 +45,8 @@ module QA
it "user adds #{template[:file_name]} via file template #{template[:name]}" do it "user adds #{template[:file_name]} via file template #{template[:name]}" do
content = fetch_template_from_api(template[:api_path], template[:api_key]) content = fetch_template_from_api(template[:api_path], template[:api_key])
login Flow::Login.sign_in
@project.visit! @project.visit!
Page::Project::Show.perform(&:open_web_ide!) Page::Project::Show.perform(&:open_web_ide!)