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
get_personal_access_token
end
shared_examples 'retrieving configuration about Geo nodes' do
it 'GET /geo_nodes' do
shared_examples 'retrieving configuration about Geo nodes' do |testcase|
it 'GET /geo_nodes', testcase: testcase do
get api_endpoint('/geo_nodes')
expect_status(200)
......@@ -20,8 +20,10 @@ module QA
files_max_capacity: :integer, repos_max_capacity: :integer,
clone_protocol: :string, _links: :object)
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]}")
expect_status(200)
......@@ -29,14 +31,15 @@ module QA
end
end
describe 'Geo Nodes API on primary node', :geo do
describe 'on primary node', :geo do
before(:context) do
fetch_nodes(:geo_primary)
end
include_examples 'retrieving configuration about Geo nodes' do
let(:geo_node) { @primary_node }
end
let(:geo_node) { @primary_node }
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
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
end
end
describe 'Geo Nodes API on secondary node', :geo do
describe 'on secondary node', :geo do
before(:context) do
fetch_nodes(:geo_secondary)
end
include_examples 'retrieving configuration about Geo nodes' do
let(:geo_node) { @nodes.first }
end
let(:geo_node) { @nodes.first }
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
def api_endpoint(endpoint)
......
......@@ -8,14 +8,16 @@ module QA
let(:branch_name) { 'protected-branch' }
let(:commit_message) { 'Protected push commit message' }
shared_examples 'only user with access pushes and merges' do
it 'unselected maintainer user fails to push' do
shared_examples 'unselected maintainer' do |testcase|
it 'user fails to push', testcase: testcase do
expect { push_new_file(branch_name, as_user: user_maintainer) }.to raise_error(
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\)/)
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)
expect(push.output).to match(/To create a merge request for protected-branch, visit/)
......@@ -59,7 +61,8 @@ module QA
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
context 'when only one group is allowed to merge and push to a protected branch' do
......@@ -96,7 +99,8 @@ module QA
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
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