Skip to content

Instantly share code, notes, and snippets.

@up1
Created December 11, 2015 07:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save up1/ef3bd1835e6e75bcc0be to your computer and use it in GitHub Desktop.
Save up1/ef3bd1835e6e75bcc0be to your computer and use it in GitHub Desktop.
iTax pro with Calabash for android
Feature: Try to create automated test
Scenario: As a poor user I can log into app
When ทำการ login เข้าใช้งาน
And กรอกข้อมูลรายได้
And กรอกข้อมูลลดหย่อน
Then ข้อมูลต่าง ๆ แสดงในหน้าสรุป
require 'calabash-android/calabash_steps'
When(/^ทำการ login เข้าใช้งาน$/) do
enter_text("* id:'email_edit_text'", "xxx")
press_enter_button
enter_text("* id:'password_edit_text'", "yyy")
press_enter_button
tap_when_element_exists("* id:'login_button'")
end
Then(/^กรอกข้อมูลรายได้$/) do
tap_when_element_exists("* id:'income_button'")
steps %Q{
Then กรอกข้อมูลเงินเดือน
}
end
Then(/^กรอกข้อมูลเงินเดือน$/) do
tap_when_element_exists("* text:'เงินเดือน/ค่าจ้าง 40(1),(2)'")
tap_when_element_exists("* text:'เงินเดือน 40(1)'")
sleep(2)
touch(query("* id:'custom_input_currency_number'")[1])
tap_when_element_exists("* id:'delete_button'")
tap_when_element_exists("* id:'bt2'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'btDone'")
end
Then(/^กรอกข้อมูลลดหย่อน$/) do
sleep(1)
tap_when_element_exists("* id:'deduct_button'")
tap_when_element_exists("* text:'ประกันสังคม'")
sleep(1)
tap_when_element_exists("* id:'custom_input_currency_number'")
tap_when_element_exists("* id:'delete_button'")
tap_when_element_exists("* id:'bt2'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'bt0'")
tap_when_element_exists("* id:'btDone'")
tap_when_element_exists("* id:'done_button'")
end
Then(/^ข้อมูลต่าง ๆ แสดงในหน้าสรุป$/) do
sleep(1)
tap_when_element_exists("* id:'summary_button'")
steps %Q{
Then ออกจากระบบ
}
end
Then(/^ออกจากระบบ$/) do
sleep(1)
tap_when_element_exists("* id:'home_button'")
tap_when_element_exists("* id:'account_button'")
tap_when_element_exists("* text:'Logout'")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment