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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
468072d0
Commit
468072d0
authored
Jan 26, 2018
by
Michael Kozono
Committed by
Rémy Coutable
Jan 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Geo attachment replication QA spec
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
c61a917f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
249 additions
and
8 deletions
+249
-8
app/views/layouts/header/_new_dropdown.haml
app/views/layouts/header/_new_dropdown.haml
+1
-1
qa/qa.rb
qa/qa.rb
+7
-0
qa/qa/factory/resource/issue.rb
qa/qa/factory/resource/issue.rb
+34
-0
qa/qa/page/base.rb
qa/qa/page/base.rb
+32
-0
qa/qa/page/group/show.rb
qa/qa/page/group/show.rb
+10
-6
qa/qa/page/menu/side.rb
qa/qa/page/menu/side.rb
+8
-0
qa/qa/page/project/issue/index.rb
qa/qa/page/project/issue/index.rb
+17
-0
qa/qa/page/project/issue/new.rb
qa/qa/page/project/issue/new.rb
+33
-0
qa/qa/page/project/issue/show.rb
qa/qa/page/project/issue/show.rb
+37
-0
qa/qa/page/project/show.rb
qa/qa/page/project/show.rb
+11
-0
qa/qa/specs/features/ee/geo/attachment_replication_spec.rb
qa/qa/specs/features/ee/geo/attachment_replication_spec.rb
+58
-0
qa/qa/specs/features/ee/geo/repository_replication_spec.rb
qa/qa/specs/features/ee/geo/repository_replication_spec.rb
+1
-1
qa/spec/fixtures/banana_sample.gif
qa/spec/fixtures/banana_sample.gif
+0
-0
No files found.
app/views/layouts/header/_new_dropdown.haml
View file @
468072d0
%li
.header-new.dropdown
=
link_to
new_project_path
,
class:
"header-new-dropdown-toggle has-tooltip"
,
title:
"New..."
,
ref:
'tooltip'
,
aria:
{
label:
"New..."
},
data:
{
toggle:
'dropdown'
,
placement:
'bottom'
,
container:
'body'
}
do
=
link_to
new_project_path
,
class:
"header-new-dropdown-toggle has-tooltip
qa-new-menu-toggle
"
,
title:
"New..."
,
ref:
'tooltip'
,
aria:
{
label:
"New..."
},
data:
{
toggle:
'dropdown'
,
placement:
'bottom'
,
container:
'body'
}
do
=
sprite_icon
(
'plus-square'
,
size:
16
)
=
sprite_icon
(
'angle-down'
,
css_class:
'caret-down'
)
.dropdown-menu-nav.dropdown-menu-align-right
...
...
qa/qa.rb
View file @
468072d0
...
...
@@ -27,6 +27,7 @@ module QA
module
Resource
autoload
:Sandbox
,
'qa/factory/resource/sandbox'
autoload
:Group
,
'qa/factory/resource/group'
autoload
:Issue
,
'qa/factory/resource/issue'
autoload
:Project
,
'qa/factory/resource/project'
autoload
:MergeRequest
,
'qa/factory/resource/merge_request'
autoload
:DeployKey
,
'qa/factory/resource/deploy_key'
...
...
@@ -130,6 +131,12 @@ module QA
autoload
:SecretVariables
,
'qa/page/project/settings/secret_variables'
autoload
:Runners
,
'qa/page/project/settings/runners'
end
module
Issue
autoload
:New
,
'qa/page/project/issue/new'
autoload
:Show
,
'qa/page/project/issue/show'
autoload
:Index
,
'qa/page/project/issue/index'
end
end
module
Profile
...
...
qa/qa/factory/resource/issue.rb
0 → 100644
View file @
468072d0
require
'securerandom'
module
QA
module
Factory
module
Resource
class
Issue
<
Factory
::
Base
attr_writer
:title
,
:description
,
:project
dependency
Factory
::
Resource
::
Project
,
as: :project
do
|
project
|
project
.
name
=
'project-for-issues'
project
.
description
=
'project for adding issues'
end
product
:title
do
Page
::
Project
::
Issue
::
Show
.
act
{
issue_title
}
end
def
fabricate!
project
.
visit!
Page
::
Project
::
Show
.
act
do
go_to_new_issue
end
Page
::
Project
::
Issue
::
New
.
perform
do
|
page
|
page
.
add_title
(
@title
)
page
.
add_description
(
@description
)
page
.
create_new_issue
end
end
end
end
end
end
qa/qa/page/base.rb
View file @
468072d0
...
...
@@ -42,6 +42,23 @@ module QA
page
.
within
(
selector
)
{
yield
}
if
block_given?
end
# Returns true if successfully GETs the given URL
# Useful because `page.status_code` is unsupported by our driver, and
# we don't have access to the `response` to use `have_http_status`.
def
asset_exists?
(
url
)
page
.
execute_script
<<~
JS
xhr = new XMLHttpRequest();
xhr.open('GET', '
#{
url
}
', true);
xhr.send();
JS
return
false
unless
wait
(
time:
0.5
,
max:
60
,
reload:
false
)
do
page
.
evaluate_script
(
'xhr.readyState == XMLHttpRequest.DONE'
)
end
page
.
evaluate_script
(
'xhr.status'
)
==
200
end
def
find_element
(
name
)
find
(
element_selector_css
(
name
))
end
...
...
@@ -80,6 +97,21 @@ 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/group/show.rb
View file @
468072d0
...
...
@@ -2,12 +2,16 @@ module QA
module
Page
module
Group
class
Show
<
Page
::
Base
##
# TODO, define all selectors required by this page object
#
# See gitlab-org/gitlab-qa#154
#
view
'app/views/groups/show.html.haml'
view
'app/views/groups/show.html.haml'
do
element
:new_project_or_subgroup_dropdown
,
'.new-project-subgroup'
element
:new_project_or_subgroup_dropdown_toggle
,
'.dropdown-toggle'
element
:new_project_option
,
/%li.*data:.*value: "new-project"/
element
:new_project_button
,
/%input.*data:.*action: "new-project"/
element
:new_subgroup_option
,
/%li.*data:.*value: "new-subgroup"/
# data-value and data-action get modified by JS for subgroup
element
:new_subgroup_button
,
/%input.*\.js-new-group-child/
end
def
go_to_subgroup
(
name
)
click_link
name
...
...
qa/qa/page/menu/side.rb
View file @
468072d0
...
...
@@ -7,6 +7,8 @@ module QA
element
:settings_link
,
'link_to edit_project_path'
element
:repository_link
,
"title: 'Repository'"
element
:pipelines_settings_link
,
"title: 'CI / CD'"
element
:issues_link
,
%r{link_to.*shortcuts-issues}
element
:issues_link_text
,
"Issues"
element
:top_level_items
,
'.sidebar-top-level-items'
element
:activity_link
,
"title: 'Activity'"
end
...
...
@@ -43,6 +45,12 @@ module QA
end
end
def
click_issues
within_sidebar
do
click_link
(
'Issues'
)
end
end
private
def
hover_settings
...
...
qa/qa/page/project/issue/index.rb
0 → 100644
View file @
468072d0
module
QA
module
Page
module
Project
module
Issue
class
Index
<
Page
::
Base
view
'app/views/projects/issues/_issue.html.haml'
do
element
:issue_link
,
'link_to issue.title'
end
def
go_to_issue
(
title
)
click_link
(
title
)
end
end
end
end
end
end
qa/qa/page/project/issue/new.rb
0 → 100644
View file @
468072d0
module
QA
module
Page
module
Project
module
Issue
class
New
<
Page
::
Base
view
'app/views/shared/issuable/_form.html.haml'
do
element
:submit_issue_button
,
'form.submit "Submit'
end
view
'app/views/shared/issuable/form/_title.html.haml'
do
element
:issue_title_textbox
,
'form.text_field :title'
end
view
'app/views/shared/form_elements/_description.html.haml'
do
element
:issue_description_textarea
,
"render 'projects/zen', f: form, attr: :description"
end
def
add_title
(
title
)
fill_in
'issue_title'
,
with:
title
end
def
add_description
(
description
)
fill_in
'issue_description'
,
with:
description
end
def
create_new_issue
click_on
'Submit issue'
end
end
end
end
end
end
qa/qa/page/project/issue/show.rb
0 → 100644
View file @
468072d0
module
QA
module
Page
module
Project
module
Issue
class
Show
<
Page
::
Base
view
'app/views/projects/issues/show.html.haml'
do
element
:issue_details
,
'.issue-details'
element
:title
,
'.title'
end
view
'app/views/shared/notes/_form.html.haml'
do
element
:new_note_form
,
'new-note'
element
:new_note_form
,
'attr: :note'
end
view
'app/views/shared/notes/_comment_button.html.haml'
do
element
:comment_button
,
'%strong Comment'
end
def
issue_title
find
(
'.issue-details .title'
).
text
end
# Adds a comment to an issue
# attachment option should be an absolute path
def
comment
(
text
,
attachment
:)
fill_in
(
with:
text
,
name:
'note[note]'
)
attach_file_to_dropzone
(
attachment
,
'.new-note'
)
if
attachment
click_on
'Comment'
end
end
end
end
end
end
qa/qa/page/project/show.rb
View file @
468072d0
...
...
@@ -17,6 +17,11 @@ module QA
element
:project_name
end
view
'app/views/layouts/header/_new_dropdown.haml'
do
element
:new_menu_toggle
element
:new_issue_link
,
"link_to 'New issue', new_project_issue_path(@project)"
end
def
choose_repository_clone_http
wait
(
reload:
false
)
do
click_element
:clone_dropdown
...
...
@@ -46,6 +51,12 @@ module QA
sleep
5
refresh
end
def
go_to_new_issue
click_element
:new_menu_toggle
click_link
'New issue'
end
end
end
end
...
...
qa/qa/specs/features/ee/geo/attachment_replication_spec.rb
0 → 100644
View file @
468072d0
module
QA
feature
'GitLab Geo attachment replication'
,
:geo
do
let
(
:file_to_attach
)
{
File
.
absolute_path
(
File
.
join
(
'spec'
,
'fixtures'
,
'banana_sample.gif'
))
}
scenario
'user uploads attachment to the primary node'
do
Runtime
::
Browser
.
visit
(
:geo_primary
,
QA
::
Page
::
Main
::
Login
)
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
'project-for-issues'
project
.
description
=
'project for adding issues'
end
issue
=
Factory
::
Resource
::
Issue
.
fabricate!
do
|
issue
|
issue
.
title
=
'My geo issue'
issue
.
project
=
project
end
Page
::
Project
::
Issue
::
Show
.
perform
do
|
show
|
show
.
comment
(
'See attached banana for scale'
,
attachment:
file_to_attach
)
end
Runtime
::
Browser
.
visit
(
:geo_secondary
,
QA
::
Page
::
Main
::
Login
)
do
|
session
|
Page
::
Main
::
OAuth
.
act
do
authorize!
if
needs_authorization?
end
expect
(
page
).
to
have_content
'You are on a secondary (read-only) Geo node'
Page
::
Menu
::
Main
.
perform
do
|
menu
|
menu
.
go_to_projects
end
Page
::
Dashboard
::
Projects
.
perform
do
|
dashboard
|
dashboard
.
go_to_project
(
project
.
name
)
end
Page
::
Menu
::
Side
.
act
{
click_issues
}
Page
::
Project
::
Issue
::
Index
.
perform
do
|
index
|
index
.
go_to_issue
(
issue
.
title
)
end
image_url
=
find
(
'a[href$="banana_sample.gif"]'
)[
:href
]
Page
::
Project
::
Issue
::
Show
.
perform
do
|
show
|
# Wait for attachment replication
found
=
show
.
wait
(
reload:
false
)
do
show
.
asset_exists?
(
image_url
)
end
expect
(
found
).
to
be_truthy
end
end
end
end
end
end
qa/qa/specs/features/ee/geo/replication_spec.rb
→
qa/qa/specs/features/ee/geo/rep
ository_rep
lication_spec.rb
View file @
468072d0
module
QA
feature
'GitLab Geo replication'
,
:geo
do
feature
'GitLab Geo rep
ository rep
lication'
,
:geo
do
scenario
'users pushes code to the primary node'
do
Runtime
::
Browser
.
visit
(
:geo_primary
,
QA
::
Page
::
Main
::
Login
)
do
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
...
...
qa/spec/fixtures/banana_sample.gif
0 → 100644
View file @
468072d0
70.1 KB
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