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
c9931302
Commit
c9931302
authored
Jan 22, 2021
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rspec wait_for_requests helper waits for graphQL requests
parent
88e3fdc4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
6 deletions
+20
-6
app/assets/javascripts/lib/graphql.js
app/assets/javascripts/lib/graphql.js
+16
-1
ee/spec/features/boards/swimlanes/epics_swimlanes_sidebar_spec.rb
...features/boards/swimlanes/epics_swimlanes_sidebar_spec.rb
+2
-3
ee/spec/features/groups/group_roadmap_spec.rb
ee/spec/features/groups/group_roadmap_spec.rb
+1
-1
spec/support/helpers/wait_for_requests.rb
spec/support/helpers/wait_for_requests.rb
+1
-1
No files found.
app/assets/javascripts/lib/graphql.js
View file @
c9931302
...
...
@@ -35,6 +35,16 @@ export default (resolvers = {}, config = {}) => {
batchMax
:
config
.
batchMax
||
10
,
};
const
requestCounterLink
=
new
ApolloLink
((
operation
,
forward
)
=>
{
window
.
pendingApolloRequests
=
window
.
pendingApolloRequests
||
0
;
window
.
pendingApolloRequests
+=
1
;
return
forward
(
operation
).
map
((
response
)
=>
{
window
.
pendingApolloRequests
-=
1
;
return
response
;
});
});
const
uploadsLink
=
ApolloLink
.
split
(
(
operation
)
=>
operation
.
getContext
().
hasUpload
||
operation
.
getContext
().
isSingleRequest
,
createUploadLink
(
httpOptions
),
...
...
@@ -63,7 +73,12 @@ export default (resolvers = {}, config = {}) => {
return
new
ApolloClient
({
typeDefs
:
config
.
typeDefs
,
link
:
ApolloLink
.
from
([
performanceBarLink
,
new
StartupJSLink
(),
uploadsLink
]),
link
:
ApolloLink
.
from
([
requestCounterLink
,
performanceBarLink
,
new
StartupJSLink
(),
uploadsLink
,
]),
cache
:
new
InMemoryCache
({
...
config
.
cacheConfig
,
freezeResults
:
config
.
assumeImmutableResults
,
...
...
ee/spec/features/boards/swimlanes/epics_swimlanes_sidebar_spec.rb
View file @
c9931302
...
...
@@ -8,7 +8,8 @@ RSpec.describe 'epics swimlanes sidebar', :js do
let_it_be
(
:project
,
reload:
true
)
{
create
(
:project
,
:public
,
group:
group
)
}
let_it_be
(
:board
)
{
create
(
:board
,
project:
project
)
}
let_it_be
(
:list
)
{
create
(
:list
,
board:
board
,
position:
0
)
}
let_it_be
(
:label
)
{
create
(
:label
,
project:
project
,
name:
'Label 1'
)
}
let_it_be
(
:list
)
{
create
(
:list
,
board:
board
,
label:
label
,
position:
0
)
}
let_it_be
(
:epic1
)
{
create
(
:epic
,
group:
group
)
}
let_it_be
(
:issue1
,
reload:
true
)
{
create
(
:issue
,
project:
project
)
}
...
...
@@ -27,8 +28,6 @@ RSpec.describe 'epics swimlanes sidebar', :js do
page
.
find
(
'.dropdown-toggle'
).
click
page
.
find
(
'.dropdown-item'
,
text:
'Epic'
).
click
end
wait_for_all_requests
end
context
'notifications subscription'
do
...
...
ee/spec/features/groups/group_roadmap_spec.rb
View file @
c9931302
...
...
@@ -161,7 +161,7 @@ RSpec.describe 'group epic roadmap', :js do
before
do
create_list
(
:epic
,
2
,
group:
group
,
start_date:
10
.
days
.
ago
,
end_date:
1
.
day
.
ago
)
visit
group_roadmap_path
(
group
)
wait_for_requests
execute_script
(
"gon.roadmap_epics_limit = 1;"
)
end
...
...
spec/support/helpers/wait_for_requests.rb
View file @
c9931302
...
...
@@ -52,6 +52,6 @@ module WaitForRequests
end
def
finished_all_ajax_requests?
Capybara
.
page
.
evaluate_script
(
'window.pendingRequests || window.pendingRailsUJSRequests || 0'
).
zero?
# rubocop:disable Style/NumericPredicate
Capybara
.
page
.
evaluate_script
(
'window.pendingRequests || window.pending
ApolloRequests || window.pending
RailsUJSRequests || 0'
).
zero?
# rubocop:disable Style/NumericPredicate
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