Add Subscription and update test case of payment screen
This commit is contained in:
parent
255cffd061
commit
3fb6adad9b
3
setup.py
3
setup.py
|
@ -79,7 +79,8 @@ if __name__ == "__main__":
|
|||
'translations/*.ts', 'translations/*.qm', 'default.ini', 'sql/*.sql',
|
||||
'images/*.png', 'images/*.ico', 'images/*.icns',
|
||||
'bitmessagekivy/main.kv', 'bitmessagekivy/screens_data.json',
|
||||
'bitmessagekivy/kv/*.kv'
|
||||
'bitmessagekivy/kv/*.kv', 'images/kivy/payment/*.png', 'images/kivy/*.gif',
|
||||
'images/kivy/text_images*.png'
|
||||
]}
|
||||
|
||||
if sys.version_info[0] == 3:
|
||||
|
|
|
@ -1,71 +1,144 @@
|
|||
#:import get_color_from_hex kivy.utils.get_color_from_hex
|
||||
|
||||
<Payment>:
|
||||
name: "payment"
|
||||
BoxLayout:
|
||||
ScrollView:
|
||||
bar_width:0
|
||||
do_scroll_x: False
|
||||
#scroll_y:0
|
||||
|
||||
id: id_payment_screen
|
||||
payment_plan_id: ""
|
||||
MDTabs:
|
||||
id: tab_panel
|
||||
tab_display_mode:'text'
|
||||
Tab:
|
||||
title: app.tr._("Payment")
|
||||
id: id_payment plan
|
||||
padding: "12dp"
|
||||
spacing: "12dp"
|
||||
BoxLayout:
|
||||
spacing: dp(8)
|
||||
padding: dp(5)
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
orientation: "vertical"
|
||||
|
||||
ProductCategoryLayout:
|
||||
category_text: "Monthly-Subscriptions"
|
||||
|
||||
ProductLayout:
|
||||
heading_text: "Gas (Play Billing Codelab)"
|
||||
price_text: "$0.99"
|
||||
source: app.image_path + "/payment/buynew1.png"
|
||||
description_text: "Buy gasoline to ride!"
|
||||
product_id: "SKUGASBILLING"
|
||||
|
||||
ProductLayout:
|
||||
heading_text: "Upgrade your car (Play Billing Codelab)"
|
||||
price_text: "$1.49"
|
||||
source: app.image_path + "/payment/buynew1.png"
|
||||
description_text: "Buy a premium outfit for your car!"
|
||||
product_id: "SKUUPGRADECAR"
|
||||
|
||||
ProductLayout:
|
||||
heading_text: "Month in gold status (Play Billing Codelab)"
|
||||
price_text: "$0.99"
|
||||
source: app.image_path + "/payment/buynew1.png"
|
||||
description_text: "Enjoy a gold status for a month!"
|
||||
product_id: "SKUMONTHLYGOLD"
|
||||
|
||||
ProductCategoryLayout:
|
||||
category_text: "One-time payment"
|
||||
|
||||
ProductLayout:
|
||||
heading_text: "Gas (Play Billing Codelab)"
|
||||
price_text: "$0.99"
|
||||
source: app.image_path + "/payment/buynew1.png"
|
||||
description_text: "Buy gasoline to ride!"
|
||||
product_id: "SKUONETIMEGAS"
|
||||
|
||||
ProductCategoryLayout:
|
||||
category_text: "Annual-Subscriptions"
|
||||
|
||||
ProductLayout:
|
||||
heading_text: "Gas (Play Billing Codelab)"
|
||||
price_text: "$0.99"
|
||||
source: app.image_path + "/payment/buynew1.png"
|
||||
description_text: "Buy gasoline to ride!"
|
||||
product_id: "SKUANNUALGAS"
|
||||
|
||||
ProductLayout:
|
||||
heading_text: "Year in gold status (Play Billing Codelab)"
|
||||
price_text: "$10.99"
|
||||
source: app.image_path + "/payment/buynew1.png"
|
||||
description_text: "Enjoy a gold status for a year!"
|
||||
product_id: "SKUANNUALGOLD"
|
||||
ScrollView:
|
||||
bar_width:0
|
||||
do_scroll_x: False
|
||||
BoxLayout:
|
||||
spacing: dp(5)
|
||||
padding: dp(5)
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
orientation: "vertical"
|
||||
ProductCategoryLayout:
|
||||
MDCard:
|
||||
orientation: "vertical"
|
||||
padding: "8dp"
|
||||
spacing: "12dp"
|
||||
size_hint: None, None
|
||||
size: "560dp", "40dp"
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
MDLabel:
|
||||
text: f"You have {app.encrypted_messages_per_month} messages left"
|
||||
bold: True
|
||||
halign:'center'
|
||||
size_hint_y: None
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
|
||||
MDCard:
|
||||
orientation: "vertical"
|
||||
padding: "8dp"
|
||||
spacing: "12dp"
|
||||
size_hint: None, None
|
||||
size: "560dp", "300dp"
|
||||
md_bg_color: [1, 0.6, 0,0.5]
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
MDLabel:
|
||||
text: "Free"
|
||||
bold: True
|
||||
halign:'center'
|
||||
size_hint_y: None
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
MDRectangleFlatIconButton:
|
||||
text: "[Currently this plan is active.]"
|
||||
icon: 'shield-check'
|
||||
line_color: 0, 0, 0, 0
|
||||
text_color: 'ffffff'
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
font_size: '18sp'
|
||||
MDSeparator:
|
||||
height: "1dp"
|
||||
MDLabel:
|
||||
text: "You can get zero encrypted message per month"
|
||||
halign:'center'
|
||||
bold: True
|
||||
MDCard:
|
||||
orientation: "vertical"
|
||||
padding: "8dp"
|
||||
spacing: "12dp"
|
||||
size_hint: None, None
|
||||
size: "560dp", "300dp"
|
||||
md_bg_color: [0, 0.6, 0.8,0.8]
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
payment_plan_id: "sub_standard"
|
||||
MDLabel:
|
||||
text: "Standard"
|
||||
bold: True
|
||||
halign:'center'
|
||||
size_hint_y: None
|
||||
MDSeparator:
|
||||
height: "1dp"
|
||||
MDLabel:
|
||||
text: "You can get 100 encrypted message per month"
|
||||
halign:'center'
|
||||
MDRaisedButton:
|
||||
text: "Get it now"
|
||||
theme_text_color: 'Primary'
|
||||
md_bg_color: [1, 1, 1,1]
|
||||
pos_hint: {'center_x': .5}
|
||||
on_release:app.open_payment_layout(root.payment_plan_id)
|
||||
MDCard:
|
||||
orientation: "vertical"
|
||||
padding: "8dp"
|
||||
spacing: "12dp"
|
||||
size_hint: None, None
|
||||
size: "560dp", "300dp"
|
||||
md_bg_color: [1, 0.6, 0.8,0.5]
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
payment_plan_id: "sub_premium"
|
||||
MDLabel:
|
||||
text: "Premium"
|
||||
bold: True
|
||||
halign:'center'
|
||||
size_hint_y: None
|
||||
MDSeparator:
|
||||
height: "1dp"
|
||||
MDLabel:
|
||||
text: "You can get 1000 encrypted message per month"
|
||||
halign:'center'
|
||||
MDRaisedButton:
|
||||
text: "Get it now"
|
||||
theme_text_color: 'Primary'
|
||||
md_bg_color: [1, 1, 1,1]
|
||||
pos_hint: {'center_x': .5}
|
||||
on_release:app.open_payment_layout(root.payment_plan_id)
|
||||
Tab:
|
||||
title: app.tr._("Extra-Messages")
|
||||
id: id_payment_tab
|
||||
BoxLayout:
|
||||
ScrollView:
|
||||
bar_width:0
|
||||
do_scroll_x: False
|
||||
BoxLayout:
|
||||
spacing: dp(8)
|
||||
padding: dp(5)
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
orientation: "vertical"
|
||||
ProductCategoryLayout:
|
||||
category_text: "Extra-Messages"
|
||||
ProductLayout:
|
||||
heading_text: "100 Encrypted messages "
|
||||
price_text: "$0.99"
|
||||
source: app.image_path + "/payment/buynew1.png"
|
||||
description_text: "Buy extra one hundred encrypted messages!"
|
||||
product_id: "SKUGASBILLING"
|
||||
ProductLayout:
|
||||
heading_text: "1000 Encrypted messages "
|
||||
price_text: "$1.49"
|
||||
source: app.image_path + "/payment/buynew1.png"
|
||||
description_text: "Buy extra one thousand encrypted messages!"
|
||||
product_id: "SKUUPGRADECAR"
|
||||
<ProductCategoryLayout@BoxLayout>:
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
|
@ -94,7 +167,6 @@
|
|||
MDLabel:
|
||||
text: root.text_
|
||||
font_size: sp(15)
|
||||
|
||||
<ProductLayout>:
|
||||
heading_text: ""
|
||||
price_text: ""
|
||||
|
@ -117,7 +189,6 @@
|
|||
#heading area
|
||||
BoxLayout:
|
||||
size_hint_y: 0.3
|
||||
|
||||
#text heading
|
||||
BoxLayout:
|
||||
Widget:
|
||||
|
@ -169,7 +240,6 @@
|
|||
MDLabel:
|
||||
text: root.description_text
|
||||
font_size: sp(15)
|
||||
|
||||
#Button Area
|
||||
BoxLayout:
|
||||
size_hint_y: 0.4
|
||||
|
@ -201,7 +271,7 @@
|
|||
RightLabel:
|
||||
text: root.right_label_text
|
||||
theme_text_color: "Custom"
|
||||
text_color: 0,0,0,.4
|
||||
text_color: 0,0,0,0.5
|
||||
font_size: sp(12)
|
||||
|
||||
<PaymentMethodLayout>:
|
||||
|
@ -239,15 +309,17 @@
|
|||
|
||||
ListItemWithLabel:
|
||||
source: app.image_path + "/payment/btc.png"
|
||||
text: "BTC"
|
||||
text: "BTC (Currently this feature is not available)"
|
||||
method_name: "btc"
|
||||
|
||||
theme_text_color: 'Secondary'
|
||||
md_bg_color: [0, 0, 0,1]
|
||||
ListItemWithLabel:
|
||||
source: app.image_path + "/payment/paypal.png"
|
||||
text: "Paypal"
|
||||
text: "Paypal (Currently this feature is not available)"
|
||||
method_name: "som"
|
||||
|
||||
theme_text_color: 'Secondary'
|
||||
md_bg_color: [0, 0, 0,1]
|
||||
ListItemWithLabel:
|
||||
source: app.image_path + "/payment/buy.png"
|
||||
text: "One more method"
|
||||
method_name: "omm"
|
||||
method_name: "omm"
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
on_release: app.root.ids.scr_mngr.current = 'set'
|
||||
on_release: root.parent.set_state()
|
||||
NavigationItem:
|
||||
text: app.tr._('Purchase')
|
||||
text: app.tr._('Payment plan')
|
||||
icon: 'shopping'
|
||||
divider: None
|
||||
on_release: app.root.ids.scr_mngr.current = 'payment'
|
||||
|
|
|
@ -45,7 +45,7 @@ from pybitmessage.bitmessagekivy.baseclass.popup import (
|
|||
from pybitmessage.bitmessagekivy.baseclass.login import * # noqa: F401, F403
|
||||
from pybitmessage.bitmessagekivy.uikivysignaler import UIkivySignaler
|
||||
|
||||
from pybitmessage.mock.helper_startup import loadConfig
|
||||
from pybitmessage.mock.helper_startup import loadConfig, total_encrypted_messages_per_month
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
||||
|
@ -93,6 +93,7 @@ class NavigateApp(MDApp):
|
|||
identity_list = get_identity_list()
|
||||
image_path = load_image_path()
|
||||
app_platform = platform
|
||||
encrypted_messages_per_month = total_encrypted_messages_per_month()
|
||||
tr = Lang("en") # for changing in franch replace en with fr
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
from .telenium_process import TeleniumTestProcess
|
||||
from .common import skip_screen_checks
|
||||
from .common import ordered
|
||||
|
||||
|
||||
class PaymentScreen(TeleniumTestProcess):
|
||||
"""SubscriptionPayment Screen Functionality Testing"""
|
||||
"""Payment Plan Screen Functionality Testing"""
|
||||
|
||||
@ordered
|
||||
def test_select_subscription(self):
|
||||
"""Select Subscription From List of Subscriptions"""
|
||||
def test_select_payment_plan(self):
|
||||
"""Select Payment plan From List of payments"""
|
||||
# This is for checking Current screen
|
||||
self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
|
||||
# Method to open the side navbar
|
||||
|
@ -18,35 +17,54 @@ class PaymentScreen(TeleniumTestProcess):
|
|||
# assert for checking scroll function
|
||||
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=10)
|
||||
# this is for opening Payment screen
|
||||
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=5)
|
||||
self.cli.wait_click('//NavigationItem[@text=\"Payment plan\"]', timeout=5)
|
||||
# Checking the navbar is in closed state
|
||||
self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
|
||||
# Assert for checking Current Screen
|
||||
self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=5)
|
||||
# Scrolling Down Product list
|
||||
# Checking state of Current tab Payment plan
|
||||
self.assertExists(
|
||||
'//Payment/MDTabs[0]//MDTabsLabel[@text=\"Payment\"][@state=\"down\"]', timeout=5
|
||||
)
|
||||
# Scrolling Down Payment plan Cards
|
||||
self.drag(
|
||||
'//ProductCategoryLayout[0]/ProductLayout[0]',
|
||||
'//ProductCategoryLayout[0]/ProductLayout[1]')
|
||||
# assert for checking scroll function
|
||||
self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=5)
|
||||
# Scrolling Up Product list
|
||||
self.drag(
|
||||
'//ProductCategoryLayout[0]/ProductLayout[1]',
|
||||
'//ProductCategoryLayout[0]/ProductLayout[0]')
|
||||
# assert for checking scroll function
|
||||
self.assertCheckScrollUp('//Payment//ScrollView[0]', timeout=10)
|
||||
|
||||
@skip_screen_checks
|
||||
@ordered
|
||||
def test_buy_option(self):
|
||||
"""Check subscription"""
|
||||
# Click on BUY Button
|
||||
self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=5)
|
||||
'//Payment//MDTabs[0]//MDCard[2]//MDLabel[@text=\"Standard\"]',
|
||||
'//Payment//MDTabs[0]//MDCard[1]//MDLabel[@text=\"You can get zero encrypted message per month\"]'
|
||||
)
|
||||
# Checking the subscription offer cards
|
||||
self.assertExists(
|
||||
'//Payment/MDTabs[0]//MDCard[3]//MDLabel[@text=\"Premium\"]',
|
||||
timeout=10
|
||||
)
|
||||
# Checking the get it now button
|
||||
self.assertExists(
|
||||
'//Payment/MDTabs[0]//MDCard[3]//MDRaisedButton[@text=\"Get it now\"]',
|
||||
timeout=10
|
||||
)
|
||||
# Clicking on the get it now button
|
||||
self.cli.wait_click(
|
||||
'//Payment/MDTabs[0]//MDCard[3]//MDRaisedButton[@text=\"Get it now\"]',
|
||||
timeout=10
|
||||
)
|
||||
# Checking the Payment method popup
|
||||
self.assertExists('//PaymentMethodLayout//ScrollView[0]//ListItemWithLabel[0]', timeout=10)
|
||||
# CLick on the Payment Method
|
||||
self.cli.click_on('//ScrollView[0]//ListItemWithLabel[0]')
|
||||
self.cli.wait_click(
|
||||
'//PaymentMethodLayout//ScrollView[0]//ListItemWithLabel[0]',
|
||||
timeout=10
|
||||
)
|
||||
# Check pop up is opened
|
||||
self.assertExists('//PaymentMethodLayout[@disabled=false]', timeout=10)
|
||||
# Click out side to dismiss the popup
|
||||
self.cli.wait_click('//MDRaisedButton[5]', timeout=5)
|
||||
# Checking Current screen(Payment screen)
|
||||
self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=5)
|
||||
self.cli.wait_click('//MDRaisedButton[1]', timeout=10)
|
||||
# Checking state of next tab Payment
|
||||
self.assertExists(
|
||||
'//Payment/MDTabs[0]//MDTabsLabel[@text=\"Extra-Messages\"][@state=\"normal\"]', timeout=5
|
||||
)
|
||||
# Clicking on Payment tab
|
||||
self.cli.wait_click('//Payment/MDTabs[0]//MDTabsLabel[@text=\"Extra-Messages\"]', timeout=5)
|
||||
# Checking state of payment tab after click
|
||||
self.assertExists(
|
||||
'//Payment/MDTabs[0]//MDTabsLabel[@text=\"Extra-Messages\"][@state=\"down\"]', timeout=5
|
||||
)
|
||||
self.cli.sleep(1)
|
||||
|
|
BIN
src/images/kivy/payment/btc.png
Normal file
BIN
src/images/kivy/payment/btc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
src/images/kivy/payment/buy.png
Normal file
BIN
src/images/kivy/payment/buy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
BIN
src/images/kivy/payment/buynew1.png
Normal file
BIN
src/images/kivy/payment/buynew1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
src/images/kivy/payment/gplay.png
Normal file
BIN
src/images/kivy/payment/gplay.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
src/images/kivy/payment/paypal.png
Normal file
BIN
src/images/kivy/payment/paypal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
|
@ -5,3 +5,9 @@ from pybitmessage.bmconfigparser import config
|
|||
def loadConfig():
|
||||
"""Loading mock test data"""
|
||||
config.read(os.path.join(os.environ['BITMESSAGE_HOME'], 'keys.dat'))
|
||||
|
||||
|
||||
def total_encrypted_messages_per_month():
|
||||
"""Loading mock total encrypted message """
|
||||
encrypted_messages_per_month = 0
|
||||
return encrypted_messages_per_month
|
||||
|
|
Reference in New Issue
Block a user