Commit 3e0e0a97 authored by Tomislav Nikić's avatar Tomislav Nikić Committed by Sanad Liaquat

Create a test that modifies a design

Creating a file and checking if the create icon
is used. After that it updates the fila and
checks again, this time if the update icon is available.
parent c991840f
......@@ -132,7 +132,13 @@ export default {
>
<div v-if="icon.name" data-testid="designEvent" class="design-event gl-absolute">
<span :title="icon.tooltip" :aria-label="icon.tooltip">
<gl-icon :name="icon.name" :size="18" :class="icon.classes" />
<gl-icon
:name="icon.name"
:size="18"
:class="icon.classes"
data-qa-selector="design_status_icon"
:data-qa-status="icon.name"
/>
</span>
</div>
<gl-intersection-observer @appear="onAppear">
......
......@@ -30,6 +30,7 @@ module QA
view 'app/assets/javascripts/design_management/components/list/item.vue' do
element :design_file_name
element :design_image
element :design_status_icon
end
view 'app/assets/javascripts/design_management/pages/index.vue' do
......@@ -79,6 +80,11 @@ module QA
raise ElementNotFound, %Q(Attempted to attach design "#{filename}" but it did not appear) unless found
end
def update_design(filename)
filepath = ::File.join('qa', 'fixtures', 'designs', 'update', filename)
add_design(filepath)
end
def click_design(filename)
click_element(:design_file_name, text: filename)
end
......@@ -101,6 +107,14 @@ module QA
def has_design?(filename)
has_element?(:design_file_name, text: filename)
end
def has_created_icon?
has_element?(:design_status_icon, status: 'file-addition-solid')
end
def has_modified_icon?
has_element?(:design_status_icon, status: 'file-modified-solid')
end
end
end
end
......
......@@ -3,18 +3,15 @@
module QA
module Resource
class Design < Base
attr_reader :id
attr_accessor :filename
attribute :issue do
Issue.fabricate_via_api!
end
attribute :filepath do
::File.absolute_path(::File.join('spec', 'fixtures', @filename))
end
attribute :id
attribute :filename
def initialize
@update = false
@filename = 'banana_sample.gif'
end
......@@ -26,6 +23,12 @@ module QA
issue.add_design(filepath)
end
end
private
def filepath
::File.absolute_path(::File.join('qa', 'fixtures', 'designs', @filename))
end
end
end
end
......@@ -41,7 +41,7 @@ module QA
context 'when using attachments in comments', :object_storage do
let(:gif_file_name) { 'banana_sample.gif' }
let(:file_to_attach) do
File.absolute_path(File.join('spec', 'fixtures', gif_file_name))
File.absolute_path(File.join('qa', 'fixtures', 'designs', gif_file_name))
end
before do
......
......@@ -5,7 +5,7 @@ module QA
context 'Design Management' do
let(:issue) { Resource::Issue.fabricate_via_api! }
let(:design_filename) { 'banana_sample.gif' }
let(:design) { File.absolute_path(File.join('spec', 'fixtures', design_filename)) }
let(:design) { File.absolute_path(File.join('qa', 'fixtures', 'designs', design_filename)) }
let(:annotation) { "This design is great!" }
before do
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
context 'Design Management' do
let(:design) do
Resource::Design.fabricate! do |design|
design.filename = 'tanuki.jpg'
end
end
before do
Flow::Login.sign_in
end
it 'user adds a design and modifies it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/273' do
design.issue.visit!
Page::Project::Issue::Show.perform do |issue|
expect(issue).to have_created_icon
end
Page::Project::Issue::Show.perform do |issue|
issue.update_design(design.filename)
expect(issue).to have_modified_icon
end
end
end
end
end
......@@ -3,7 +3,7 @@
module QA
RSpec.describe 'Geo', :orchestrated, :geo do
describe 'GitLab Geo attachment replication' do
let(:file_to_attach) { File.absolute_path(File.join('spec', 'fixtures', 'banana_sample.gif')) }
let(:file_to_attach) { File.absolute_path(File.join('qa', 'fixtures', 'designs', 'banana_sample.gif')) }
it 'user uploads attachment to the primary node', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/692' do
QA::Flow::Login.while_signed_in(address: :geo_primary) do
......
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