Commit 57254bf8 authored by Valerie Burton's avatar Valerie Burton

Apply review suggestions for using dynamic element and existing users

parent 9f9a82af
......@@ -31,7 +31,10 @@ export default {
computed: {
actionPrimary() {
return {
attributes: { variant: 'danger' },
attributes: {
variant: 'danger',
'data-qa-selector': 'confirm_delete_issue_button'
},
text: this.title,
};
},
......
......@@ -23,6 +23,12 @@ module QA
end
end
def filter_by_name(name)
within_element(:project_filter_form) do
fill_in :name, with: name
end
end
def go_to_project(name)
filter_by_name(name)
......@@ -40,14 +46,6 @@ module QA
def clear_project_filter
fill_element(:project_filter_form, "")
end
private
def filter_by_name(name)
within_element(:project_filter_form) do
fill_in :name, with: name
end
end
end
end
end
......
# frozen_string_literal: true
module QA
module Page
module Modal
class DeleteIssue < Base
view 'app/assets/javascripts/issues/show/components/delete_issue_modal.vue' do
element :confirm_delete_issue_button, required: true
end
def confirm_delete_issue
click_element :confirm_delete_issue_button
end
end
end
end
end
......@@ -79,9 +79,10 @@ module QA
def delete_issue
click_element(:issue_actions_ellipsis_dropdown)
click_element(:delete_issue_button)
click_element(:delete_issue_button, Page::Modal::DeleteIssue)
Page::Modal::DeleteIssue.perform(&:confirm_delete_issue)
within('.modal-content') { click_button 'Delete issue' }
wait_for_requests
end
end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Manage', :requires_admin do
RSpec.describe 'Manage' do
describe 'Personal project permissions' do
let!(:admin_api_client) { Runtime::API::Client.as_admin }
let!(:owner) do
Resource::User.fabricate_via_api! do |user|
user.api_client = admin_api_client
end
end
let!(:owner) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let!(:owner_api_client) { Runtime::API::Client.new(:gitlab, user: owner) }
......@@ -23,7 +17,6 @@ module QA
after do
project&.remove_via_api!
owner&.remove_via_api!
end
context 'when user is added as Owner' do
......@@ -41,6 +34,8 @@ module QA
it "has Owner role with Owner permissions", testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/352542' do
Page::Dashboard::Projects.perform do |projects|
projects.filter_by_name(project.name)
expect(projects).to have_project_with_access_role(project.name, 'Owner')
end
......@@ -49,11 +44,7 @@ module QA
end
context 'when user is added as Maintainer' do
let(:maintainer) do
Resource::User.fabricate_via_api! do |user|
user.api_client = admin_api_client
end
end
let(:maintainer) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) }
let(:issue) do
Resource::Issue.fabricate_via_api! do |issue|
......@@ -68,12 +59,10 @@ module QA
Flow::Login.sign_in(as: maintainer)
end
after do
maintainer&.remove_via_api!
end
it "has Maintainer role without Owner permissions", testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/352607' do
Page::Dashboard::Projects.perform do |projects|
projects.filter_by_name(project.name)
expect(projects).to have_project_with_access_role(project.name, 'Maintainer')
end
......@@ -87,9 +76,7 @@ module QA
expect do
issue.visit!
Page::Project::Issue::Show.perform do |issue|
issue.delete_issue
end
Page::Project::Issue::Show.perform(&:delete_issue)
Page::Project::Issue::Index.perform do |index|
expect(index).not_to have_issue(issue)
......
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