-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[caps] | ||
platformName = "android" | ||
deviceName = "iPhone 6s" | ||
platformVersion = "9.3" | ||
autoAcceptAlerts = 'true' | ||
|
||
[appium_lib] | ||
require = ["../lib/requires.rb"] | ||
|
||
[simulators] | ||
android_devices = [ | ||
['iPhone 4s', '8.4'], | ||
['iPhone 6s', '9.3'], | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
AccountFeatures: | ||
login with valid test account: | ||
- AccountSteps | enter My Account page | ||
- AccountSteps | enter Login page | ||
- AccountSteps | input test EmailAddress | ||
- AccountSteps | input test Password | ||
- AccountSteps | login | ||
- AccountSteps | close coupon popup window(optional) | ||
|
||
login with valid production account: | ||
- AccountSteps | enter My Account page | ||
- AccountSteps | enter Login page | ||
- AccountSteps | input production EmailAddress | ||
- AccountSteps | input production Password | ||
- AccountSteps | login | ||
- AccountSteps | close coupon popup window(optional) | ||
|
||
logout: | ||
- AccountSteps | enter My Account page | ||
- SettingsSteps | enter Settings page | ||
- AccountSteps | logout | ||
|
||
Change Shipping Address to China: | ||
- AccountSteps | enter My Account page | ||
- SettingsSteps | enter ShoppingInfo page | ||
- SettingsSteps | enter ShippingAddress page | ||
- SettingsSteps | switch Shipping Address to China | ||
- SettingsSteps | confirm Shipping Address selection | ||
- SettingsSteps | back to last page |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
ForumFeatures: | ||
check Forum module: | ||
- ForumSteps | enter Forum page |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
MessageFeatures: | ||
enter follower zeng1 message page: | ||
- AccountSteps | enter My Account page | ||
- AccountSteps | enter Follower page | ||
- AccountSteps | enter zeng1 page from Follower page | ||
- AccountSteps | enter Message page from Pilot information page | ||
|
||
popup emoji image board: | ||
- MessageSteps | popup emoji image board | ||
|
||
input emoji image 😎: | ||
- MessageSteps | select 😎 | ||
|
||
input emoji image 😲: | ||
- MessageSteps | select 😲 | ||
|
||
input emoji image 😍: | ||
- MessageSteps | select 😍 | ||
|
||
send text message: | ||
- MessageSteps | input text message | ||
- MessageSteps | send message | ||
|
||
enter group message page: | ||
- AccountSteps | enter My Account page | ||
- MessageSteps | enter My Favorite page | ||
- MessageSteps | enter Testhahahahah detail page | ||
- MessageSteps | enter group chat |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
NearbyFeatures: | ||
check Nearby module: | ||
- NearbySteps | enter Nearby page |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
SettingsFeatures: | ||
initialize first startup: | ||
- SettingsSteps | agree share location | ||
|
||
Switch to test environment: | ||
- AccountSteps | enter My Account page | ||
- SettingsSteps | switch to test environment | ||
|
||
Change Country to China: | ||
- AccountSteps | enter My Account page | ||
- SettingsSteps | enter Settings page | ||
- SettingsSteps | enter Select Country page | ||
- SettingsSteps | select China | ||
- SettingsSteps | back to last page | ||
|
||
Change Country to HongKong: | ||
- AccountSteps | enter My Account page | ||
- SettingsSteps | enter Settings page | ||
- SettingsSteps | enter Select Country page | ||
- SettingsSteps | select HongKong | ||
- SettingsSteps | back to last page |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
StoreFeatures: | ||
add phantom 4 to cart: | ||
- StoreSteps | enter Store page | ||
- StoreSteps | enter Phantom 4 page | ||
- StoreSteps | add to cart | ||
- StoreSteps | view My Cart page | ||
|
||
finish order: | ||
- StoreSteps | checkout cart when logged in | ||
- StoreSteps | choose Shenzhen city(optional) | ||
- StoreSteps | confirm My Address(optional) | ||
- StoreSteps | choose cash on delivery | ||
- StoreSteps | confirm order | ||
- StoreSteps | back to Store page from order page |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# filename: android/lib/helpers/android_colorize.rb | ||
|
||
class String | ||
# colorization | ||
def colorize(color_code) | ||
if (defined? OUTPUT_WITH_COLOR) && (not OUTPUT_WITH_COLOR) | ||
self | ||
else | ||
"\e[#{color_code}m#{self}\e[0m" | ||
end | ||
end | ||
|
||
def black | ||
colorize(30) | ||
end | ||
|
||
def red | ||
colorize(31) | ||
end | ||
|
||
def green | ||
colorize(32) | ||
end | ||
|
||
def yellow | ||
colorize(33) | ||
end | ||
|
||
def blue | ||
colorize(34) | ||
end | ||
|
||
def magenta | ||
colorize(35) | ||
end | ||
|
||
def cyan | ||
colorize(36) | ||
end | ||
|
||
def white | ||
colorize(37) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# filename: android/lib/helpers/android_config_helper.rb | ||
require 'yaml' | ||
|
||
class Hash | ||
def method_missing(method, *opts) | ||
self[method.to_s] || super | ||
end | ||
end | ||
|
||
module Kernel | ||
def config | ||
YAML.load_file File.join(Dir.pwd, 'config.yml') | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# filename: android/lib/helpers/android_converter_helper.rb | ||
|
||
require_relative 'android_yaml_helper' | ||
|
||
def convert_yaml_to_csv(testcase_yaml_file_path) | ||
$LOG.info "Convert #{testcase_yaml_file_path} to CSV format test testcases.".green | ||
testcase_hash = load_testcase_yaml_file(testcase_yaml_file_path) | ||
features_suite = testcase_hash['features_suite'] | ||
testcase_csv_file_name = File.basename(testcase_yaml_file_path, ".*") + ".csv" | ||
testcase_csv_file_path = File.expand_path( | ||
File.join(File.dirname(testcase_yaml_file_path), testcase_csv_file_name) | ||
) | ||
titles = ['feature_name','step_desc','control_id','control_action','data','expectation','optional'] | ||
open(testcase_csv_file_path, 'w') do |f| | ||
f.puts titles.join(',') | ||
features_suite.each do |feature| | ||
feature_name = feature['feature_name'] | ||
feature['feature_steps'].each do |step| | ||
line_content_list = Array.new | ||
line_content_list << feature_name | ||
titles[1..-1].each do |title| | ||
line_content_list << "#{step[title]}" | ||
end | ||
f.puts line_content_list.join(',') | ||
feature_name = nil if feature_name | ||
end | ||
f.puts ",,,,,," | ||
end | ||
end | ||
$LOG.info "CSV format test testcases generated: #{testcase_csv_file_path}".green | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# filename: android/lib/helpers/android_csv_helper.rb | ||
|
||
require 'csv' | ||
|
||
def load_testcase_csv_file(testcase_csv_file_path) | ||
""" load csv format testcase file. | ||
output testcase_hash format example: { | ||
'testcase_name': 'Login and Logout', | ||
'features_suite': [ | ||
{ | ||
'feature_name': 'login with valid account', | ||
'feature_steps': [ | ||
{'control_id': 'btnMenuMyAccount', 'control_action': 'click', 'expectation': 'tablecellMyAccountSystemSettings', 'step_desc': 'enter My Account page'}, | ||
{'control_id': 'tablecellMyAccountLogin', 'control_action': 'click', 'expectation': 'btnForgetPassword', 'step_desc': 'enter Login page'}, | ||
{'control_id': 'txtfieldEmailAddress', 'control_action': 'type', 'data': '[email protected]', 'expectation': 'sectxtfieldPassword', 'step_desc': 'input EmailAddress'}, | ||
{'control_id': 'sectxtfieldPassword', 'control_action': 'type', 'data': 12345678, 'expectation': 'btnLogin', 'step_desc': 'input Password'}, | ||
{'control_id': 'btnLogin', 'control_action': 'click', 'expectation': 'tablecellMyMessage', 'step_desc': 'login'}, | ||
{'control_id': 'btnClose', 'control_action': 'click', 'expectation': nil, 'optional': true, 'step_desc': 'close coupon popup window(optional)'} | ||
] | ||
}, | ||
{ | ||
'feature_name': 'logout', | ||
'feature_steps': [ | ||
{'control_id': 'btnMenuMyAccount', 'control_action': 'click', 'expectation': 'tablecellMyAccountSystemSettings', 'step_desc': 'enter My Account page'}, | ||
{'control_id': 'tablecellMyAccountSystemSettings', 'control_action': 'click', 'expectation': 'txtCountryDistrict', 'step_desc': 'enter Settings page'}, | ||
{'control_id': 'btnLogout', 'control_action': 'click', 'expectation': 'uiviewMyAccount', 'step_desc': 'logout'} | ||
] | ||
} | ||
] | ||
} | ||
""" | ||
$LOG.info "load testcase csv file: #{testcase_csv_file_path}".magenta | ||
# the first line is titles by default | ||
row_num = 1 | ||
testcase_hash = Hash.new | ||
testcase_hash['testcase_name'] = File.basename(testcase_csv_file_path, ".csv") | ||
testcase_hash['features_suite'] = Array.new | ||
titles = Array.new | ||
feature = nil | ||
|
||
CSV.foreach(testcase_csv_file_path) do |row_content| | ||
if row_num == 1 | ||
titles = row_content | ||
# check whether titles are valid | ||
raise if titles[0] != "feature_name" | ||
row_num += 1 | ||
next | ||
end | ||
|
||
feature_name = row_content[0] | ||
step_desc = row_content[1] | ||
next unless (feature_name || step_desc) | ||
if feature_name | ||
feature = Hash.new | ||
feature["feature_name"] = feature_name | ||
feature["feature_steps"] = Array.new | ||
testcase_hash['features_suite'] << feature | ||
end | ||
|
||
step = Hash.new | ||
row_content[1..-1].each_with_index do |cell, index| | ||
title = titles[index+1] | ||
next if title.nil? | ||
step[title] = cell.strip unless cell.nil? | ||
end | ||
feature["feature_steps"] << step | ||
|
||
end | ||
testcase_hash | ||
end |