Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
构建
流水线
作业
流水线计划
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
杨林
GitLab
提交
20f9fe8a
提交
20f9fe8a
编辑于
1 year ago
作者:
Ross Byrne
提交者:
Doug Stull
1 year ago
浏览文件
操作
下载
补丁
差异文件
Improve use of sign up helper in feature specs
上级
2a606270
No related branches found
No related tags found
无相关合并请求
变更
3
隐藏空白变更内容
行内
左右并排
显示
3 个更改的文件
ee/spec/features/google_analytics_datalayer_spec.rb
+4
-17
4 个添加, 17 个删除
ee/spec/features/google_analytics_datalayer_spec.rb
ee/spec/features/users/signup_spec.rb
+4
-9
4 个添加, 9 个删除
ee/spec/features/users/signup_spec.rb
spec/features/users/signup_spec.rb
+11
-38
11 个添加, 38 个删除
spec/features/users/signup_spec.rb
有
19 个添加
和
64 个删除
ee/spec/features/google_analytics_datalayer_spec.rb
+
4
−
17
浏览文件 @
20f9fe8a
...
...
@@ -5,9 +5,8 @@
RSpec
.
describe
'GitLab.com Google Analytics DataLayer'
,
:js
,
feature_category: :application_instrumentation
do
include
JavascriptFormHelper
let!
(
:google_tag_manager_id
)
{
'GTM-WWKMTWS'
}
let!
(
:user_attrs
)
{
attributes_for
(
:user
,
first_name:
'GitLab'
,
last_name:
'GitLab'
,
company_name:
'GitLab'
,
phone_number:
'555-555-5555'
)
}
let
(
:google_tag_manager_id
)
{
'GTM-WWKMTWS'
}
let
(
:new_user
)
{
build
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
...
...
@@ -25,13 +24,7 @@
prevent_submit_for
(
'#new_new_user'
)
fill_in
'new_user_first_name'
,
with:
user_attrs
[
:first_name
]
fill_in
'new_user_last_name'
,
with:
user_attrs
[
:last_name
]
fill_in
'new_user_username'
,
with:
user_attrs
[
:username
]
fill_in
'new_user_email'
,
with:
user_attrs
[
:email
]
fill_in
'new_user_password'
,
with:
user_attrs
[
:password
]
click_button
'Continue'
fill_in_sign_up_form
(
new_user
,
'Continue'
)
data_layer
=
execute_script
(
'return window.dataLayer'
)
last_event_in_data_layer
=
data_layer
[
-
1
]
...
...
@@ -48,13 +41,7 @@
prevent_submit_for
(
'#new_new_user'
)
fill_in
'new_user_first_name'
,
with:
user_attrs
[
:first_name
]
fill_in
'new_user_last_name'
,
with:
user_attrs
[
:last_name
]
fill_in
'new_user_username'
,
with:
user_attrs
[
:username
]
fill_in
'new_user_email'
,
with:
user_attrs
[
:email
]
fill_in
'new_user_password'
,
with:
user_attrs
[
:password
]
click_button
'Register'
fill_in_sign_up_form
(
new_user
)
data_layer
=
execute_script
(
'return window.dataLayer'
)
last_event_in_data_layer
=
data_layer
[
-
1
]
...
...
此差异已折叠。
点击以展开。
ee/spec/features/users/signup_spec.rb
+
4
−
9
浏览文件 @
20f9fe8a
...
...
@@ -24,7 +24,8 @@
end
context
'with a user cap set'
,
:js
do
let_it_be
(
:admin
)
{
create
(
:user
,
:admin
)
}
let_it_be
(
:admin
,
freeze:
true
)
{
create
(
:user
,
:admin
)
}
let
(
:new_user
)
{
build
(
:user
)
}
before
do
stub_application_setting
(
require_admin_approval_after_user_signup:
false
)
...
...
@@ -32,18 +33,12 @@
stub_application_setting
(
new_user_signups_cap:
3
)
visit
new_user_registration_path
fill_in
'new_user_username'
,
with:
'bang'
fill_in
'new_user_email'
,
with:
'bigbang@example.com'
fill_in
'new_user_first_name'
,
with:
'Big'
fill_in
'new_user_last_name'
,
with:
'Bang'
fill_in
'new_user_password'
,
with:
User
.
random_password
end
context
'when the cap has not been reached'
do
before
do
perform_enqueued_jobs
do
click_button
'Regist
er
'
fill_in_sign_up_form
(
new_us
er
)
end
end
...
...
@@ -68,7 +63,7 @@
it
'sends notification email to the admin'
,
:sidekiq_inline
do
perform_enqueued_jobs
do
click_button
'Regist
er
'
fill_in_sign_up_form
(
new_us
er
)
end
cap_reached_notification_email
=
ActionMailer
::
Base
.
deliveries
.
find
do
|
m
|
...
...
此差异已折叠。
点击以展开。
spec/features/users/signup_spec.rb
+
11
−
38
浏览文件 @
20f9fe8a
...
...
@@ -67,16 +67,6 @@
end
shared_examples
'signup process'
do
def
fill_in_signup_form
fill_in
'new_user_username'
,
with:
new_user
.
username
fill_in
'new_user_email'
,
with:
new_user
.
email
fill_in
'new_user_first_name'
,
with:
new_user
.
first_name
fill_in
'new_user_last_name'
,
with:
new_user
.
last_name
fill_in
'new_user_password'
,
with:
new_user
.
password
wait_for_all_requests
end
def
confirm_email
new_user_token
=
User
.
find_by_email
(
new_user
.
email
).
confirmation_token
...
...
@@ -226,9 +216,7 @@ def confirm_email
it
'creates the user account and sends a confirmation email, and pre-fills email address after confirming'
do
visit
new_user_registration_path
fill_in_signup_form
expect
{
click_button
'Register'
}.
to
change
{
User
.
count
}.
by
(
1
)
expect
{
fill_in_sign_up_form
(
new_user
)
}.
to
change
{
User
.
count
}.
by
(
1
)
expect
(
page
).
to
have_current_path
users_almost_there_path
,
ignore_query:
true
expect
(
page
).
to
have_content
(
"Please check your email (
#{
new_user
.
email
}
) to confirm your account"
)
...
...
@@ -246,9 +234,7 @@ def confirm_email
it
'creates the user account and sends a confirmation email'
do
visit
new_user_registration_path
fill_in_signup_form
expect
{
click_button
'Register'
}.
to
change
{
User
.
count
}.
by
(
1
)
expect
{
fill_in_sign_up_form
(
new_user
)
}.
to
change
{
User
.
count
}.
by
(
1
)
expect
(
page
).
to
have_current_path
dashboard_projects_path
end
end
...
...
@@ -262,8 +248,7 @@ def confirm_email
it
'creates the user account and goes to dashboard'
do
visit
new_user_registration_path
fill_in_signup_form
click_button
"Register"
fill_in_sign_up_form
(
new_user
)
expect
(
page
).
to
have_current_path
dashboard_projects_path
end
...
...
@@ -277,9 +262,7 @@ def confirm_email
it
'creates the user but does not sign them in'
do
visit
new_user_registration_path
fill_in_signup_form
expect
{
click_button
'Register'
}.
to
change
{
User
.
count
}.
by
(
1
)
expect
{
fill_in_sign_up_form
(
new_user
)
}.
to
change
{
User
.
count
}.
by
(
1
)
expect
(
page
).
to
have_current_path
new_user_session_path
,
ignore_query:
true
expect
(
page
).
to
have_content
(
<<~
TEXT
.
squish
)
You have signed up successfully. However, we could not sign you in
...
...
@@ -294,8 +277,7 @@ def confirm_email
create
(
:user
,
email:
new_user
.
email
)
visit
new_user_registration_path
fill_in_signup_form
click_button
"Register"
fill_in_sign_up_form
(
new_user
)
expect
(
page
).
to
have_current_path
user_registration_path
,
ignore_query:
true
expect
(
page
).
to
have_content
(
"error prohibited this user from being saved"
)
...
...
@@ -306,8 +288,7 @@ def confirm_email
create
(
:user
,
email:
new_user
.
email
)
visit
new_user_registration_path
fill_in_signup_form
click_button
"Register"
fill_in_sign_up_form
(
new_user
)
expect
(
page
).
to
have_current_path
user_registration_path
,
ignore_query:
true
expect
(
page
.
body
).
not_to
match
(
/
#{
new_user
.
password
}
/
)
...
...
@@ -328,8 +309,7 @@ def confirm_email
visit
new_user_registration_path
expect
(
page
).
to
have_content
(
terms_text
)
fill_in_signup_form
click_button
'Register'
fill_in_sign_up_form
(
new_user
)
expect
(
page
).
to
have_current_path
(
dashboard_projects_path
)
end
...
...
@@ -357,9 +337,7 @@ def confirm_email
it
'prevents from signing up'
do
visit
new_user_registration_path
fill_in_signup_form
expect
{
click_button
'Register'
}.
not_to
change
{
User
.
count
}
expect
{
fill_in_sign_up_form
(
new_user
)
}.
not_to
change
{
User
.
count
}
expect
(
page
).
to
have_content
(
_
(
'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'
))
expect
(
page
).
to
have_content
(
"Minimum length is
#{
Gitlab
::
CurrentSettings
.
minimum_password_length
}
characters"
)
...
...
@@ -370,9 +348,7 @@ def confirm_email
it
'prevents from signing up'
do
visit
new_user_registration_path
fill_in_signup_form
expect
{
click_button
'Register'
}.
not_to
change
{
User
.
count
}
expect
{
fill_in_sign_up_form
(
new_user
)
}.
not_to
change
{
User
.
count
}
expect
(
page
).
to
have_content
(
'That was a bit too quick! Please resubmit.'
)
end
end
...
...
@@ -381,9 +357,7 @@ def confirm_email
it
'allows visiting of a page after initial registration'
do
visit
new_user_registration_path
fill_in_signup_form
click_button
'Register'
fill_in_sign_up_form
(
new_user
)
visit
new_project_path
...
...
@@ -394,8 +368,7 @@ def confirm_email
create
(
:user
,
email:
new_user
.
email
)
visit
new_user_registration_path
fill_in_signup_form
click_button
"Register"
fill_in_sign_up_form
(
new_user
)
expect
(
page
).
to
have_current_path
user_registration_path
,
ignore_query:
true
expect
(
page
.
body
).
not_to
match
(
/
#{
new_user
.
password
}
/
)
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录