Commit ef278f6e authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'ml-update-fork-e2e-tests' into 'master'

Update fork e2e tests for new UI

See merge request gitlab-org/gitlab!58207
parents 91f693bb 86b39915
...@@ -218,6 +218,7 @@ export default { ...@@ -218,6 +218,7 @@ export default {
id="fork-url" id="fork-url"
v-model="selectedNamespace" v-model="selectedNamespace"
data-testid="fork-url-input" data-testid="fork-url-input"
data-qa-selector="fork_namespace_dropdown"
required required
> >
<template slot="first"> <template slot="first">
...@@ -291,6 +292,7 @@ export default { ...@@ -291,6 +292,7 @@ export default {
category="primary" category="primary"
variant="confirm" variant="confirm"
data-testid="submit-button" data-testid="submit-button"
data-qa-selector="fork_project_button"
:loading="isSaving" :loading="isSaving"
> >
{{ s__('ForkProject|Fork project') }} {{ s__('ForkProject|Fork project') }}
......
...@@ -13,8 +13,18 @@ module QA ...@@ -13,8 +13,18 @@ module QA
element :fork_groups_list_search_field element :fork_groups_list_search_field
end end
def choose_namespace(namespace = Runtime::Namespace.path) view 'app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue' do
element :fork_namespace_dropdown
element :fork_project_button
end
def fork_project(namespace = Runtime::Namespace.path)
if has_element?(:fork_namespace_button, wait: 0)
click_element(:fork_namespace_button, name: namespace) click_element(:fork_namespace_button, name: namespace)
else
select_element(:fork_namespace_dropdown, namespace)
click_element(:fork_project_button)
end
end end
def search_for_group(group_name) def search_for_group(group_name)
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
module QA module QA
module Resource module Resource
class Fork < Base class Fork < Base
attr_accessor :namespace_path
attribute :name do attribute :name do
upstream.name upstream.name
end end
...@@ -31,6 +33,8 @@ module QA ...@@ -31,6 +33,8 @@ module QA
def fabricate! def fabricate!
populate(:upstream, :user) populate(:upstream, :user)
namespace_path ||= user.name
# Sign out as admin and sign is as the fork user # Sign out as admin and sign is as the fork user
Page::Main::Menu.perform(&:sign_out) Page::Main::Menu.perform(&:sign_out)
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
...@@ -43,11 +47,11 @@ module QA ...@@ -43,11 +47,11 @@ module QA
Page::Project::Show.perform(&:fork_project) Page::Project::Show.perform(&:fork_project)
Page::Project::Fork::New.perform do |fork_new| Page::Project::Fork::New.perform do |fork_new|
fork_new.choose_namespace(user.name) fork_new.fork_project(namespace_path)
end end
Page::Layout::Banner.perform do |banner| Page::Project::Show.perform do |project_page|
banner.has_notice?('The project was successfully forked.') raise ResourceFabricationFailedError, "Forking failed!" unless project_page.forked_from?(upstream.name)
end end
populate(:project) populate(:project)
......
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
module QA module QA
RSpec.describe 'Create' do RSpec.describe 'Create' do
describe 'Merge request creation from fork' do describe 'Merge request creation from fork', :smoke do
let!(:merge_request) do it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1701' do
Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request| merge_request = Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request|
merge_request.fork_branch = 'feature-branch' merge_request.fork_branch = 'feature-branch'
end end
end
it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1701' do
Flow::Login.while_signed_in do Flow::Login.while_signed_in do
merge_request.visit! merge_request.visit!
......
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