이미지 로테이터/사이클이 작동하는지 테스트하기 위해 Cucumber/Watir 테스트 작업. 내 전략은 css 클래스에 의해 회전 자의 활성 이미지를 잡아서 변수에 덤프하는 것입니다. 그런 다음 다음 버튼을 클릭하고 css 클래스에 의해 로테이터에서 현재 이미지 (새 이미지이어야 함)를 잡고 두 번째 변수로 덤프합니다. 그렇다면 img_rot_1! = img_rot_2을 말하고 테스트가 true 또는 false를 반환하도록 할 수 있어야합니다. 이것은 내가 곤경에 빠졌던 부분이다.Watir 동등성 테스트
저는 루비를 처음 접했기 때문에 간단한 것을 놓치기도합니다. 여기 테스트가 있습니다. !
require 'step_definition/setup'
test_setup = Wsetup.new 'http://loginurl', 'uname', 'pass' # browser object created here as # test_setup.b
img_rot_1 = String.new
img_rot_2 = String.new
When /^I click the next image button$/ do
test_setup.do_login
test_setup.b.goto('http://psu.dev1.fayze2.com/node/56')
img_rot_1 = test_setup.b.li(:class => 'flex-active-slide').img.src
test_setup.b.link(:class => 'flex-next').click
end
Then /^the rotator should move to the next image$/ do
img_rot_2 = test_setup.b.li(:class => 'flex-active-slide').img.src
img_rot_1 != img_rot_2
end
img_rot_1 = img_rot_2 및 img_rot_1 == img_rot_2 모두 패스 - 내가 무엇을 놓치고?