이메일 주소와 비밀번호 확인 필드에 "확인"이라는 라벨이있는 양식 페이지가 있습니다. 예상대로 RSpec을 사용하여 실행하면이 작업이 실패합니다. 레이블을 고유하게 만들면 전자 메일 레이블을 "전자 메일 확인"으로 변경하여 통과합니다. 오히려 레이블을 동일하게 유지하고 싶습니다. form_for에서 생성 한 전자 메일 ID를 사용하면 Capybara가 만족스럽지 만 테스트가 실패합니다. 나는 또한 같은 결과로 이름을 시도했다.카피 바라는 중복 라벨로 입력란을 작성하지 않습니다
RSpec에/카피 바라 추출물 : 추출물 form_for
fill_in "company_contact_email_confirmation", with: "[email protected]"
:
<div class="field">
<%= f.label :contact_email_confirmation, "Confirmation" %><br />
<%= f.email_field :contact_email_confirmation %>
</div>
생성 된 소스 :
<div class="field">
<label for="company_contact_email_confirmation">Confirmation</label><br>
<input id="company_contact_email_confirmation" name="company[contact_email_confirmation]" size="30" type="email">
</div>
오류 메시지 : 회사 페이지 버지니아와 제휴 프로그램에 가입
1) 다른 여기에 제안 된대로 내가, 카피 바라 within
사용하는 경우 뚜껑 정보 회사
Failure/Error: expect { click_button submit }.to change(Company, :count).by (1)
count should have been changed by 1, but was changed by 0
를 만들어야합니다, 그것은 여전히 작동하지 않습니다
RSpec에/카피 바라 추출물 :
within ".email_stuff" do
fill_in "Confirmation", with: "[email protected]"
end
을 추출 form_for :
<div class="email_stuff">
<div class="field">
<%= f.label :contact_email_confirmation, "Confirmation" %><br />
<%= f.email_field :contact_email_confirmation %>
</div>
</div>
생성 된 출처 :
<div class="email_stuff">
<div class="field">
<label for="company_contact_email_confirmation">Confirmation</label><br />
<input id="company_contact_email_confirmation" name="company[contact_email_confirmation]" size="30" type="email" />
</div>
</div>
카피 바라는 불평하지 않는 것 같지만 테스트는 동일한 오류로 실패합니다. 같은 양식에서 같은 레이블을 두 번 사용할 수있게하려면 어떻게해야합니까?
테스트를 정의한 곳에서 브라우저에 일어나는 일을 시각화하기 위해이 ": js => true"를 추가하십시오 (페이지가 나타납니다) – cristian
셀레늄 - 웹 드라이버를 얻는 데 많은 어려움을 겪었습니다 Firefox와 함께 실행합니다. 많은 노력 끝에 (마침내 파이어 폭스 10과 셀레늄 - webdriver 2.20.0) 나는 "안전한 연결을 유지할 수 없다"라는 문구가 생기거나 비슷하게 생기고 즉시 닫힙니다. 첫 번째 fill_in 필드에서 Capybara :: ElementNotFound에 대한 테스트가 실패합니다. 테스트가 통과하는 중복 레이블이 없기 때문에 올바르지 않습니다. –