Commit f58a23e6 authored by Mark Lapierre's avatar Mark Lapierre Committed by Anastasia McDonald

Update file locking test for new confirm modal

- Updates the file page object to handle the current gitlab-ui-based
confirmation modal.
- Fixes a case of exception handling used as flow control.
parent 90a9b8d3
......@@ -39,7 +39,13 @@ export default {
},
computed: {
primaryAction() {
return { text: this.primaryText, attributes: { variant: this.primaryVariant } };
return {
text: this.primaryText,
attributes: {
variant: this.primaryVariant,
'data-qa-selector': 'confirm_ok_button',
},
};
},
cancelAction() {
return this.hideCancel ? null : this.$options.cancelAction;
......
......@@ -96,7 +96,10 @@ export default {
modal-id="lock-file-modal"
:visible="isModalVisible"
:title="$options.i18n.modalTitle"
:action-primary="{ text: $options.i18n.actionPrimary }"
:action-primary="{
text: $options.i18n.actionPrimary,
attributes: { variant: 'confirm', 'data-qa-selector': 'confirm_ok_button' },
}"
:action-cancel="{ text: $options.i18n.actionCancel }"
@primary="handleModalPrimary"
@hide="hideModal"
......
......@@ -11,6 +11,8 @@ module QA
super
base.class_eval do
include QA::Page::Component::ConfirmModal
view 'ee/app/views/projects/blob/_owners.html.haml' do
element :file_owner_content
element :link_file_owner
......@@ -30,31 +32,25 @@ module QA
end
def lock
accept_confirm do
click_element :lock_button
end
click_element(:lock_button)
click_confirmation_ok_button
begin
has_element? :lock_button, text: 'Unlock'
rescue StandardError
unless has_element?(:lock_button, text: 'Unlock')
raise QA::Page::Base::ElementNotFound, %q(Button did not show expected state)
end
end
def unlock
accept_confirm do
click_element :lock_button
end
click_element(:lock_button)
click_confirmation_ok_button
begin
has_element? :lock_button, text: 'Lock'
rescue StandardError
unless has_element?(:lock_button, text: 'Lock')
raise QA::Page::Base::ElementNotFound, %q(Button did not show expected state)
end
end
def has_lock_button_disabled?
has_element? :disabled_lock_button
has_element?(:disabled_lock_button)
end
end
end
......
......@@ -8,10 +8,14 @@ module QA
def self.included(base)
super
base.view 'app/assets/javascripts/lib/utils/confirm_via_gl_modal/confirm_modal.vue' do
element :confirm_ok_button
end
end
def fill_confirmation_text(text)
fill_element :confirm_input, text
fill_element(:confirm_input, text)
end
def wait_for_confirm_button_enabled
......@@ -22,7 +26,11 @@ module QA
def confirm_transfer
wait_for_confirm_button_enabled
click_element :confirm_button
click_element(:confirm_button)
end
def click_confirmation_ok_button
click_element(:confirm_ok_button)
end
end
end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/349898', type: :stale } do
RSpec.describe 'Create' do
describe 'File Locking' do
let(:user_one) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:user_two) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) }
......@@ -133,7 +133,7 @@ module QA
end
end
it 'creates a merge request and fails to merge', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/issues/40125', type: :bug }, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348316' do
it 'creates a merge request and fails to merge', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348316' do
push branch: 'test', as_user: user_one
merge_request = Resource::MergeRequest.fabricate_via_api! do |merge_request|
......
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