- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在尝试使用此功能规范时难以隔离问题。
require 'spec_helper'
feature 'Add Employee', type: :feature do
scenario 'with valid information' do
# visit setup_add_employees_path
visit '/setup/add_employees'
# save_and_open_page
fill_in "First Name", with: 'Test'
fill_in 'Last Name', with: 'Employee'
fill_in 'Email', with: 'testemployee@example.com'
# fill_in , with: 'testemployee@example.com'
# expect(page).to find_field('First Name').value
end
end
# add_employees.html.haml
= render "partials/nav_left_setup"
- model_class = Invitation.new.class
#alert_message
.page-header
%h1 Invite Your Employees
%p.lead Now it's time to add your employees to HuddleHR. We'll send an email to your employees when setup is complete. Don't worry, the email will include instructions on how to setup their account and update their personal information.
%p.lead
If you like, you can import your employee list from an
= succeed "." do
%a#show_import_form{ href: "#" } Excel file
= render "partials/setup_import_employees"
= nested_form_for @account, :html => {:class => "invitation"} do |f|
%br/
= f.fields_for :invitations, @invitations do |invitation_form|
= invitation_form.hidden_field :product_id, :value => "1"
= invitation_form.text_field :first_name, :class => "input-small", :placeholder => "First Name", :required => :true
= invitation_form.text_field :last_name, :class => "input-small", :placeholder => "Last Name", :required => :true
%span= invitation_form.email_field :email, :class => "text_field", :placeholder => "Email Address", :required => :true
= invitation_form.collection_select :team_id, @teams, :id, :name
- if invitation_form.object.new_record?
= hidden_field_tag :invitaion_new_record, "new record"
= link_to "Delete", "javascript:void(0);", :class => "btn btn-danger delete_invitation_row_button", :style => "margin-bottom: 12px"
- else
= link_to "Delete", invitation_form.object, :confirm => "Are you sure?", :method => :delete, :remote => true, :class => "btn btn-danger btn-delete destroy_duplicate_nested_form", :style => "margin-bottom: 12px"
= f.link_to_add raw("<i class=\"icon-plus-sign icon-white\"></i> Add An Employee"), :invitations, class: "btn btn-success"
.form-actions
= link_to "Back", @optional_step.prv_link, class: "btn"
= f.submit "Save & Continue", :class => "btn btn-primary"
= link_to "Skip This Step", @optional_step.next_link, class: "btn" if @optional_step.optional == true
# The accounts_controller's create method
def create # TODO we need to document this...
@account = Account.new(params[:account])
if @account.save
# Send the account setup email to the account creator
UserMailer.account_setup_email(current_user).deliver
current_user.add_role!(User::ROLES[0]) # asigning the role roster_admin
current_user.add_role!(User::ROLES[3]) # asigning the role employee
# Sign the account up for Roster and create some inital records like:
# Register Roster as a product the account has subscribed to.
AccountProduct.create!(:account_id => @account.id, :product_id => Product.where(:name => "Roster").first.id)
# Create the account holder's profile
Profile.create!(:user_id => current_user.id, :first_name => @account.account_owner_first_name_input, :last_name => @account.account_owner_last_name_input)
# Create their first default team so they have a place to keep people
Team.create!(name: "Example Team", description: "This is just a placeholder team. You can rename or delete it.", account_id: @account.id, manager_id: current_user.id)
# Create their first job description so they have a place to keep people
JobDescription.create!(title: "Example Job Description", description: "This is just a placeholder job description. You can rename or delete it.", account_id: @account.id)
# Create a first post for the company so they have something on their homepage...
Post.create!(title: "Welcome to HuddleHR", body: "The simple and easy way to manage employee information in the cloud. You can invite employees, setup your org chart, fill out your profile and more.", account_id: @account.id, author_id: current_user.id, scope_id: "1")
# Create the initial employment record
Employment.create!(:user_id => current_user.id, :team_id => Team.find_by_account_id(@account.id).id, :effective_date => Date.today, :comment => "Initial creation of HuddleHR account owner employment record.")
# Set the User.account_id to the created account.id
current_user.update_attributes!(:account_id => @account.id)
setup_steps = @account.product_setup_steps
current_step = ProductSetupStep.where("link =? AND product_id =?", URI(request.referer).path, 1).first # Getting the current step
if current_step
setup_steps << ProductSetupStep.where("link =? AND product_id =?", URI(request.referer).path, 1).first
setup_steps << ProductSetupStep.where("step_number =? AND product_id =?", 1, 1).first
redirect_to current_step.next_link, :notice => 'Your account was successfully created.' if current_step.next_link.present?
redirect_to account_path(@account), :notice => 'Your account was successfully created.' unless current_step.next_link.present?
else
redirect_to account_path(@account), :notice => 'Your account was successfully created.'
end
else
render :action => "new"
end
end
# the imacros file, which I'm told is similar to selenium
' Add Employee
TAG POS=1 TYPE=A ATTR=TXT:Add<SP>An<SP>Employee
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:edit_account_* ATTR=ID:account_invitations_attributes_*_first_name CONTENT=Test
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:edit_account_* ATTR=ID:account_invitations_attributes_*_last_name CONTENT=Employee{{!VAR1}}
TAG POS=1 TYPE=INPUT:EMAIL FORM=ID:edit_account_* ATTR=ID:account_invitations_attributes_*_email CONTENT=testemployee{{!VAR1}}@huddlehr.com
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:edit_account_* ATTR=NAME:commit
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:edit_account_* ATTR=NAME:commit
TAG POS=1 TYPE=A ATTR=TXT:Send<SP>Invitations<SP>To<SP>These<SP>Employees
TAG POS=1 TYPE=A ATTR=TXT:Finish<SP>Setup
TAG POS=1 TYPE=A ATTR=TXT:Finish
# create_account_spec.rb
require 'spec_helper'
# require 'ruby-debug'
feature 'Create Account', type: :feature do
background do
sign_up_with Faker::Internet.email, '1Password'
end
scenario 'Fill form data' do
# visit '/setup'
visit new_account_path
fill_in 'First Name', with: 'Test'
fill_in 'Last Name', with: 'Owner'
fill_in 'Company Name', with: 'Company'
fill_in :account_addresses_attributes_0_line_one, with: '133 Main St'
fill_in :account_addresses_attributes_0_city, with: 'Columbia'
select 'SC', from: 'State'
fill_in :account_addresses_attributes_0_zip, with: '11111'
fill_in :account_phone_numbers_attributes_0_number, with: '(111) 111-11111'
select '(GMT-05:00) Eastern Time (US & Canada)', from: 'Time zone'
click_button('Save & Continue')
end
end
最佳答案
好的,所以我理解的问题是我没有正确设置我的背景来模仿多表单集成规范的第 2 部分在站点中的位置。我通过使用 FactoryGirl 创建一个用户来解决这个问题,然后使用 Capybara 的 fill_in 和 user.email && user.password 而不是像上面看到的那样使用 faker。
这是我目前的规范:
# spec/features/add_employee_spec.rb
require 'spec_helper'
feature 'Add Employee', type: :feature do
background do
user = create :user
visit user_session_path
fill_in 'Email', with: user.email
fill_in 'Password', with: user.password
click_button 'Sign In'
expect(page).to have_content('Setup An Account')
end
scenario 'clicks Add A New Employee and fills out the form' do
account = create :account
save_and_open_page
visit setup_add_employees_path
fill_in 'first_name', with: 'Test'
fill_in 'Last Name', with: 'Employee'
fill_in 'Email', with: 'testemployee@example.com'
end
end
关于ruby-on-rails - Capybara:ElementNotFound:无法在多部分表单上找到字段名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22445115/
我在 mongodb 中的玩家和锦标赛之间存在多对多关系。 我希望能够一次将许多玩家添加到锦标赛中。如果没有 ajax,这很简单,但我们有一个包含数千名玩家的数据库,因此表单选择变得巨大。 我们想为此
这个问题已经有答案了: When should I use html's and when spring's in Spring MVC web app? (3 个回答) 已关闭 6 年前。 我正
我正在 C++ Builder XE4 上使用 VCL。 我有以下组件。 FormMain 具有 TButton *B_select; FormSelect(或DialogSelect)具有 TCom
如何在不影响表单控件的情况下更改表单的 alphablend? 德尔福XE7 最佳答案 此问题的一个解决方案是使用多设备应用程序(如果无法使用VCL)。 如果您需要保留透明的TForm,只需更改属性T
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我正在尝试扩展 Django 注册以包含我自己的注册表单。原则上这是相当简单的。我只需要编写自己的表单( CustomRegistrationForm ),它是原始表单( RegistrationFo
我正在尝试为我的网站实现聊天功能。为了做到这一点,我遵循了以下教程:https://channels.readthedocs.io/en/latest/tutorial/ 然后我稍微更改了代码以实现它
有一个问题,我需要用一个 html 表单提交两个相互关联的模型表单。我知道如何提交两个单独的表格,但是在相关模型表格的情况下外键让我发疯。 问题是,第二个表单应该用外键填充字段到第一个表单的实例。 在
我正在创建一个工具,允许某人输入食谱,然后将其保存为 XML 文件,我已经创建了 XSD,但我想知道如何在我的网页上制作一个表单以允许用户输入他们的食谱并遵守模式。我一直在研究 Ajax 和 Jque
在 .net win 表单(如 asp.net web 表单)中是否有可用的验证控件? 因为很难为我的每个控件设置正确的条件,所以我的表单中也有很多重复的代码。 正确的做法是什么? 最佳答案 看看这个
我有一个简短的问题。我正在学习如何使用 javascript 制作注册表,发现此链接非常有用。 http://www.w3resource.com/javascript/form/javascript
我正在开发一个项目,该项目将使用循环将许多表单添加到 mysql 数据库中。在 javascript 部分中,我无法让 var i 在函数 updatesum() 中工作。有人可以帮我吗? 我试图避免
在我的应用程序上有一个包含 2 个字段和一个保存按钮的表单。 在我的 onClick 结束时我需要什么来将光标返回到第一个字段。 我有这个来清除它们 txtData.setText("
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
<input type="text" name="textfield" onKeyPress="javascript:alert(event.
我正在构建的网站有一个登录表单,作为所有其他模板扩展的 base.html 模板的一部分;因此,我需要以某种方式处理每个页面上的登录/注销逻辑。 目前每个页面都在单独的 View 中加载,那么实现它的
我有一个表单类,看起来像.. #forms.py class ExampleForm(forms.Form): color = forms.CharField(max_length=25)
有没有办法在表单定义中给表单一个特殊的错误渲染函数?在 customizing-the-error-list-format 下的文档中它展示了如何为表单提供特殊的错误呈现函数,但似乎您必须在实例化表单
我正在处理由多个页面组成的表单,我想解决验证问题。 当我点击提交按钮时,当前页面上的所有字段都会在下方显示错误消息,但是如果我更改页面,那么我需要再次点击提交,因为这些字段未设置为已触摸。 如果我可以
是否可以附加到继承表单的 exclude 或 widgets 变量? 到目前为止,我有以下设置。 class AddPropertyForm(forms.ModelForm): num_mon
我是一名优秀的程序员,十分优秀!