Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-08-21 12:12:23 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-08-21 12:12:23 +0300
commit6232c26ac7aa279f7082ceb04b16e42673196475 (patch)
tree04ec906c8f55528e4735be86de76da4f3c1fd520 /qa
parent00aa4d4c8c57a2f305070c2f9cb86fde6bc14285 (diff)
parentcc0bf2f6231a3c231450a7ef8f272de9f9591eaa (diff)
Merge branch 'master' into sh-add-object-storage-qa
* master: (31 commits)
Diffstat (limited to 'qa')
-rw-r--r--qa/README.md12
-rw-r--r--qa/qa.rb6
-rw-r--r--qa/qa/factory/resource/fork.rb7
-rw-r--r--qa/qa/factory/resource/user.rb48
-rw-r--r--qa/qa/git/repository.rb2
-rw-r--r--qa/qa/page/main/login.rb25
-rw-r--r--qa/qa/page/main/sign_up.rb12
-rw-r--r--qa/qa/page/project/settings/secret_variables.rb8
-rw-r--r--qa/qa/runtime/env.rb12
-rw-r--r--qa/qa/runtime/user.rb6
-rw-r--r--qa/qa/scenario/taggable.rb17
-rw-r--r--qa/qa/scenario/template.rb33
-rw-r--r--qa/qa/scenario/test/instance.rb36
-rw-r--r--qa/qa/scenario/test/instance/all.rb15
-rw-r--r--qa/qa/scenario/test/instance/smoke.rb17
-rw-r--r--qa/qa/specs/features/api/basics_spec.rb4
-rw-r--r--qa/qa/specs/features/api/users_spec.rb6
-rw-r--r--qa/qa/specs/features/login/basic_spec.rb15
-rw-r--r--qa/qa/specs/features/login/ldap_spec.rb2
-rw-r--r--qa/qa/specs/features/mattermost/group_create_spec.rb2
-rw-r--r--qa/qa/specs/features/mattermost/login_spec.rb2
-rw-r--r--qa/qa/specs/features/merge_request/create_spec.rb23
-rw-r--r--qa/qa/specs/features/merge_request/rebase_spec.rb2
-rw-r--r--qa/qa/specs/features/merge_request/squash_spec.rb2
-rw-r--r--qa/qa/specs/features/project/activity_spec.rb2
-rw-r--r--qa/qa/specs/features/project/add_deploy_key_spec.rb2
-rw-r--r--qa/qa/specs/features/project/add_secret_variable_spec.rb2
-rw-r--r--qa/qa/specs/features/project/auto_devops_spec.rb9
-rw-r--r--qa/qa/specs/features/project/create_issue_spec.rb2
-rw-r--r--qa/qa/specs/features/project/create_spec.rb2
-rw-r--r--qa/qa/specs/features/project/deploy_key_clone_spec.rb2
-rw-r--r--qa/qa/specs/features/project/fork_project_spec.rb12
-rw-r--r--qa/qa/specs/features/project/import_from_github_spec.rb2
-rw-r--r--qa/qa/specs/features/project/pipelines_spec.rb2
-rw-r--r--qa/qa/specs/features/project/wikis_spec.rb2
-rw-r--r--qa/qa/specs/features/repository/clone_spec.rb2
-rw-r--r--qa/qa/specs/features/repository/protected_branches_spec.rb2
-rw-r--r--qa/qa/specs/features/repository/push_spec.rb2
-rw-r--r--qa/qa/specs/runner.rb8
-rw-r--r--qa/spec/runtime/env_spec.rb25
-rw-r--r--qa/spec/scenario/test/instance/all_spec.rb (renamed from qa/spec/scenario/test/instance_spec.rb)14
-rw-r--r--qa/spec/scenario/test/instance/smoke_spec.rb45
42 files changed, 311 insertions, 140 deletions
diff --git a/qa/README.md b/qa/README.md
index be4cf89ebbc..f8a5c00efd4 100644
--- a/qa/README.md
+++ b/qa/README.md
@@ -35,7 +35,7 @@ following call would login to a local [GDK] instance and run all specs in
`qa/specs/features`:
```
-bin/qa Test::Instance http://localhost:3000
+bin/qa Test::Instance::All http://localhost:3000
```
### Writing tests
@@ -48,14 +48,14 @@ You can also supply specific tests to run as another parameter. For example, to
run the repository-related specs, you can execute:
```
-bin/qa Test::Instance http://localhost qa/specs/features/repository/
+bin/qa Test::Instance::All http://localhost qa/specs/features/repository/
```
Since the arguments would be passed to `rspec`, you could use all `rspec`
options there. For example, passing `--backtrace` and also line number:
```
-bin/qa Test::Instance http://localhost qa/specs/features/project/create_spec.rb:3 --backtrace
+bin/qa Test::Instance::All http://localhost qa/specs/features/project/create_spec.rb:3 --backtrace
```
### Overriding the authenticated user
@@ -67,7 +67,7 @@ If you need to authenticate as a different user, you can provide the
`GITLAB_USERNAME` and `GITLAB_PASSWORD` environment variables:
```
-GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password bin/qa Test::Instance https://gitlab.example.com
+GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password bin/qa Test::Instance::All https://gitlab.example.com
```
If your user doesn't have permission to default sandbox group
@@ -75,13 +75,13 @@ If your user doesn't have permission to default sandbox group
`GITLAB_SANDBOX_NAME`:
```
-GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sandbox bin/qa Test::Instance https://gitlab.example.com
+GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sandbox bin/qa Test::Instance::All https://gitlab.example.com
```
In addition, the `GITLAB_USER_TYPE` can be set to "ldap" to sign in as an LDAP user:
```
-GITLAB_USER_TYPE=ldap GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sandbox bin/qa Test::Instance https://gitlab.example.com
+GITLAB_USER_TYPE=ldap GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sandbox bin/qa Test::Instance::All https://gitlab.example.com
```
All [supported environment variables are here](https://gitlab.com/gitlab-org/gitlab-qa#supported-environment-variables).
diff --git a/qa/qa.rb b/qa/qa.rb
index 80cfd142a40..90461b16dd4 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -77,14 +77,16 @@ module QA
#
autoload :Bootable, 'qa/scenario/bootable'
autoload :Actable, 'qa/scenario/actable'
- autoload :Taggable, 'qa/scenario/taggable'
autoload :Template, 'qa/scenario/template'
##
# Test scenario entrypoints.
#
module Test
- autoload :Instance, 'qa/scenario/test/instance'
+ module Instance
+ autoload :All, 'qa/scenario/test/instance/all'
+ autoload :Smoke, 'qa/scenario/test/instance/smoke'
+ end
module Integration
autoload :Github, 'qa/scenario/test/integration/github'
diff --git a/qa/qa/factory/resource/fork.rb b/qa/qa/factory/resource/fork.rb
index 1d0c76a3d30..01969c31438 100644
--- a/qa/qa/factory/resource/fork.rb
+++ b/qa/qa/factory/resource/fork.rb
@@ -4,7 +4,12 @@ module QA
class Fork < Factory::Base
dependency Factory::Repository::ProjectPush, as: :push
- dependency Factory::Resource::User, as: :user
+ dependency Factory::Resource::User, as: :user do |user|
+ if Runtime::Env.forker?
+ user.username = Runtime::Env.forker_username
+ user.password = Runtime::Env.forker_password
+ end
+ end
product(:user) { |factory| factory.user }
diff --git a/qa/qa/factory/resource/user.rb b/qa/qa/factory/resource/user.rb
index e08df9e0cd0..eac2a873bd5 100644
--- a/qa/qa/factory/resource/user.rb
+++ b/qa/qa/factory/resource/user.rb
@@ -4,28 +4,52 @@ module QA
module Factory
module Resource
class User < Factory::Base
- attr_accessor :name, :username, :email, :password
+ attr_reader :unique_id
+ attr_writer :username, :password, :name, :email
def initialize
- @name = "name-#{SecureRandom.hex(8)}"
- @username = "username-#{SecureRandom.hex(8)}"
- @email = "mail#{SecureRandom.hex(8)}@mail.com"
- @password = 'password'
+ @unique_id = SecureRandom.hex(8)
end
- product(:name) { |factory| factory.name }
+ def username
+ @username ||= "qa-user-#{unique_id}"
+ end
- product(:username) { |factory| factory.username }
+ def password
+ @password ||= 'password'
+ end
- product(:email) { |factory| factory.email }
+ def name
+ @name ||= username
+ end
+
+ def email
+ @email ||= "#{username}@example.com"
+ end
+
+ def credentials_given?
+ defined?(@username) && defined?(@password)
+ end
+ product(:name) { |factory| factory.name }
+ product(:username) { |factory| factory.username }
+ product(:email) { |factory| factory.email }
product(:password) { |factory| factory.password }
def fabricate!
- Page::Menu::Main.act { sign_out }
- Page::Main::Login.act { switch_to_register_tab }
- Page::Main::SignUp.perform do |page|
- page.sign_up!(name: name, username: username, email: email, password: password)
+ Page::Menu::Main.perform { |main| main.sign_out }
+
+ if credentials_given?
+ Page::Main::Login.perform do |login|
+ login.sign_in_using_credentials(self)
+ end
+ else
+ Page::Main::Login.perform do |login|
+ login.switch_to_register_tab
+ end
+ Page::Main::SignUp.perform do |signup|
+ signup.sign_up!(self)
+ end
end
end
end
diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb
index 3df6db05970..bdbb18b5045 100644
--- a/qa/qa/git/repository.rb
+++ b/qa/qa/git/repository.rb
@@ -28,7 +28,7 @@ module QA
end
def use_default_credentials
- self.username = Runtime::User.name
+ self.username = Runtime::User.username
self.password = Runtime::User.password
end
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index 6cdfbd1c125..afc8b66d878 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -40,17 +40,19 @@ module QA
end
end
- def sign_in_using_credentials
+ def sign_in_using_credentials(user = nil)
# Don't try to log-in if we're already logged-in
return if Page::Menu::Main.act { has_personal_area?(wait: 0) }
using_wait_time 0 do
set_initial_password_if_present
+ raise NotImplementedError if Runtime::User.ldap_user? && user&.credentials_given?
+
if Runtime::User.ldap_user?
sign_in_using_ldap_credentials
else
- sign_in_using_gitlab_credentials
+ sign_in_using_gitlab_credentials(user || Runtime::User)
end
end
@@ -69,21 +71,30 @@ module QA
click_on 'Register'
end
+ def switch_to_ldap_tab
+ click_on 'LDAP'
+ end
+
+ def switch_to_standard_tab
+ click_on 'Standard'
+ end
+
private
def sign_in_using_ldap_credentials
- click_link 'LDAP'
+ switch_to_ldap_tab
fill_in :username, with: Runtime::User.ldap_username
fill_in :password, with: Runtime::User.ldap_password
click_button 'Sign in'
end
- def sign_in_using_gitlab_credentials
- click_link 'Standard' if page.has_content?('LDAP')
+ def sign_in_using_gitlab_credentials(user)
+ switch_to_sign_in_tab unless page.has_button?('Sign in')
+ switch_to_standard_tab if page.has_content?('LDAP')
- fill_in :user_login, with: Runtime::User.name
- fill_in :user_password, with: Runtime::User.password
+ fill_in :user_login, with: user.username
+ fill_in :user_password, with: user.password
click_button 'Sign in'
end
diff --git a/qa/qa/page/main/sign_up.rb b/qa/qa/page/main/sign_up.rb
index 9a834e94b81..33ab56236f4 100644
--- a/qa/qa/page/main/sign_up.rb
+++ b/qa/qa/page/main/sign_up.rb
@@ -11,12 +11,12 @@ module QA
element :register_button, 'submit "Register"'
end
- def sign_up!(name:, username:, email:, password:)
- fill_in :new_user_name, with: name
- fill_in :new_user_username, with: username
- fill_in :new_user_email, with: email
- fill_in :new_user_email_confirmation, with: email
- fill_in :new_user_password, with: password
+ def sign_up!(user)
+ fill_in :new_user_name, with: user.name
+ fill_in :new_user_username, with: user.username
+ fill_in :new_user_email, with: user.email
+ fill_in :new_user_email_confirmation, with: user.email
+ fill_in :new_user_password, with: user.password
click_button 'Register'
Page::Menu::Main.act { has_personal_area? }
diff --git a/qa/qa/page/project/settings/secret_variables.rb b/qa/qa/page/project/settings/secret_variables.rb
index d2f5d5a9060..937ae6797c8 100644
--- a/qa/qa/page/project/settings/secret_variables.rb
+++ b/qa/qa/page/project/settings/secret_variables.rb
@@ -23,7 +23,13 @@ module QA
# After we fill the key, JS would generate another field so
# we need to use the same index to find the corresponding one.
keys[index].set(key)
- all_elements(:ci_variable_input_value)[index].set(value)
+ node = all_elements(:ci_variable_input_value)[index]
+
+ # Simply run `node.set(value)` is too slow for long text here,
+ # so we need to run JavaScript directly to set the value.
+ # The code was inspired from:
+ # https://github.com/teamcapybara/capybara/blob/679548cea10773d45e32808f4d964377cfe5e892/lib/capybara/selenium/node.rb#L217
+ execute_script("arguments[0].value = #{value.to_json}", node)
end
def save_variables
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index 5dc194e0aef..841c959045f 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -39,6 +39,18 @@ module QA
ENV['GITLAB_PASSWORD']
end
+ def forker?
+ forker_username && forker_password
+ end
+
+ def forker_username
+ ENV['GITLAB_FORKER_USERNAME']
+ end
+
+ def forker_password
+ ENV['GITLAB_FORKER_PASSWORD']
+ end
+
def ldap_username
ENV['GITLAB_LDAP_USERNAME']
end
diff --git a/qa/qa/runtime/user.rb b/qa/qa/runtime/user.rb
index c80ee6d4d96..b016777c987 100644
--- a/qa/qa/runtime/user.rb
+++ b/qa/qa/runtime/user.rb
@@ -3,12 +3,12 @@ module QA
module User
extend self
- def default_name
+ def default_username
'root'
end
- def name
- Runtime::Env.user_username || default_name
+ def username
+ Runtime::Env.user_username || default_username
end
def password
diff --git a/qa/qa/scenario/taggable.rb b/qa/qa/scenario/taggable.rb
deleted file mode 100644
index b1f24d742e0..00000000000
--- a/qa/qa/scenario/taggable.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-module QA
- module Scenario
- module Taggable
- # rubocop:disable Gitlab/ModuleWithInstanceVariables
-
- def tags(*tags)
- @tags = tags
- end
-
- def focus
- @tags.to_a
- end
-
- # rubocop:enable Gitlab/ModuleWithInstanceVariables
- end
- end
-end
diff --git a/qa/qa/scenario/template.rb b/qa/qa/scenario/template.rb
index d21a9d52997..66eb86f25c8 100644
--- a/qa/qa/scenario/template.rb
+++ b/qa/qa/scenario/template.rb
@@ -1,15 +1,36 @@
module QA
module Scenario
class Template
- def self.perform(*args)
- new.tap do |scenario|
- yield scenario if block_given?
- break scenario.perform(*args)
+ class << self
+ def perform(*args)
+ new.tap do |scenario|
+ yield scenario if block_given?
+ break scenario.perform(*args)
+ end
+ end
+
+ def tags(*tags)
+ @tags = tags
+ end
+
+ def focus
+ @tags.to_a
end
end
- def perform(*_args)
- raise NotImplementedError
+ def perform(address, *rspec_options)
+ Runtime::Scenario.define(:gitlab_address, address)
+
+ Specs::Runner.perform do |specs|
+ specs.tty = true
+ specs.tags = self.class.focus
+ specs.options =
+ if rspec_options.any?
+ rspec_options
+ else
+ ::File.expand_path('../specs/features', __dir__)
+ end
+ end
end
end
end
diff --git a/qa/qa/scenario/test/instance.rb b/qa/qa/scenario/test/instance.rb
deleted file mode 100644
index 46eb2dabb11..00000000000
--- a/qa/qa/scenario/test/instance.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-module QA
- module Scenario
- module Test
- ##
- # Base class for running the suite against any GitLab instance,
- # including staging and on-premises installation.
- #
- class Instance < Template
- include Bootable
- extend Taggable
-
- tags :core
-
- def perform(address, *rspec_options)
- Runtime::Scenario.define(:gitlab_address, address)
-
- ##
- # Perform before hooks, which are different for CE and EE
- #
- Runtime::Release.perform_before_hooks
-
- Specs::Runner.perform do |specs|
- specs.tty = true
- specs.tags = self.class.focus
- specs.options =
- if rspec_options.any?
- rspec_options
- else
- ::File.expand_path('../../specs/features', __dir__)
- end
- end
- end
- end
- end
- end
-end
diff --git a/qa/qa/scenario/test/instance/all.rb b/qa/qa/scenario/test/instance/all.rb
new file mode 100644
index 00000000000..a07c26431bd
--- /dev/null
+++ b/qa/qa/scenario/test/instance/all.rb
@@ -0,0 +1,15 @@
+module QA
+ module Scenario
+ module Test
+ ##
+ # Base class for running the suite against any GitLab instance,
+ # including staging and on-premises installation.
+ #
+ module Instance
+ class All < Template
+ include Bootable
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/scenario/test/instance/smoke.rb b/qa/qa/scenario/test/instance/smoke.rb
new file mode 100644
index 00000000000..a7d2cb27f27
--- /dev/null
+++ b/qa/qa/scenario/test/instance/smoke.rb
@@ -0,0 +1,17 @@
+module QA
+ module Scenario
+ module Test
+ module Instance
+ ##
+ # Base class for running the suite against any GitLab instance,
+ # including staging and on-premises installation.
+ #
+ class Smoke < Template
+ include Bootable
+
+ tags :smoke
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/specs/features/api/basics_spec.rb b/qa/qa/specs/features/api/basics_spec.rb
index 6563b56d1b4..bc0b5ebfe10 100644
--- a/qa/qa/specs/features/api/basics_spec.rb
+++ b/qa/qa/specs/features/api/basics_spec.rb
@@ -1,13 +1,13 @@
require 'securerandom'
module QA
- describe 'API basics', :core do
+ describe 'API basics' do
before(:context) do
@api_client = Runtime::API::Client.new(:gitlab)
end
let(:project_name) { "api-basics-#{SecureRandom.hex(8)}" }
- let(:sanitized_project_path) { CGI.escape("#{Runtime::User.name}/#{project_name}") }
+ let(:sanitized_project_path) { CGI.escape("#{Runtime::User.username}/#{project_name}") }
it 'user creates a project with a file and deletes them afterwards' do
create_project_request = Runtime::API::Request.new(@api_client, '/projects')
diff --git a/qa/qa/specs/features/api/users_spec.rb b/qa/qa/specs/features/api/users_spec.rb
index 8a63d8095c9..3d25cca1e59 100644
--- a/qa/qa/specs/features/api/users_spec.rb
+++ b/qa/qa/specs/features/api/users_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'API users', :core do
+ describe 'API users' do
before(:context) do
@api_client = Runtime::API::Client.new(:gitlab)
end
@@ -14,11 +14,11 @@ module QA
end
it 'submit request with a valid user name' do
- get request.url, { params: { username: Runtime::User.name } }
+ get request.url, { params: { username: Runtime::User.username } }
expect_status(200)
expect(json_body).to contain_exactly(
- a_hash_including(username: Runtime::User.name)
+ a_hash_including(username: Runtime::User.username)
)
end
diff --git a/qa/qa/specs/features/login/basic_spec.rb b/qa/qa/specs/features/login/basic_spec.rb
new file mode 100644
index 00000000000..f866466c7bf
--- /dev/null
+++ b/qa/qa/specs/features/login/basic_spec.rb
@@ -0,0 +1,15 @@
+module QA
+ describe 'basic user login', :smoke do
+ it 'user logs in using basic credentials' do
+ Runtime::Browser.visit(:gitlab, Page::Main::Login)
+ Page::Main::Login.act { sign_in_using_credentials }
+
+ # TODO, since `Signed in successfully` message was removed
+ # this is the only way to tell if user is signed in correctly.
+ #
+ Page::Menu::Main.perform do |menu|
+ expect(menu).to have_personal_area
+ end
+ end
+ end
+end
diff --git a/qa/qa/specs/features/login/ldap_spec.rb b/qa/qa/specs/features/login/ldap_spec.rb
index b7a284c584b..de6111eea64 100644
--- a/qa/qa/specs/features/login/ldap_spec.rb
+++ b/qa/qa/specs/features/login/ldap_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'LDAP user login', :ldap do
+ describe 'LDAP user login', :orchestrated, :ldap do
before do
Runtime::Env.user_type = 'ldap'
end
diff --git a/qa/qa/specs/features/mattermost/group_create_spec.rb b/qa/qa/specs/features/mattermost/group_create_spec.rb
index a59761da341..097e1713aef 100644
--- a/qa/qa/specs/features/mattermost/group_create_spec.rb
+++ b/qa/qa/specs/features/mattermost/group_create_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'create a new group', :mattermost do
+ describe 'create a new group', :orchestrated, :mattermost do
it 'creating a group with a mattermost team' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/mattermost/login_spec.rb b/qa/qa/specs/features/mattermost/login_spec.rb
index b140191e160..27f7d4c245f 100644
--- a/qa/qa/specs/features/mattermost/login_spec.rb
+++ b/qa/qa/specs/features/mattermost/login_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'logging in to Mattermost', :mattermost do
+ describe 'logging in to Mattermost', :orchestrated, :mattermost do
it 'can use gitlab oauth' do
Runtime::Browser.visit(:gitlab, Page::Main::Login) do
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/merge_request/create_spec.rb b/qa/qa/specs/features/merge_request/create_spec.rb
index 36d7efb02e1..71e79956b85 100644
--- a/qa/qa/specs/features/merge_request/create_spec.rb
+++ b/qa/qa/specs/features/merge_request/create_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'creates a merge request', :core do
+ describe 'creates a merge request with milestone' do
it 'user creates a new merge request' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
@@ -29,4 +29,25 @@ module QA
end
end
end
+
+ describe 'creates a merge request', :smoke do
+ it 'user creates a new merge request' do
+ Runtime::Browser.visit(:gitlab, Page::Main::Login)
+ Page::Main::Login.act { sign_in_using_credentials }
+
+ current_project = Factory::Resource::Project.fabricate! do |project|
+ project.name = 'project-with-merge-request'
+ end
+
+ Factory::Resource::MergeRequest.fabricate! do |merge_request|
+ merge_request.title = 'This is a merge request'
+ merge_request.description = 'Great feature'
+ merge_request.project = current_project
+ end
+
+ expect(page).to have_content('This is a merge request')
+ expect(page).to have_content('Great feature')
+ expect(page).to have_content(/Opened [\w\s]+ ago/)
+ end
+ end
end
diff --git a/qa/qa/specs/features/merge_request/rebase_spec.rb b/qa/qa/specs/features/merge_request/rebase_spec.rb
index 163dcbe7963..c36d28e4237 100644
--- a/qa/qa/specs/features/merge_request/rebase_spec.rb
+++ b/qa/qa/specs/features/merge_request/rebase_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'merge request rebase', :core do
+ describe 'merge request rebase' do
it 'rebases source branch of merge request' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/merge_request/squash_spec.rb b/qa/qa/specs/features/merge_request/squash_spec.rb
index 4856bbe1a69..3ecc36a5ae1 100644
--- a/qa/qa/specs/features/merge_request/squash_spec.rb
+++ b/qa/qa/specs/features/merge_request/squash_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'merge request squash commits', :core do
+ describe 'merge request squash commits' do
it 'when squash commits is marked before merge' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/project/activity_spec.rb b/qa/qa/specs/features/project/activity_spec.rb
index 02074e386b6..c7ce8dfdcc6 100644
--- a/qa/qa/specs/features/project/activity_spec.rb
+++ b/qa/qa/specs/features/project/activity_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'activity page', :core do
+ describe 'activity page' do
it 'push creates an event in the activity page' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/project/add_deploy_key_spec.rb b/qa/qa/specs/features/project/add_deploy_key_spec.rb
index 14642af97ad..24f9f4c77f8 100644
--- a/qa/qa/specs/features/project/add_deploy_key_spec.rb
+++ b/qa/qa/specs/features/project/add_deploy_key_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'deploy keys support', :core do
+ describe 'deploy keys support' do
it 'user adds a deploy key' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/project/add_secret_variable_spec.rb b/qa/qa/specs/features/project/add_secret_variable_spec.rb
index 32c91dd9d4d..04d9fe488e2 100644
--- a/qa/qa/specs/features/project/add_secret_variable_spec.rb
+++ b/qa/qa/specs/features/project/add_secret_variable_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'secret variables support', :core do
+ describe 'secret variables support' do
it 'user adds a secret variable' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/project/auto_devops_spec.rb b/qa/qa/specs/features/project/auto_devops_spec.rb
index c2c3bef98e4..248669b6046 100644
--- a/qa/qa/specs/features/project/auto_devops_spec.rb
+++ b/qa/qa/specs/features/project/auto_devops_spec.rb
@@ -1,7 +1,7 @@
require 'pathname'
module QA
- describe 'Auto Devops', :kubernetes do
+ describe 'Auto Devops', :orchestrated, :kubernetes do
after do
@cluster&.remove!
end
@@ -15,6 +15,13 @@ module QA
p.description = 'Project with Auto Devops'
end
+ # Disable code_quality check in Auto DevOps pipeline as it takes
+ # too long and times out the test
+ Factory::Resource::SecretVariable.fabricate! do |resource|
+ resource.key = 'CODE_QUALITY_DISABLED'
+ resource.value = '1'
+ end
+
# Create Auto Devops compatible repo
Factory::Repository::ProjectPush.fabricate! do |push|
push.project = project
diff --git a/qa/qa/specs/features/project/create_issue_spec.rb b/qa/qa/specs/features/project/create_issue_spec.rb
index 6c62a1026b2..eee7d01a4c8 100644
--- a/qa/qa/specs/features/project/create_issue_spec.rb
+++ b/qa/qa/specs/features/project/create_issue_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'creates issue', :core do
+ describe 'creates issue', :smoke do
let(:issue_title) { 'issue title' }
def create_issue
diff --git a/qa/qa/specs/features/project/create_spec.rb b/qa/qa/specs/features/project/create_spec.rb
index 14ecd464685..5e19e490778 100644
--- a/qa/qa/specs/features/project/create_spec.rb
+++ b/qa/qa/specs/features/project/create_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'create a new project', :core do
+ describe 'create a new project', :smoke do
it 'user creates a new project' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/project/deploy_key_clone_spec.rb b/qa/qa/specs/features/project/deploy_key_clone_spec.rb
index 054f49b408a..1d099508c24 100644
--- a/qa/qa/specs/features/project/deploy_key_clone_spec.rb
+++ b/qa/qa/specs/features/project/deploy_key_clone_spec.rb
@@ -1,7 +1,7 @@
require 'digest/sha1'
module QA
- describe 'cloning code using a deploy key', :core, :docker do
+ describe 'cloning code using a deploy key', :docker do
def login
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/project/fork_project_spec.rb b/qa/qa/specs/features/project/fork_project_spec.rb
index 8ad0120305a..280978bb950 100644
--- a/qa/qa/specs/features/project/fork_project_spec.rb
+++ b/qa/qa/specs/features/project/fork_project_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'Project fork', :core do
+ describe 'Project fork' do
it 'can submit merge requests to upstream master' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
@@ -8,14 +8,12 @@ module QA
merge_request.fork_branch = 'feature-branch'
end
- Page::Menu::Main.act { sign_out }
- Page::Main::Login.act do
- switch_to_sign_in_tab
- sign_in_using_credentials
- end
+ Page::Menu::Main.perform { |main| main.sign_out }
+ Page::Main::Login.perform { |login| login.sign_in_using_credentials }
merge_request.visit!
- Page::MergeRequest::Show.act { merge! }
+
+ Page::MergeRequest::Show.perform { |show| show.merge! }
expect(page).to have_content('The changes were merged')
end
diff --git a/qa/qa/specs/features/project/import_from_github_spec.rb b/qa/qa/specs/features/project/import_from_github_spec.rb
index 221b5c27fba..57695d2c726 100644
--- a/qa/qa/specs/features/project/import_from_github_spec.rb
+++ b/qa/qa/specs/features/project/import_from_github_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'user imports a GitHub repo', :core, :github do
+ describe 'user imports a GitHub repo', :orchestrated, :github do
let(:imported_project) do
Factory::Resource::ProjectImportedFromGithub.fabricate! do |project|
project.name = 'imported-project'
diff --git a/qa/qa/specs/features/project/pipelines_spec.rb b/qa/qa/specs/features/project/pipelines_spec.rb
index ddedde7a8bc..6c6b4e80626 100644
--- a/qa/qa/specs/features/project/pipelines_spec.rb
+++ b/qa/qa/specs/features/project/pipelines_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'CI/CD Pipelines', :core, :docker do
+ describe 'CI/CD Pipelines', :orchestrated, :docker do
let(:executor) { "qa-runner-#{Time.now.to_i}" }
after do
diff --git a/qa/qa/specs/features/project/wikis_spec.rb b/qa/qa/specs/features/project/wikis_spec.rb
index 59cc455fffc..9af2dbd1264 100644
--- a/qa/qa/specs/features/project/wikis_spec.rb
+++ b/qa/qa/specs/features/project/wikis_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'Wiki Functionality', :core do
+ describe 'Wiki Functionality' do
def login
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
diff --git a/qa/qa/specs/features/repository/clone_spec.rb b/qa/qa/specs/features/repository/clone_spec.rb
index a04ce4e44d9..8b0613c5f78 100644
--- a/qa/qa/specs/features/repository/clone_spec.rb
+++ b/qa/qa/specs/features/repository/clone_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'clone code from the repository', :core do
+ describe 'clone code from the repository' do
context 'with regular account over http' do
let(:location) do
Page::Project::Show.act do
diff --git a/qa/qa/specs/features/repository/protected_branches_spec.rb b/qa/qa/specs/features/repository/protected_branches_spec.rb
index c2de94516d9..aa23145478d 100644
--- a/qa/qa/specs/features/repository/protected_branches_spec.rb
+++ b/qa/qa/specs/features/repository/protected_branches_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'branch protection support', :core do
+ describe 'branch protection support' do
let(:branch_name) { 'protected-branch' }
let(:commit_message) { 'Protected push commit message' }
let(:project) do
diff --git a/qa/qa/specs/features/repository/push_spec.rb b/qa/qa/specs/features/repository/push_spec.rb
index fc40b60d915..1e89942e932 100644
--- a/qa/qa/specs/features/repository/push_spec.rb
+++ b/qa/qa/specs/features/repository/push_spec.rb
@@ -1,5 +1,5 @@
module QA
- describe 'push code to repository', :core do
+ describe 'push code to repository' do
context 'with regular account over http' do
it 'user pushes code to the repository' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb
index f8f6fe65599..ccb9d5591de 100644
--- a/qa/qa/specs/runner.rb
+++ b/qa/qa/specs/runner.rb
@@ -14,7 +14,13 @@ module QA
def perform
args = []
args.push('--tty') if tty
- tags.to_a.each { |tag| args.push(['-t', tag.to_s]) }
+
+ if tags.any?
+ tags.each { |tag| args.push(['-t', tag.to_s]) }
+ else
+ args.push(%w[-t ~orchestrated])
+ end
+
args.push(options)
Runtime::Browser.configure!
diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb
index 851026c71f0..ccc0b906845 100644
--- a/qa/spec/runtime/env_spec.rb
+++ b/qa/spec/runtime/env_spec.rb
@@ -77,6 +77,31 @@ describe QA::Runtime::Env do
end
end
+ describe '.forker?' do
+ it 'returns false if no forker credentials are defined' do
+ expect(described_class).not_to be_forker
+ end
+
+ it 'returns false if only forker username is defined' do
+ stub_env('GITLAB_FORKER_USERNAME', 'foo')
+
+ expect(described_class).not_to be_forker
+ end
+
+ it 'returns false if only forker password is defined' do
+ stub_env('GITLAB_FORKER_PASSWORD', 'bar')
+
+ expect(described_class).not_to be_forker
+ end
+
+ it 'returns true if forker username and password are defined' do
+ stub_env('GITLAB_FORKER_USERNAME', 'foo')
+ stub_env('GITLAB_FORKER_PASSWORD', 'bar')
+
+ expect(described_class).to be_forker
+ end
+ end
+
describe '.github_access_token' do
it 'returns "" if GITHUB_ACCESS_TOKEN is not defined' do
expect(described_class.github_access_token).to eq('')
diff --git a/qa/spec/scenario/test/instance_spec.rb b/qa/spec/scenario/test/instance/all_spec.rb
index 0d0b534911f..423527e938e 100644
--- a/qa/spec/scenario/test/instance_spec.rb
+++ b/qa/spec/scenario/test/instance/all_spec.rb
@@ -1,10 +1,4 @@
-describe QA::Scenario::Test::Instance do
- subject do
- Class.new(described_class) do
- tags :rspec
- end
- end
-
+describe QA::Scenario::Test::Instance::All do
context '#perform' do
let(:arguments) { spy('Runtime::Scenario') }
let(:release) { spy('Runtime::Release') }
@@ -26,16 +20,16 @@ describe QA::Scenario::Test::Instance do
end
context 'no paths' do
- it 'should call runner with default arguments' do
+ it 'calls runner with default arguments' do
subject.perform("test")
expect(runner).to have_received(:options=)
- .with(::File.expand_path('../../../qa/specs/features', __dir__))
+ .with(::File.expand_path('../../../../qa/specs/features', __dir__))
end
end
context 'specifying paths' do
- it 'should call runner with paths' do
+ it 'calls runner with paths' do
subject.perform('test', 'path1', 'path2')
expect(runner).to have_received(:options=).with(%w[path1 path2])
diff --git a/qa/spec/scenario/test/instance/smoke_spec.rb b/qa/spec/scenario/test/instance/smoke_spec.rb
new file mode 100644
index 00000000000..e79d19e8212
--- /dev/null
+++ b/qa/spec/scenario/test/instance/smoke_spec.rb
@@ -0,0 +1,45 @@
+describe QA::Scenario::Test::Instance::Smoke do
+ subject { Class.new(described_class) { tags :smoke } }
+
+ context '#perform' do
+ let(:arguments) { spy('Runtime::Scenario') }
+ let(:release) { spy('Runtime::Release') }
+ let(:runner) { spy('Specs::Runner') }
+
+ before do
+ stub_const('QA::Runtime::Release', release)
+ stub_const('QA::Runtime::Scenario', arguments)
+ stub_const('QA::Specs::Runner', runner)
+
+ allow(runner).to receive(:perform).and_yield(runner)
+ end
+
+ it 'sets an address of the subject' do
+ subject.perform("hello")
+
+ expect(arguments).to have_received(:define)
+ .with(:gitlab_address, "hello")
+ end
+
+ it 'has a smoke tag' do
+ expect(subject.focus).to eq([:smoke]) # rubocop:disable Focus
+ end
+
+ context 'no paths' do
+ it 'calls runner with default arguments' do
+ subject.perform("test")
+
+ expect(runner).to have_received(:options=)
+ .with(::File.expand_path('../../../../qa/specs/features', __dir__))
+ end
+ end
+
+ context 'specifying paths' do
+ it 'calls runner with paths' do
+ subject.perform('test', 'path1', 'path2')
+
+ expect(runner).to have_received(:options=).with(%w[path1 path2])
+ end
+ end
+ end
+end