Commit 837b7591 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'qa-split-shared-examples-e2e' into 'master'

Split e2e shared examples to add test case links

See merge request gitlab-org/gitlab!80750
parents a01dc556 745f0234
...@@ -9,8 +9,8 @@ module QA ...@@ -9,8 +9,8 @@ module QA
get_personal_access_token get_personal_access_token
end end
shared_examples 'retrieving configuration about Geo nodes' do shared_examples 'retrieving configuration about Geo nodes' do |testcase|
it 'GET /geo_nodes' do it 'GET /geo_nodes', testcase: testcase do
get api_endpoint('/geo_nodes') get api_endpoint('/geo_nodes')
expect_status(200) expect_status(200)
...@@ -20,8 +20,10 @@ module QA ...@@ -20,8 +20,10 @@ module QA
files_max_capacity: :integer, repos_max_capacity: :integer, files_max_capacity: :integer, repos_max_capacity: :integer,
clone_protocol: :string, _links: :object) clone_protocol: :string, _links: :object)
end end
end
it 'GET /geo_nodes/:id' do shared_examples 'retrieving configuration about Geo nodes/:id' do |testcase|
it 'GET /geo_nodes/:id', testcase: testcase do
get api_endpoint("/geo_nodes/#{geo_node[:id]}") get api_endpoint("/geo_nodes/#{geo_node[:id]}")
expect_status(200) expect_status(200)
...@@ -29,14 +31,15 @@ module QA ...@@ -29,14 +31,15 @@ module QA
end end
end end
describe 'Geo Nodes API on primary node', :geo do describe 'on primary node', :geo do
before(:context) do before(:context) do
fetch_nodes(:geo_primary) fetch_nodes(:geo_primary)
end end
include_examples 'retrieving configuration about Geo nodes' do
let(:geo_node) { @primary_node } let(:geo_node) { @primary_node }
end
include_examples 'retrieving configuration about Geo nodes', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348042'
include_examples 'retrieving configuration about Geo nodes/:id', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348041'
describe 'editing a Geo node' do describe 'editing a Geo node' do
it 'PUT /geo_nodes/:id for secondary node', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348043' do it 'PUT /geo_nodes/:id for secondary node', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348043' do
...@@ -58,14 +61,15 @@ module QA ...@@ -58,14 +61,15 @@ module QA
end end
end end
describe 'Geo Nodes API on secondary node', :geo do describe 'on secondary node', :geo do
before(:context) do before(:context) do
fetch_nodes(:geo_secondary) fetch_nodes(:geo_secondary)
end end
include_examples 'retrieving configuration about Geo nodes' do
let(:geo_node) { @nodes.first } let(:geo_node) { @nodes.first }
end
include_examples 'retrieving configuration about Geo nodes', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348044'
include_examples 'retrieving configuration about Geo nodes/:id', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348045'
end end
def api_endpoint(endpoint) def api_endpoint(endpoint)
......
...@@ -8,14 +8,16 @@ module QA ...@@ -8,14 +8,16 @@ module QA
let(:branch_name) { 'protected-branch' } let(:branch_name) { 'protected-branch' }
let(:commit_message) { 'Protected push commit message' } let(:commit_message) { 'Protected push commit message' }
shared_examples 'only user with access pushes and merges' do shared_examples 'unselected maintainer' do |testcase|
it 'unselected maintainer user fails to push' do it 'user fails to push', testcase: testcase do
expect { push_new_file(branch_name, as_user: user_maintainer) }.to raise_error( expect { push_new_file(branch_name, as_user: user_maintainer) }.to raise_error(
QA::Support::Run::CommandError, QA::Support::Run::CommandError,
/You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) /You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/)
end end
end
it 'selected developer user pushes and merges' do shared_examples 'selected developer' do |testcase|
it 'user pushes and merges', testcase: testcase do
push = push_new_file(branch_name, as_user: user_developer) push = push_new_file(branch_name, as_user: user_developer)
expect(push.output).to match(/To create a merge request for protected-branch, visit/) expect(push.output).to match(/To create a merge request for protected-branch, visit/)
...@@ -59,7 +61,8 @@ module QA ...@@ -59,7 +61,8 @@ module QA
end end
end end
it_behaves_like 'only user with access pushes and merges' it_behaves_like 'unselected maintainer', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347775'
it_behaves_like 'selected developer', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347774'
end end
context 'when only one group is allowed to merge and push to a protected branch' do context 'when only one group is allowed to merge and push to a protected branch' do
...@@ -96,7 +99,8 @@ module QA ...@@ -96,7 +99,8 @@ module QA
end end
end end
it_behaves_like 'only user with access pushes and merges' it_behaves_like 'unselected maintainer', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347772'
it_behaves_like 'selected developer', 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347773'
end end
def login(as_user: Runtime::User) def login(as_user: Runtime::User)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment