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
d998f300
Commit
d998f300
authored
May 07, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Intermittence adjustments regarding Spinach and Vue
parent
5bd8ed4a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
3 deletions
+34
-3
features/project/merge_requests.feature
features/project/merge_requests.feature
+3
-0
features/steps/project/forked_merge_requests.rb
features/steps/project/forked_merge_requests.rb
+1
-0
features/steps/project/merge_requests.rb
features/steps/project/merge_requests.rb
+3
-0
features/steps/project/merge_requests/acceptance.rb
features/steps/project/merge_requests/acceptance.rb
+2
-2
features/steps/project/merge_requests/revert.rb
features/steps/project/merge_requests/revert.rb
+2
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+6
-0
spec/support/wait_for_requests.rb
spec/support/wait_for_requests.rb
+7
-1
spec/support/wait_for_vue_resource.rb
spec/support/wait_for_vue_resource.rb
+10
-0
No files found.
features/project/merge_requests.feature
View file @
d998f300
...
@@ -48,10 +48,12 @@ Feature: Project Merge Requests
...
@@ -48,10 +48,12 @@ Feature: Project Merge Requests
Then
I should see
"Feature NS-03"
in merge requests
Then
I should see
"Feature NS-03"
in merge requests
And
I should see
"Bug NS-04"
in merge requests
And
I should see
"Bug NS-04"
in merge requests
@javascript
Scenario
:
I
visit an open merge request page
Scenario
:
I
visit an open merge request page
Given
I click link
"Bug NS-04"
Given
I click link
"Bug NS-04"
Then
I should see merge request
"Bug NS-04"
Then
I should see merge request
"Bug NS-04"
@javascript
Scenario
:
I
visit a merged merge request page
Scenario
:
I
visit a merged merge request page
Given
project
"Shop"
have
"Feature NS-05"
merged merge request
Given
project
"Shop"
have
"Feature NS-05"
merged merge request
And
I click link
"Merged"
And
I click link
"Merged"
...
@@ -180,6 +182,7 @@ Feature: Project Merge Requests
...
@@ -180,6 +182,7 @@ Feature: Project Merge Requests
# Markdown
# Markdown
@javascript
Scenario
:
Headers inside the description should have ids generated for them.
Scenario
:
Headers inside the description should have ids generated for them.
When
I visit merge request page
"Bug NS-04"
When
I visit merge request page
"Bug NS-04"
Then
Header
"Description header"
should have correct id and link
Then
Header
"Description header"
should have correct id and link
...
...
features/steps/project/forked_merge_requests.rb
View file @
d998f300
...
@@ -32,6 +32,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
...
@@ -32,6 +32,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
expect
(
page
).
to
have_content
@project
.
path_with_namespace
expect
(
page
).
to
have_content
@project
.
path_with_namespace
expect
(
page
).
to
have_content
@merge_request
.
source_branch
expect
(
page
).
to
have_content
@merge_request
.
source_branch
expect
(
page
).
to
have_content
@merge_request
.
target_branch
expect
(
page
).
to
have_content
@merge_request
.
target_branch
wait_for_vue_resource
end
end
step
'I fill out a "Merge Request On Forked Project" merge request'
do
step
'I fill out a "Merge Request On Forked Project" merge request'
do
...
...
features/steps/project/merge_requests.rb
View file @
d998f300
...
@@ -46,6 +46,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
...
@@ -46,6 +46,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
page
.
within
'.merge-request'
do
page
.
within
'.merge-request'
do
expect
(
page
).
to
have_content
"Wiki Feature"
expect
(
page
).
to
have_content
"Wiki Feature"
end
end
wait_for_vue_resource
end
end
step
'I should see closed merge request "Bug NS-04"'
do
step
'I should see closed merge request "Bug NS-04"'
do
...
@@ -56,10 +57,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
...
@@ -56,10 +57,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step
'I should see merge request "Bug NS-04"'
do
step
'I should see merge request "Bug NS-04"'
do
expect
(
page
).
to
have_content
"Bug NS-04"
expect
(
page
).
to
have_content
"Bug NS-04"
wait_for_vue_resource
end
end
step
'I should see merge request "Feature NS-05"'
do
step
'I should see merge request "Feature NS-05"'
do
expect
(
page
).
to
have_content
"Feature NS-05"
expect
(
page
).
to
have_content
"Feature NS-05"
wait_for_vue_resource
end
end
step
'I should not see "master" branch'
do
step
'I should not see "master" branch'
do
...
...
features/steps/project/merge_requests/acceptance.rb
View file @
d998f300
...
@@ -24,7 +24,7 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps
...
@@ -24,7 +24,7 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps
# Wait for AJAX requests to complete so they don't blow up if they are
# Wait for AJAX requests to complete so they don't blow up if they are
# only handled after `DatabaseCleaner` has already run
# only handled after `DatabaseCleaner` has already run
wait_for_
ajax
wait_for_
vue_resource
end
end
step
'I should not see the Remove Source Branch button'
do
step
'I should not see the Remove Source Branch button'
do
...
@@ -32,7 +32,7 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps
...
@@ -32,7 +32,7 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps
# Wait for AJAX requests to complete so they don't blow up if they are
# Wait for AJAX requests to complete so they don't blow up if they are
# only handled after `DatabaseCleaner` has already run
# only handled after `DatabaseCleaner` has already run
wait_for_
ajax
wait_for_
vue_resource
end
end
step
'There is an open Merge Request'
do
step
'There is an open Merge Request'
do
...
...
features/steps/project/merge_requests/revert.rb
View file @
d998f300
class
Spinach::Features::RevertMergeRequests
<
Spinach
::
FeatureSteps
class
Spinach::Features::RevertMergeRequests
<
Spinach
::
FeatureSteps
include
LoginHelpers
include
LoginHelpers
include
GitlabRoutingHelper
include
GitlabRoutingHelper
include
WaitForVueResource
step
'I click on the revert button'
do
step
'I click on the revert button'
do
find
(
"a[href='#modal-revert-commit']"
).
click
find
(
"a[href='#modal-revert-commit']"
).
click
...
@@ -15,6 +16,7 @@ class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps
...
@@ -15,6 +16,7 @@ class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps
step
'I should see the revert merge request notice'
do
step
'I should see the revert merge request notice'
do
page
.
should
have_content
(
'The merge request has been successfully reverted.'
)
page
.
should
have_content
(
'The merge request has been successfully reverted.'
)
wait_for_vue_resource
end
end
step
'I should not see the revert button'
do
step
'I should not see the revert button'
do
...
...
features/steps/shared/paths.rb
View file @
d998f300
...
@@ -2,6 +2,7 @@ module SharedPaths
...
@@ -2,6 +2,7 @@ module SharedPaths
include
Spinach
::
DSL
include
Spinach
::
DSL
include
RepoHelpers
include
RepoHelpers
include
DashboardHelper
include
DashboardHelper
include
WaitForVueResource
step
'I visit new project page'
do
step
'I visit new project page'
do
visit
new_project_path
visit
new_project_path
...
@@ -401,23 +402,28 @@ module SharedPaths
...
@@ -401,23 +402,28 @@ module SharedPaths
step
'I visit merge request page "Bug NS-04"'
do
step
'I visit merge request page "Bug NS-04"'
do
visit
merge_request_path
(
"Bug NS-04"
)
visit
merge_request_path
(
"Bug NS-04"
)
wait_for_vue_resource
end
end
step
'I visit merge request page "Bug NS-05"'
do
step
'I visit merge request page "Bug NS-05"'
do
visit
merge_request_path
(
"Bug NS-05"
)
visit
merge_request_path
(
"Bug NS-05"
)
wait_for_vue_resource
end
end
step
'I visit merge request page "Bug NS-07"'
do
step
'I visit merge request page "Bug NS-07"'
do
visit
merge_request_path
(
"Bug NS-07"
)
visit
merge_request_path
(
"Bug NS-07"
)
wait_for_vue_resource
end
end
step
'I visit merge request page "Bug NS-08"'
do
step
'I visit merge request page "Bug NS-08"'
do
visit
merge_request_path
(
"Bug NS-08"
)
visit
merge_request_path
(
"Bug NS-08"
)
wait_for_vue_resource
end
end
step
'I visit merge request page "Bug CO-01"'
do
step
'I visit merge request page "Bug CO-01"'
do
mr
=
MergeRequest
.
find_by
(
title:
"Bug CO-01"
)
mr
=
MergeRequest
.
find_by
(
title:
"Bug CO-01"
)
visit
namespace_project_merge_request_path
(
mr
.
target_project
.
namespace
,
mr
.
target_project
,
mr
)
visit
namespace_project_merge_request_path
(
mr
.
target_project
.
namespace
,
mr
.
target_project
,
mr
)
wait_for_vue_resource
end
end
step
'I visit project "Shop" merge requests page'
do
step
'I visit project "Shop" merge requests page'
do
...
...
spec/support/wait_for_requests.rb
View file @
d998f300
require_relative
'./wait_for_ajax'
require_relative
'./wait_for_ajax'
require_relative
'./wait_for_vue_resource'
module
WaitForRequests
module
WaitForRequests
extend
self
extend
self
include
WaitForAjax
include
WaitForAjax
include
WaitForVueResource
# This is inspired by http://www.salsify.com/blog/engineering/tearing-capybara-ajax-tests
# This is inspired by http://www.salsify.com/blog/engineering/tearing-capybara-ajax-tests
def
wait_for_requests_complete
def
wait_for_requests_complete
Gitlab
::
Testing
::
RequestBlockerMiddleware
.
block_requests!
Gitlab
::
Testing
::
RequestBlockerMiddleware
.
block_requests!
wait_for
(
'pending AJAX requests complete'
)
do
wait_for
(
'pending AJAX requests complete'
)
do
Gitlab
::
Testing
::
RequestBlockerMiddleware
.
num_active_requests
.
zero?
&&
Gitlab
::
Testing
::
RequestBlockerMiddleware
.
num_active_requests
.
zero?
&&
finished_all_
ajax_
requests?
finished_all_requests?
end
end
ensure
ensure
Gitlab
::
Testing
::
RequestBlockerMiddleware
.
allow_requests!
Gitlab
::
Testing
::
RequestBlockerMiddleware
.
allow_requests!
end
end
def
finished_all_requests?
finished_all_ajax_requests?
&&
finished_all_vue_resource_requests?
end
# Waits until the passed block returns true
# Waits until the passed block returns true
def
wait_for
(
condition_name
,
max_wait_time:
Capybara
.
default_max_wait_time
,
polling_interval:
0.01
)
def
wait_for
(
condition_name
,
max_wait_time:
Capybara
.
default_max_wait_time
,
polling_interval:
0.01
)
wait_until
=
Time
.
now
+
max_wait_time
.
seconds
wait_until
=
Time
.
now
+
max_wait_time
.
seconds
...
...
spec/support/wait_for_vue_resource.rb
View file @
d998f300
...
@@ -4,4 +4,14 @@ module WaitForVueResource
...
@@ -4,4 +4,14 @@ module WaitForVueResource
loop
until
page
.
evaluate_script
(
'window.activeVueResources'
).
zero?
loop
until
page
.
evaluate_script
(
'window.activeVueResources'
).
zero?
end
end
end
end
def
finished_all_vue_resource_requests?
return
true
unless
javascript_test?
page
.
evaluate_script
(
'window.activeVueResources || 0'
).
zero?
end
def
javascript_test?
Capybara
.
current_driver
==
Capybara
.
javascript_driver
end
end
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