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
4f003d30
Commit
4f003d30
authored
Dec 30, 2020
by
Ramya Authappan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'qa-shl-fix-register-spec' into 'master'
Stablize register spec See merge request gitlab-org/gitlab!50675
parents
046c804b
0699f7a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
38 deletions
+49
-38
qa/qa/flow/sign_up.rb
qa/qa/flow/sign_up.rb
+23
-25
qa/qa/page/base.rb
qa/qa/page/base.rb
+4
-1
qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb
...specs/features/browser_ui/1_manage/login/register_spec.rb
+22
-12
No files found.
qa/qa/flow/sign_up.rb
View file @
4f003d30
...
...
@@ -6,36 +6,34 @@ module QA
module_function
def
sign_up!
(
user
)
Page
::
Main
::
Menu
.
perform
(
&
:sign_out_if_signed_in
)
Page
::
Main
::
Login
.
perform
(
&
:switch_to_register_page
)
Page
::
Registration
::
SignUp
.
perform
do
|
sign_up
|
sign_up
.
fill_new_user_first_name_field
(
user
.
first_name
)
sign_up
.
fill_new_user_last_name_field
(
user
.
last_name
)
sign_up
.
fill_new_user_username_field
(
user
.
username
)
sign_up
.
fill_new_user_email_field
(
user
.
email
)
sign_up
.
fill_new_user_password_field
(
user
.
password
)
# Because invisible_captcha would prevent submitting this form
# within 4 seconds, sleep here. This can be removed once we
# implement invisible_captcha as an application setting instead
# of a feature flag, so we can turn it off while testing.
# Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/284113
sleep
5
sign_up
.
click_new_user_register_button
end
success
=
Support
::
Retrier
.
retry_until
(
raise_on_failure:
false
)
do
Page
::
Registration
::
SignUp
.
perform
do
|
sign_up
|
sign_up
.
fill_new_user_first_name_field
(
user
.
first_name
)
sign_up
.
fill_new_user_last_name_field
(
user
.
last_name
)
sign_up
.
fill_new_user_username_field
(
user
.
username
)
sign_up
.
fill_new_user_email_field
(
user
.
email
)
sign_up
.
fill_new_user_password_field
(
user
.
password
)
# Because invisible_captcha would prevent submitting this form
# within 4 seconds, sleep here. This can be removed once we
# implement invisible_captcha as an application setting instead
# of a feature flag, so we can turn it off while testing.
# Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/284113
sleep
5
sign_up
.
click_new_user_register_button
end
Page
::
Registration
::
Welcome
.
perform
(
&
:click_get_started_button_if_available
)
Page
::
Registration
::
Welcome
.
perform
(
&
:click_get_started_button_if_available
)
if
user
.
expect_fabrication_success
Page
::
Main
::
Menu
.
perform
(
&
:has_personal_area?
)
else
Page
::
Main
::
Menu
.
perform
(
&
:not_signed_in?
)
end
success
=
if
user
.
expect_fabrication_success
Page
::
Main
::
Menu
.
perform
(
&
:has_personal_area?
)
else
Page
::
Main
::
Menu
.
perform
(
&
:not_signed_in?
)
end
raise
"Failed
to register the user
"
unless
success
raise
"Failed
user registration attempt. Registration was expected to
#{
user
.
expect_fabrication_success
?
'succeed'
:
'fail'
}
but
#{
success
?
'succeeded'
:
'failed'
}
.
"
unless
success
end
def
disable_sign_ups
...
...
qa/qa/page/base.rb
View file @
4f003d30
...
...
@@ -135,8 +135,11 @@ module QA
def
check_element
(
name
)
retry_until
(
sleep_interval:
1
)
do
find_element
(
name
).
set
(
true
)
checked
=
find_element
(
name
).
checked?
find_element
(
name
).
checked?
QA
::
Runtime
::
Logger
.
debug
(
checked
?
"
#{
name
}
was checked"
:
"
#{
name
}
was not checked"
)
checked
end
end
...
...
qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb
View file @
4f003d30
...
...
@@ -98,8 +98,10 @@ module QA
before
do
enable_require_admin_approval_after_user_signup_via_ui
@user
=
Resource
::
User
.
fabricate_via_browser_ui!
do
|
user
|
user
.
expect_fabrication_success
=
false
Support
::
Retrier
.
retry_on_exception
do
@user
=
Resource
::
User
.
fabricate_via_browser_ui!
do
|
user
|
user
.
expect_fabrication_success
=
false
end
end
end
...
...
@@ -148,26 +150,34 @@ module QA
end
def
set_require_admin_approval_after_user_signup_via_api
(
enable_or_disable
)
return
if
Runtime
::
ApplicationSettings
.
get_application_settings
[
:require_admin_approval_after_user_signup
]
==
enable_or_disable
return
if
get_require_admin_approval_after_user_signup_via_api
==
enable_or_disable
Runtime
::
ApplicationSettings
.
set_application_settings
(
require_admin_approval_after_user_signup:
enable_or_disable
)
sleep
10
# It takes a moment for the setting to come into effect
end
def
get_require_admin_approval_after_user_signup_via_api
Runtime
::
ApplicationSettings
.
get_application_settings
[
:require_admin_approval_after_user_signup
]
end
def
enable_require_admin_approval_after_user_signup_via_ui
unless
Runtime
::
ApplicationSettings
.
get_application_settings
[
:require_admin_approval_after_user_signup
]
Flow
::
Login
.
while_signed_in_as_admin
do
Page
::
Main
::
Menu
.
perform
(
&
:go_to_admin_area
)
QA
::
Page
::
Admin
::
Menu
.
perform
(
&
:go_to_general_settings
)
Page
::
Admin
::
Settings
::
General
.
perform
do
|
setting
|
setting
.
expand_sign_up_restrictions
do
|
settings
|
settings
.
require_admin_approval_after_user_signup
unless
get_require_admin_approval_after_user_signup_via_api
QA
::
Support
::
Retrier
.
retry_until
do
Flow
::
Login
.
while_signed_in_as_admin
do
Page
::
Main
::
Menu
.
perform
(
&
:go_to_admin_area
)
QA
::
Page
::
Admin
::
Menu
.
perform
(
&
:go_to_general_settings
)
Page
::
Admin
::
Settings
::
General
.
perform
do
|
setting
|
setting
.
expand_sign_up_restrictions
do
|
settings
|
settings
.
require_admin_approval_after_user_signup
end
end
end
end
sleep
10
# It takes a moment for the setting to come into effect
sleep
15
# It takes a moment for the setting to come into effect
get_require_admin_approval_after_user_signup_via_api
end
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