This commit is contained in:
watrabi
2025-09-18 17:55:52 -04:00
commit 977f1ff4b8
15030 changed files with 17324420 additions and 0 deletions
@@ -0,0 +1 @@
__author__ = 'yiwen'
@@ -0,0 +1,36 @@
__author__ = 'yiwen'
import smtplib
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from datetime import date
def send_mail(send_from, send_to, subject, text, attfile=None):
gmail_user = "robloxmobiletest@gmail.com"
gmail_pwd = "hackproof12"
DATE_FORMAT = "%d/%m/%Y"
EMAIL_SPACE = ", "
assert isinstance(send_to, list)
msg = MIMEMultipart()
msg['Subject'] = subject + " %s" % (date.today().strftime(DATE_FORMAT))
msg['To'] = EMAIL_SPACE.join(send_to)
msg['From'] = send_from
msg.attach(MIMEText(text))
if attfile:
part = MIMEApplication(open(attfile,"rb").read())
part.add_header('Content-Disposition', 'attachment', filename=attfile)
msg.attach(part)
try:
server = smtplib.SMTP("smtp.gmail.com", 587)
server.ehlo()
server.starttls()
server.login(gmail_user, gmail_pwd)
print 'login successful'
server.sendmail(send_from, send_to, msg.as_string())
server.close()
print 'successfully sent the mail'
except:
print "failed to send mail"
@@ -0,0 +1,38 @@
__author__ = 'yiwen'
APP_NAME ='/Users/yiwen/Library/Developer/Xcode/DerivedData/RobloxMobile-daaepjbgniaxkmbhdkkduekbtpuy/Build/Products/Release-iphoneos/RobloxTop.app'
#APP_NAME = '/Users/yiwen/Library/Developer/Xcode/DerivedData/RobloxMobile-ahgndzvmjplpvrbhfthvrrniwqkf/Build/Products/Release-iphoneos/RobloxInternal.app'
COMMAND_SERVER ='http://127.0.0.1:4723/wd/hub'
#############ios information###################
PLATFORM = 'iOS'
PLATFORM_VERSION = '7.1'
# APP_VERSION = '2.99.99'
DEVICE_NAME = '8f0a67da884eeea359218fe7818a97530a36c49c'
PD_USERNAME = 'AppleiTunesTestNoBc'
PD_PASSWORD = 'Steve1Jobs1'
#############android information###################
PLATFORM_ANDROID = 'Android'
PLATFORM_ANDROID_VERSION = '4.4'
# APP_VERSION = '2.99.99'
ANDROID_DEVICE_NAME = '8f0a67da884eeea359218fe7818a97530a36c49c'
GT_USERNAME = 'mobiletest'
GT_PASSWORD = 'hackproof12'
MAIN_SERVER = "watrbx.wtf"
GT1_SERVER = 'gametest1.pizzaboxer.fun'
GAMEFORTESTONGT1 = 'Test'
GT2_SERVER = 'gametest2.pizzaboxer.fun'
GAMEFORTESTONGT2 = 'Test'
ST1_SERVER = 'sitetest1.pizzaboxer.fun'
GAMEFORTESTONST1 = "Place"
ST2_SERVER = 'sitetest2.pizzaboxer.fun'
GAMEFORTESTONST2 = "Place"
@@ -0,0 +1,124 @@
__author__ = 'yiwen'
import unittest
import os
from random import randint
from appium import webdriver
from time import sleep
import contants
import commonutils
import time
import subprocess as sp
class IOSTestsBase(unittest.TestCase):
APP_VERSION = '0.0'
DEVICE_NAME = contants.DEVICE_NAME
internal = True
APP_SRC = contants.APP_NAME
DEVICE_TYPE = 'tablet'
TESTER = ''
def setUp(self):
# set up appium
sleep(2)
# sp.call('ios-deploy -i '+ self.DEVICE_NAME+' -b '+self.APP_SRC + ' -r', shell=True)
# sleep(2)
self.driver = webdriver.Remote(
command_executor=contants.COMMAND_SERVER,
desired_capabilities={
'app': self.APP_SRC,
'platformName': contants.PLATFORM,
'platformVersion': contants.PLATFORM_VERSION,
'deviceName': self.DEVICE_NAME,
'autoAcceptAlerts': True,
})
sleep(2)
def tearDown(self):
self.driver.quit()
def selectwheel(self,value):
if self.internal:
if self.DEVICE_TYPE == 'phone':
value = value.replace('www','m')
sleep(3)
wheel = self.driver.find_elements_by_class_name('UIAPickerWheel')
wheel[0].send_keys(value)
def login(self,username,password):
buttons = self.driver.find_elements_by_class_name('UIAButton')
for button in buttons:
if button.get_attribute('name') == 'Login':
button.click()
# clear username first
self.driver.find_elements_by_class_name('UIATextField')[0].clear()
self.driver.find_elements_by_class_name('UIATextField')[0].send_keys(username)
self.driver.find_elements_by_class_name('UIASecureTextField')[0].send_keys(password)
if self.DEVICE_TYPE == 'phone':
buttons = self.driver.find_elements_by_class_name('UIAButton')
for button in buttons:
if button.get_attribute('name') == 'Log in':
button.click()
else:
self.driver.find_elements_by_accessibility_id('Log in')[0].click()
time.sleep(3)
def emailscreenshot(self,full_filename,send_to,testtitle):
self.driver.save_screenshot(full_filename)
time.sleep(3)
commonutils.send_mail(send_from='ywen@watrbx.wtf',send_to=send_to,subject=testtitle+' result',text='automation test screen shot for '+testtitle,attfile=full_filename)
def verifyWebViewStaticText(self,textToVerify,source='webriver'):
if source == 'ios':
# statictext = self.driver.find_elements_by_ios_uiautomation(".scrollViews()[0].webViews()[0].staticTexts()['"+textToVerify+"']")
statictext = self.driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText')
else:
statictext = self.driver.find_elements_by_class_name('UIAStaticText')
for text in statictext:
if text.get_attribute('name') == textToVerify:
return True
return False
def verifyCookieConstrains(self,keys='rewards'):
temp = []
if self.verifyWebViewStaticText(textToVerify='The site is currently offline for maintenance and upgrades.'):
self.driver.find_elements_by_class_name('UIASecureTextField')[0].send_keys(keys)
buttons = self.driver.find_elements_by_class_name('UIAButton')
for button in buttons:
if button.get_attribute('name') == 'O':
temp.append(button)
temp[1].click()
time.sleep(10)
def verifyKeyboard(self):
return self.driver.execute_script('target.frontMostApp().keyboard().isValid()')
def verifyWebLink(self,linktext,source='webriver'):
if source == 'ios':
# statictext = self.driver.find_elements_by_ios_uiautomation(".scrollViews()[0].webViews()[0].staticTexts()['"+textToVerify+"']")
links = self.driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText')
else:
links = self.driver.find_elements_by_class_name('UIALink')
for link in links:
if link.get_attribute('name') == linktext:
return link
return None
def launch_game(self):
playlink = self.verifyWebLink(linktext='Play')
# self.assertTrue(playlink is None,'Did not found Play link on Test Place #1 ')
if playlink:
playlink.click()
# wait till game gets loaded
sleep(10)
# self.driver.execute_script('target.frontMostApp().mainWindow().images()[0].images()[0].tapWithOptions({tapOffset:{x:0.09, y:0.03}});')
# self.assertTrue(self.verifyKeyboard() == True ,'keyboard did not launch , game was not launched')
return
assert False ,"can't found the Play link on page"