Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
2f4d088f
Commit
2f4d088f
authored
Jan 30, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce a new QA::Gitlab::Page::Component::Dropzone class
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
120c7902
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
17 deletions
+41
-17
qa/qa.rb
qa/qa.rb
+7
-0
qa/qa/page/base.rb
qa/qa/page/base.rb
+0
-15
qa/qa/page/component/dropzone.rb
qa/qa/page/component/dropzone.rb
+29
-0
qa/qa/page/project/issue/show.rb
qa/qa/page/project/issue/show.rb
+5
-2
No files found.
qa/qa.rb
View file @
2f4d088f
...
...
@@ -150,6 +150,13 @@ module QA
autoload
:Main
,
'qa/page/mattermost/main'
autoload
:Login
,
'qa/page/mattermost/login'
end
##
# Classes describing components that are used by several pages.
#
module
Component
autoload
:Dropzone
,
'qa/page/component/dropzone'
end
end
##
...
...
qa/qa/page/base.rb
View file @
2f4d088f
...
...
@@ -97,21 +97,6 @@ module QA
views
.
map
(
&
:errors
).
flatten
end
# Not tested and not expected to work with multiple dropzones
# instantiated on one page because there is no distinguishing
# attribute per dropzone file field.
def
attach_file_to_dropzone
(
attachment
,
dropzone_form_container
)
filename
=
File
.
basename
(
attachment
)
field_style
=
{
visibility:
'visible'
,
height:
''
,
width:
''
}
attach_file
(
attachment
,
class:
'dz-hidden-input'
,
make_visible:
field_style
)
# Wait for link to be appended to dropzone text
wait
(
reload:
false
)
do
find
(
"
#{
dropzone_form_container
}
textarea"
).
value
.
match
(
filename
)
end
end
class
DSL
attr_reader
:views
...
...
qa/qa/page/component/dropzone.rb
0 → 100644
View file @
2f4d088f
module
QA
module
Page
module
Component
class
Dropzone
attr_reader
:page
,
:container
def
initialize
(
page
,
container
)
@page
=
page
@container
=
container
end
# Not tested and not expected to work with multiple dropzones
# instantiated on one page because there is no distinguishing
# attribute per dropzone file field.
def
attach_file
(
attachment
)
filename
=
File
.
basename
(
attachment
)
field_style
=
{
visibility:
'visible'
,
height:
''
,
width:
''
}
page
.
attach_file
(
attachment
,
class:
'dz-hidden-input'
,
make_visible:
field_style
)
# Wait for link to be appended to dropzone text
page
.
wait
(
reload:
false
)
do
page
.
find
(
"
#{
container
}
textarea"
).
value
.
match
(
filename
)
end
end
end
end
end
end
qa/qa/page/project/issue/show.rb
View file @
2f4d088f
...
...
@@ -23,10 +23,13 @@ module QA
# Adds a comment to an issue
# attachment option should be an absolute path
def
comment
(
text
,
attachment
:)
def
comment
(
text
,
attachment:
nil
)
fill_in
(
with:
text
,
name:
'note[note]'
)
attach_file_to_dropzone
(
attachment
,
'.new-note'
)
if
attachment
unless
attachment
.
nil?
QA
::
Page
::
Component
::
Dropzone
.
new
(
page
,
'.new-note'
)
.
attach_file
(
attachment
)
end
click_on
'Comment'
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment