Commit 86b39915 authored by Mark Lapierre's avatar Mark Lapierre

Update fork e2e tests for new UI

This update the Fork page object to that fork tests work with the new
UI. The changes are currently behind a feature flag, however if we
updated all the tests to enable or disable the flag explicitly we'd
have to update a few tests, and then all of them would require admin
access (because we can only enable/disable feature flags via the admin
API).

Instead, this updates the page object to detect which UI elements are
shown and use the appropriate ones.

More tests will be added to explicitly test with the feature flag
enabled or disabled so that we know each state has coverage.
parent b42ca8d3
......@@ -213,6 +213,7 @@ export default {
id="fork-url"
v-model="selectedNamespace"
data-testid="fork-url-input"
data-qa-selector="fork_namespace_dropdown"
required
>
<template slot="first">
......@@ -286,6 +287,7 @@ export default {
category="primary"
variant="confirm"
data-testid="submit-button"
data-qa-selector="fork_project_button"
:loading="isSaving"
>
{{ s__('ForkProject|Fork project') }}
......
......@@ -13,8 +13,18 @@ module QA
element :fork_groups_list_search_field
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)
else
select_element(:fork_namespace_dropdown, namespace)
click_element(:fork_project_button)
end
end
def search_for_group(group_name)
......
......@@ -3,6 +3,8 @@
module QA
module Resource
class Fork < Base
attr_accessor :namespace_path
attribute :name do
upstream.name
end
......@@ -31,6 +33,8 @@ module QA
def fabricate!
populate(:upstream, :user)
namespace_path ||= user.name
# Sign out as admin and sign is as the fork user
Page::Main::Menu.perform(&:sign_out)
Runtime::Browser.visit(:gitlab, Page::Main::Login)
......@@ -43,11 +47,11 @@ module QA
Page::Project::Show.perform(&:fork_project)
Page::Project::Fork::New.perform do |fork_new|
fork_new.choose_namespace(user.name)
fork_new.fork_project(namespace_path)
end
Page::Layout::Banner.perform do |banner|
banner.has_notice?('The project was successfully forked.')
Page::Project::Show.perform do |project_page|
raise ResourceFabricationFailedError, "Forking failed!" unless project_page.forked_from?(upstream.name)
end
populate(:project)
......
......@@ -2,14 +2,12 @@
module QA
RSpec.describe 'Create' do
describe 'Merge request creation from fork' do
let!(:merge_request) do
Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request|
describe 'Merge request creation from fork', :smoke do
it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1701' do
merge_request = Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request|
merge_request.fork_branch = 'feature-branch'
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
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