Skip to content

Commit

Permalink
2018-10-9 first commit all files
Browse files Browse the repository at this point in the history
  • Loading branch information
kurapi committed Oct 9, 2018
1 parent 83be1b5 commit 2a6855e
Show file tree
Hide file tree
Showing 432 changed files with 33,834 additions and 0 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/jsLinters/jscs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions .idea/untitled2.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vagrant.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,098 changes: 1,098 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file added AutoItX3.dll
Binary file not shown.
14 changes: 14 additions & 0 deletions android/appium.txt
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'],
]
30 changes: 30 additions & 0 deletions android/features/Account.yml
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
4 changes: 4 additions & 0 deletions android/features/Forum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
ForumFeatures:
check Forum module:
- ForumSteps | enter Forum page
29 changes: 29 additions & 0 deletions android/features/Message.yml
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
4 changes: 4 additions & 0 deletions android/features/Nearby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
NearbyFeatures:
check Nearby module:
- NearbySteps | enter Nearby page
22 changes: 22 additions & 0 deletions android/features/Settings.yml
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
15 changes: 15 additions & 0 deletions android/features/Store.yml
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
44 changes: 44 additions & 0 deletions android/lib/helpers/android_colorize.rb
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
14 changes: 14 additions & 0 deletions android/lib/helpers/android_config_helper.rb
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
31 changes: 31 additions & 0 deletions android/lib/helpers/android_converter_helper.rb
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
70 changes: 70 additions & 0 deletions android/lib/helpers/android_csv_helper.rb
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
Loading

0 comments on commit 2a6855e

Please sign in to comment.