This commit is contained in:
shekhar-cis 2021-08-25 16:27:13 +05:30
parent 8936194c5d
commit 99f7ba0177
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635
7 changed files with 233 additions and 25 deletions

95
git-tools.sh Normal file
View File

@ -0,0 +1,95 @@
#!/bin/bash
if [ -z "${1}" ]; then
echo "Command not specified"
exit 1
fi
function import_gpg_key
{
username="${1}"
echo "Importing GPG key for ${username}"
f=`mktemp`
curl -s https://api.github.com/users/${username}/gpg_keys -o ${f}
keyid="`jq -r '.[0].key_id' ${f}`"
jq -r '.[0].raw_key' ${f}| gpg --import
fpr=`gpg -k ${keyid}|grep -E '[A-F0-9]{40}'`
gpg --quick-lsign-key ${fpr}
rm -f ${f}
}
function mergepullrequest
{
echo "Merging PR ${1}"
curbranch=$(git status|head -1|cut -d\ -f3-)
upstream="v0.6"
git pull --all
git checkout -B upstream-$upstream --track upstream/"$upstream"
git fetch upstream pull/"$1"/head:"$1"
git merge --verify-signatures --ff-only -m "Merge PR $1 into $upstream" "$1"
#git checkout -B $curbranch --track origin/$curbranch
git checkout -B "$curbranch"
}
function rebase_open_prs
{
pulljs=$(mktemp)
username=$(git remote get-url origin| sed -E 'sx.*[:/](.+)/PyBitmessage(.git)?x\1x')
echo "My user name is $username"
head="$(curl -s https://api.github.com/repos/Bitmessage/PyBitmessage/branches/v0.6 | jq ".commit.sha"|cut -d\" -f2)"
echo "head is $head"
curl -s https://api.github.com/repos/Bitmessage/PyBitmessage/pulls -o "$pulljs"
pulls=$(jq ".[] | select(.user.login == \"$username\").number" < "$pulljs")
git pull --all --no-commit
for pr in $pulls; do
echo -n "PR $pr is mine, "
parent="$(jq ".[] | select(.number == $pr).base.sha" < "$pulljs"|cut -d\" -f2)"
if [ "$parent" != "$head" ]; then
echo -n "not up to date, "
branch="$(jq ".[] | select(.number == $pr).head.ref" < "$pulljs"|cut -d\" -f2)"
echo -n "rebasing branch $branch, "
git checkout -B "$branch" --track "origin/$branch"
if ! git rebase upstream/v0.6; then
echo "failed, skipping"
continue
fi
echo "success, pushing"
git push --force origin -u "$branch:$branch"
else
echo "up to date"
fi
done
rm -f "$pulljs"
}
function push_upstream
{
git push upstream -u upstream-v0.6:v0.6
}
case "${1}" in
"mergepullrequest")
if [ -z "${2}" ]; then
echo "No PR# specified, here is a list:"
curl -s https://api.github.com/repos/Bitmessage/PyBitmessage/pulls -s | jq '.[] | .number, .title' | paste - -
exit 1
fi
mergepullrequest "${2}"
;;
"importgpgkey")
if [ -z "${2}" ]; then
echo "No username specified, here is a list from recent PRs:"
curl -s https://api.github.com/repos/Bitmessage/PyBitmessage/pulls -s | jq '.[].user.login' | sort -u
exit 1
fi
import_gpg_key "${2}"
;;
"rebase")
rebase_open_prs
;;
"pushupstream")
push_upstream
;;
esac

View File

@ -173,7 +173,7 @@ class NavigationDrawerSubheader(OneLineListItem):
class ContentNavigationDrawer(BoxLayout):
"""ContentNavigationDrawer class for kivy Uir"""
"""ContentNavigationDrawer class for kivy Ui"""
def __init__(self, *args, **kwargs):
"""Method used for contentNavigationDrawer"""

View File

@ -118,3 +118,82 @@ class MyAddressScreen(TeleniumTestProcess):
self.click_on('//Thumb', seconds=2)
# self.assertExists('//Thumb[@active=\"False\"]', timeout=2)
self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=3)
(Pdb) dir(self.custom_sheet)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__events__', '__format__', '__ge__', '__getattribute__',
'__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__metaclass__', '__module__', '__ne__', '__new__',
'__proxy_getter', '__proxy_setter', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__',
'__setstate__', '__sizeof__', '__str__', '__subclasshook__', '_align_center', '_anim_alpha', '_anim_duration', '_apply_transform',
'_context', '_disabled_count', '_disabled_value', '_gl_content', '_handle_keyboard', '_kwargs_applied_init', '_parent', '_position_content',
'_proxy_ref', '_real_remove_widget', '_search_window', '_touch_started_inside', '_trigger_layout', '_upper_padding', '_walk',
'_walk_reverse', '_window', 'add_widget', 'anchor_x', 'anchor_y', 'animation', 'apply_class_lang_rules', 'apply_property',
'attach_to', 'auto_dismiss', 'background', 'background_color', 'bg_color', 'bind', 'border', 'canvas', 'center', 'center_x',
'center_y', 'children', 'clear_widgets', 'cls', 'collide_point', 'collide_widget', 'create_property', 'dec_disabled',
'device_ios', 'disabled', 'dismiss', 'dispatch', 'dispatch_children', 'dispatch_generic', 'do_layout', 'duration_closing',
z 'duration_opening', 'events', 'export_as_image', 'export_to_png', 'fbind', 'funbind', 'get_center_x', 'get_center_y',
'get_disabled', 'get_parent_window', 'get_property_observers', 'get_right', 'get_root_window', 'get_top',
'get_window_matrix', 'getter', 'height', 'ids', 'inc_disabled', 'is_event_type', 'layout_hint_with_bounds',
'md_bg_color', 'on__anim_alpha', 'on_dismiss', 'on_kv_post', 'on_opacity', 'on_open', 'on_pre_dismiss',
'on_pre_open', 'on_touch_down', 'on_touch_move', 'on_touch_up', 'opacity', 'open', 'opposite_colors',
'overlay_color', 'padding', 'parent', 'pos', 'pos_hint', 'properties', 'property', 'proxy_ref', 'radius',
'radius_from', 'register_event_type', 'remove_widget', 'resize_content_layout', 'right', 'screen', 'set_center_x',
'set_center_y', 'set_disabled', 'set_right', 'set_top', 'setter', 'size', 'size_hint', 'size_hint_max', 'size_hint_max_x',
'size_hint_max_y', 'size_hint_min', 'size_hint_min_x', 'size_hint_min_y', 'size_hint_x', 'size_hint_y', 'theme_cls',
'to_local', 'to_parent', 'to_widget', 'to_window', 'top', 'uid', 'unbind', 'unbind_uid', 'unregister_event_types',
'value_transparent', 'walk', 'walk_reverse', 'widget_style', 'width', 'x', 'y']
dict__', '__dir__', '__doc__', '__draw_shadow__', '__eq__', '__events__', '__format__', '__ge__', '__getattribute__',
'__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__metaclass__', '__module__', '__ne__',
'__new__', '__proxy_getter', '__proxy_setter', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__self__',
'__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_apply_transform',
'_background_origin', '_background_x', '_background_y', '_capitalizing', '_clear_groups', '_clear_shadow_groups',
'_context', '_create_label', '_disabled_count', '_disabled_value', '_do_press', '_do_release', '_do_update_theme_color',
'_doing_ripple', '_elevation', '_fading_out', '_fake_elevation', '_finishing_ripple', '_font_properties', '_get_center',
'_get_hard_shadow_a', '_get_soft_shadow_a', '_get_text', '_hard_shadow_a', '_kwargs_applied_init', '_label', '_no_ripple_effect',
'_previous_group', '_proxy_ref', '_release_group', '_ripple_rad', '_round_rad', '_set_color', '_set_ellipse',
'_set_hard_shadow_a', '_set_soft_shadow_a', '_set_start_tab', '_set_text', '_shadow_origin', '_shadow_origin_x',
'_shadow_origin_y', '_shadow_pos', '_soft_shadow_a', '_soft_shadow_texture', '_text', '_text_color_str',
'_trigger_texture', '_trigger_texture_update', '_update_elevation', '_update_shadow', '_update_shadow_pos',
'_update_specific_text_color', '_update_text_size', '_walk', '_walk_reverse', 'a', 'adaptive_height',
'adaptive_size', 'adaptive_width', 'add_widget', 'allow_no_selection', 'always_release', 'anchors', 'angle',
'anim_complete', 'apply_class_lang_rules', 'apply_property', 'b', 'background', 'background_hue',
'background_origin', 'background_palette', 'base_direction', 'bind', 'bold', 'can_capitalize', 'cancel_event',
'canvas', 'center', 'center_x', 'center_y', 'check_font_styles', 'children', 'clear_widgets', 'cls',
'collide_point', 'collide_widget', 'color', 'create_property', 'dec_disabled', 'device_ios', 'disabled',
'disabled_color', 'disabled_outline_color', 'dispatch', 'dispatch_children', 'dispatch_generic',
'draw_shadow', 'elevation', 'ellipsis_options', 'events', 'export_as_image', 'export_to_png',
'fade_out', 'fbind', 'finish_ripple', 'font', 'font_blended', 'font_context', 'font_family',
'font_features', 'font_hinting', 'font_kerning', 'font_name', 'font_size', 'font_style',
'force_shadow_pos', 'funbind', 'g', 'get_center_x', 'get_center_y', 'get_disabled',
'get_parent_window', 'get_property_observers', 'get_right', 'get_root_window', 'get_top',
'get_widgets', 'get_window_matrix', 'getter', 'group', 'halign', 'hard_shadow_cl',
'hard_shadow_offset', 'hard_shadow_pos', 'hard_shadow_size', 'hard_shadow_texture',
'height', 'ids', 'inc_disabled', 'is_event_type', 'is_shortened', 'italic', 'last_touch',
'lay_canvas_instructions', 'line_color', 'line_height', 'markup', 'max_lines', 'md_bg_color',
'min_space', 'min_state_time', 'mipmap', 'on__shadow_pos', 'on_adaptive_height', 'on_adaptive_size',
'on_adaptive_width', 'on_disabled', 'on_elevation', 'on_group', 'on_kv_post', 'on_opacity',
'on_opposite_colors', 'on_press', 'on_ref_press', 'on_release', 'on_shadow_group', 'on_shadow_pos',
'on_text_color', 'on_texture', 'on_theme_text_color', 'on_touch_down', 'on_touch_move', 'on_touch_up',
'opacity', 'opposite_colors', 'outline_color', 'outline_width', 'padding', 'padding_x',
'padding_y', 'parent', 'parent_background', 'pos', 'pos_hint', 'prev_shadow_group',
'properties', 'property', 'proxy_ref', 'r', 'radius', 'refs', 'register_event_type',
'remove_widget', 'right', 'ripple_alpha', 'ripple_color', 'ripple_duration_in_fast',
'ripple_duration_in_slow', 'ripple_duration_out', 'ripple_func_in', 'ripple_func_out',
'ripple_rad_default', 'ripple_scale', 'set_center_x', 'set_center_y', 'set_disabled',
'set_right', 'set_top', 'setter', 'shadow_group', 'shadow_pos', 'shadow_preset', 'shorten',
'shorten_from', 'size', 'size_hint', 'size_hint_max', 'size_hint_max_x', 'size_hint_max_y',
'size_hint_min', 'size_hint_min_x', 'size_hint_min_y', 'size_hint_x', 'size_hint_y',
'soft_shadow_cl', 'soft_shadow_offset', 'soft_shadow_pos', 'soft_shadow_size',
'specific_secondary_text_color', 'specific_text_color', 'split_str', 'start_ripple',
'state', 'strikethrough', 'strip', 'tab', 'tab_bar', 'text', 'text_color',
'text_color_active', 'text_color_normal', 'text_language', 'text_size',
'texture', 'texture_size', 'texture_update', 'theme_cls', 'theme_text_color',
'to_local', 'to_parent', 'to_widget', 'to_window', 'top', 'trigger_action',
'uid', 'unbind', 'unbind_uid', 'underline', 'unicode_errors', 'unregister_event_types',
'update_background_origin', 'update_font_style', 'update_group_property', 'valign', 'walk',
'walk_reverse', 'widget_style', 'width', 'x', 'y']
(Pdb)

View File

@ -25,27 +25,32 @@ class CreateRandomAddress(TeleniumTestProcess):
# self.assertExists("//Login[@name~=\"login\"]", timeout=3)
# Clicking on Proceed Next Button
# self.assertExists("//ScreenManager[@current=\"login\"]", timeout=5)
print(self.cli.getattr('//ScreenManager[@current]', 'current'), '--------------------------------------')
get_screen_value = self.cli.getattr('//ScreenManager[@current]', 'current')
start = time()
deadline = start + 5
count = 1
while time() < deadline:
self.cli.click_on(
'//Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[@text=\"Proceed Next\"]')
try:
print(count+1, '=================================================')
if self.cli.getattr('//ScreenManager[@current]', 'current') == 'random':
self.assertTrue(get_screen_value, 'random')
self.assertTrue(self.cli.getattr('//ScreenManager[@current]', 'current'), 'random')
print('try==================')
break
except TeleniumHttpException:
except:
print(count+1, '++++++++++++++++++++++++++++++++++++++++++++')
self.cli.wait_click(
'//Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2)
print('except==================')
sleep(0.1)
continue
raise AssertionError('timeout')
# Checking Current Screen(Random Screen) after Clicking on Proceed Next Button
print(self.cli.getattr('//ScreenManager[@current]', 'current'), '--------------------------------------')
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='random')
# self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='random')
'''
@ordered
def test_random_screen(self):
"""Creating New Adress For New User."""
@ -111,3 +116,4 @@ class CreateRandomAddress(TeleniumTestProcess):
self.cli.wait_click('//MySpinnerOption[0]', timeout=2)
# Checking Landing Screen(Inbox)
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2)
'''

View File

@ -9,6 +9,8 @@ data = [
class MyAddressScreen(TeleniumTestProcess):
"""MyAddress Screen Functionality Testing"""
subject = 'Hey this is Demo Subject'
body = 'Hey,i am sending message directly from MyAddress book'
@ordered
def test_select_myaddress_list(self):
@ -69,16 +71,38 @@ class MyAddressScreen(TeleniumTestProcess):
# Checking Receiver Address filled or not
self.assertNotEqual('//DropDownWidget//MyTextInput[0]', '')
# ADD SUBJECT
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', 'Hey this is Demo Subject')
self.cli.setattr('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', 'text', self.subject)
# Checking Subject Field is Entered
self.assertNotEqual('//DropDownWidget/ScrollView[0]//MyMDTextField[0]', '')
# ADD MESSAGE BODY
self.cli.setattr(
'//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[0]', 'text',
'Hey,i am sending message directly from MyAddress book')
self.body)
# Checking Message body is Entered
self.assertNotEqual('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text]', '')
# Click on Send Icon
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=3)
# Checking Current screen after Sending a message
self.assert_wait_no_except('//ScreenManager[@current]', timeout=5, value='inbox')
# Check for redirected screen (Inbox Screen)
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=7)
@ordered
def test_sent_box(self):
"""
Checking Message in Sent Screen after sending a Message.
"""
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
# this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2)
# this is for scrolling Nav drawer
self.drag("//NavigationItem[@text=\"Purchase\"]", "//NavigationItem[@text=\"My addresses\"]")
# assert for checking scroll function
self.assertCheckScrollUp('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# Clicking on Sent Tab
self.cli.wait_click('//NavigationItem[@text=\"Sent\"]', timeout=3)
# Checking current screen; Sent
self.assertExists("//ScreenManager[@current=\"sent\"]", timeout=3)
# Checking number of Sent messages
total_sent_msgs = len(self.cli.select("//SwipeToDeleteItem"))
self.assertEqual(total_sent_msgs, 2)

View File

@ -27,4 +27,4 @@ class NetworkStatusScreen(TeleniumTestProcess):
# Clicking on Processes Tab
self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=3)
# this is for checking current screen
self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=3)
self.assertTrue('//NetworkStat/MDTabs[@disabled]', 'False')

View File

@ -1,10 +1,12 @@
from .telenium_process import TeleniumTestProcess
from .common import ordered
class PaymentScreen(TeleniumTestProcess):
"""SubscriptionPayment Screen Functionality Testing"""
def test_select_subscription(self):
@ordered
def test_select_payment_screen(self):
"""Select Subscription From List of Subscriptions"""
# This is for checking Current screen
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
@ -21,13 +23,16 @@ class PaymentScreen(TeleniumTestProcess):
# assert for checking scroll function
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# this is for opening Payment screen
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=2)
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=5)
# Assert for checking Current Screen
# self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=3)
self.assert_wait_no_except('//ScreenManager[@current]', timeout=2, value='Payment')
self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=5)
# Scrolling Down Product list
self.cli.wait_click('//ProductCategoryLayout[0]/ProductLayout[1]', timeout=3)
# self.click_on('//ProductCategoryLayout[0]/ProductLayout[1]', seconds=1)
self.drag(
'//ProductCategoryLayout[0]/ProductLayout[0]',
'//ProductCategoryLayout[0]/ProductLayout[1]')
# assert for checking scroll function
self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3)
# Scrolling Up Product list
self.drag(
'//ProductCategoryLayout[0]/ProductLayout[1]',
'//ProductCategoryLayout[0]/ProductLayout[0]')
@ -35,12 +40,11 @@ class PaymentScreen(TeleniumTestProcess):
self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3)
# Click on BUY Button
self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=2)
self.assert_wait_no_except('//ScreenManager[@current]', timeout=2, value='payment')
# self.assertEqual('//PaymentMethodLayout[@disabled]', 'True') #Returns None when condition True
# CLick on the Payment Method
self.cli.click_on('//ScrollView[0]/ListItemWithLabel[0]')
# Check pop up is opened
self.assertEqual(self.cli.getattr('//PaymentMethodLayout/BoxLayout[0]/MDLabel[0]', 'text'),
'Select Payment Method')
self.assertTrue('//PaymentMethodLayout[@disabled]', 'False')
# Click out side to dismiss the popup
self.cli.wait_click('//MDRaisedButton[3]', timeout=2)
# Checking Current screen(Payment screen)