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
7a197c32
Commit
7a197c32
authored
Sep 15, 2021
by
Zeff Morgan
Committed by
Mark Lapierre
Sep 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable canary switching during spec execution
parent
f0aa3f87
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
1 deletion
+32
-1
app/views/layouts/header/_default.html.haml
app/views/layouts/header/_default.html.haml
+1
-1
qa/qa/page/main/menu.rb
qa/qa/page/main/menu.rb
+11
-0
qa/qa/runtime/browser.rb
qa/qa/runtime/browser.rb
+20
-0
No files found.
app/views/layouts/header/_default.html.haml
View file @
7a197c32
...
...
@@ -15,7 +15,7 @@
%span
.logo-text.d-none.d-lg-block.gl-ml-3
=
logo_text
-
if
Gitlab
.
com_and_canary?
=
link_to
'https://next.gitlab.com'
,
class:
'canary-badge bg-transparent'
,
target: :_blank
,
rel: :_noopener
do
=
link_to
'https://next.gitlab.com'
,
class:
'canary-badge bg-transparent'
,
data:
{
qa_selector:
'canary_badge_link'
},
target: :_blank
,
rel: :_noopener
do
%span
.gl-badge.gl-bg-green-500.gl-text-white.gl-rounded-pill.gl-font-weight-bold.gl-py-1
=
_
(
'Next'
)
...
...
qa/qa/page/main/menu.rb
View file @
7a197c32
...
...
@@ -11,6 +11,7 @@ module QA
view
'app/views/layouts/header/_default.html.haml'
do
element
:navbar
,
required:
true
element
:canary_badge_link
element
:user_avatar
,
required:
true
element
:user_menu
,
required:
true
element
:stop_impersonation_link
...
...
@@ -168,6 +169,16 @@ module QA
click_element
(
:stop_impersonation_link
)
end
# To verify whether the user has been directed to a canary web node
# @return [Boolean] result of checking existence of :canary_badge_link element
# @example:
# Menu.perform do |menu|
# expect(menu.canary?).to be(true)
# end
def
canary?
has_element?
(
:canary_badge_link
)
end
private
def
within_top_menu
(
&
block
)
...
...
qa/qa/runtime/browser.rb
View file @
7a197c32
...
...
@@ -219,6 +219,26 @@ module QA
yield
.
tap
{
clear!
}
if
block_given?
end
# To redirect the browser to a canary or non-canary web node
# after loading a subject test page
# @param [Boolean] Send to canary true or false
# @example:
# Runtime::Browser::Session.target_canary(true)
def
self
.
target_canary
(
enable_canary
)
if
QA
::
Runtime
::
Env
.
qa_cookies
.
to_s
.
include?
(
"gitlab_canary=true"
)
QA
::
Runtime
::
Logger
.
warn
(
"WARNING: Setting cookie through QA_COOKIES var is incompatible with this method."
)
return
end
browser
=
Capybara
.
current_session
.
driver
.
browser
if
enable_canary
browser
.
manage
.
add_cookie
name:
"gitlab_canary"
,
value:
"true"
else
browser
.
manage
.
delete_cookie
(
"gitlab_canary"
)
end
end
##
# Selenium allows to reset session cookies for current domain only.
#
...
...
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