无法为场景创建 Calabash 步骤定义
Not able to create Calabash step definition for scenario
我是 Calabash 的新手,正在尝试为功能文件下方的各个场景创建步骤定义(QA 看起来可能是重复的,但在 SOF 中找不到答案)如何使用 UIAutomator 查看器工具生成步骤定义。附上 ref 的错误屏幕截图,如有任何帮助,我们将不胜感激。
Feature: Valid Login
Scenario: Login with valid mobile number
When I see "Login/Signup" screen
And I enter "72046606**" in "etMobilNumber" text field
And I click on "Login/Signup" button
And I enter "WebDriver12" in "etPassword" text field
And I click on "Login" button
And I wait
Then I see "Enter mPIN" screen
Scenario: Login with valid mPIN
When I see "Enter mPIN" screen
And I click on "2" button
And I click on "3" button
And I click on "6" button
And I click on "9" button
And I wait
Then I see "J****" text
Scenario: Launch Money Transfer screen
When I see "J*****" screen
And I click on "MoneyTransfer" button
And I click on "Send Money" text
And I wait
Then I see "Send Money" text
特征文件:
Feature: Login
Scenario: I should login via valid credentials
When I enter mobile number "7204660611" into mobile number input field with "ID"
Then I see "Login/Signup" button as enable
And I tap "Login/Signup" button
Then I wait 60 seconds
Then I see "Password" field
And I enter Password "WebDriver12" input Password input field with "ID"
Then I tap "Login" button
Then I should get new page
步骤定义:
require 'calabash-android/calabash_steps'
When(/^I enter mobile number "([^"]*)" into mobile number input field with "([^"]*)"$/) do |mobileNumber, etMobileNumber|
enter_text("* marked:'etMobileNumber'","***34*****")
end
Then(/^I see "([^"]*)" button as enable$/) do |arg1|
if query("* marked:'btnSignin'",:enabled).first.eql?true
else
raise "FAILED!!! Invalid Mobile number"
end
end
Then(/^I tap "([^"]*)" button$/) do |arg1|
touch("* marked:'btnSignin'")
end
Then(/^I wait (\d+) seconds$/) do |arg1|
wait_for_element_exists("* marked:'etPassword'")
end
Then(/^I see "([^"]*)" field$/) do |arg1|
if query("* marked:'etPassword'",:enabled).first.eql?true
else
fail "Failed!! Password field not present"
end
end
Then(/^I enter Password "([^"]*)" input Password input field with "([^"]*)"$/) do |arg1, arg2|
enter_text("* marked:'etPassword'","WebD*****")
end
Then(/^I should get new page$/) do
wait_for_element_exists("* marked:'Enter mPIN'")
end
我是 Calabash 的新手,正在尝试为功能文件下方的各个场景创建步骤定义(QA 看起来可能是重复的,但在 SOF 中找不到答案)如何使用 UIAutomator 查看器工具生成步骤定义。附上 ref
Feature: Valid Login
Scenario: Login with valid mobile number
When I see "Login/Signup" screen
And I enter "72046606**" in "etMobilNumber" text field
And I click on "Login/Signup" button
And I enter "WebDriver12" in "etPassword" text field
And I click on "Login" button
And I wait
Then I see "Enter mPIN" screen
Scenario: Login with valid mPIN
When I see "Enter mPIN" screen
And I click on "2" button
And I click on "3" button
And I click on "6" button
And I click on "9" button
And I wait
Then I see "J****" text
Scenario: Launch Money Transfer screen
When I see "J*****" screen
And I click on "MoneyTransfer" button
And I click on "Send Money" text
And I wait
Then I see "Send Money" text
特征文件:
Feature: Login
Scenario: I should login via valid credentials
When I enter mobile number "7204660611" into mobile number input field with "ID"
Then I see "Login/Signup" button as enable
And I tap "Login/Signup" button
Then I wait 60 seconds
Then I see "Password" field
And I enter Password "WebDriver12" input Password input field with "ID"
Then I tap "Login" button
Then I should get new page
步骤定义:
require 'calabash-android/calabash_steps'
When(/^I enter mobile number "([^"]*)" into mobile number input field with "([^"]*)"$/) do |mobileNumber, etMobileNumber|
enter_text("* marked:'etMobileNumber'","***34*****")
end
Then(/^I see "([^"]*)" button as enable$/) do |arg1|
if query("* marked:'btnSignin'",:enabled).first.eql?true
else
raise "FAILED!!! Invalid Mobile number"
end
end
Then(/^I tap "([^"]*)" button$/) do |arg1|
touch("* marked:'btnSignin'")
end
Then(/^I wait (\d+) seconds$/) do |arg1|
wait_for_element_exists("* marked:'etPassword'")
end
Then(/^I see "([^"]*)" field$/) do |arg1|
if query("* marked:'etPassword'",:enabled).first.eql?true
else
fail "Failed!! Password field not present"
end
end
Then(/^I enter Password "([^"]*)" input Password input field with "([^"]*)"$/) do |arg1, arg2|
enter_text("* marked:'etPassword'","WebD*****")
end
Then(/^I should get new page$/) do
wait_for_element_exists("* marked:'Enter mPIN'")
end