Пример #1
0
    def MakeGooglePlayObbFile(self, isHD):
        print("MakeGooglePlayObbFile start")
        dir = mainResource.GameResApp()
        print("MakeGooglePlayObbFile GameRes=", dir)
        self.DeleAllObbFile(FileUtil.GetLastDirofDir(dir))
        package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD)
        versioncode = mainAppInfo.GetAppVersionCode(Source.ANDROID, isHD)
        dir = FileUtil.GetLastDirofDir(dir)
        print("MakeGooglePlayObbFile file_zip dir =", dir)
        file_zip = dir + "/main." + str(versioncode) + "." + package + ".obb"
        file_zip = dir + "/GameRes.zip"
        # main.13.com.itant.wuji.obb
        print("MakeGooglePlayObbFile obb file=", file_zip)
        # if os.path.exists(file_zip):
        #     os.remove(file_zip)

        # os.system("git config --global credential.helper store")
        # jobb -d D:\contents\ main\assets\ -o D:\obb\output.obb -pn com.example.app -pv 25
        # 压缩目录
        ZipUtil.zipDir(dir, file_zip)

        # delete
        dir = mainResource.GetRootDirAndroidAsset() + "/GameRes"
        if os.path.exists(dir):
            shutil.rmtree(dir)

        print("MakeGooglePlayObbFile end")
Пример #2
0
    def ScanPrefabFile(self, dir, filejson):
        if not os.path.exists(dir):
            return
        listFile = []

        dirsave = FileUtil.GetLastDirofDir(filejson)
        FileUtil.CreateDir((dirsave))

        FileUtil.GetFileList(dir, "prefab", listFile)

        dataRoot = json.loads("{}")
        #        "BtnIconPlay" : {
        #     "path" : "App/UI/Common/Button/BtnIconPlay.png"
        # },
        for fileimage in listFile:
            # item= json.loads("{}")
            filepath = fileimage.replace(
                mainResource.GetRootUnityAssets() + "/", "")
            # item["path"]=filepath
            name = FileUtil.GetPathNameWithoutExt(fileimage)
            dataRoot[name] = filepath

        json_str = json.dumps(dataRoot,
                              ensure_ascii=False,
                              indent=4,
                              sort_keys=True)
        FileUtil.SaveString2File(json_str, filejson)
Пример #3
0
    def UploadScreenShot(self, webcmd, isHD, lan, applan):
        # screenshot
        for i in range(0, 1):
            # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器
            # self.SelectLanguage(webcmd,lan)
            time.sleep(1)

            # 将 滚动条 底部对齐

            # lan_shot = "chs-contents"
            # key = "//div[@id='"+lan_shot+"']"
            # div = self.driver.find_element(By.XPATH, key)
            # if div==None:
            #     print("not find screenshot div")
            #     return

            # 查找子元素
            # 当您启动XPath表达式时//,它会从文档的根目录中搜索,忽略您的父元素。你应该在表达前加上.

            # element2 = driver.find_element_by_xpath("//div[@title='div2']")
            # element2.find_element_by_xpath(".//p[@class='test']").text

            # key = ".//input[@type='file' and @data-target='#screenshots']"
            # item = div.find_element(By.XPATH, key)
            item_root = self.GetItemOfScreenShot(lan)

            key = ".//div[@class='ant-upload-drag-container']"
            item_div = webcmd.FindChild(item_root, key)

            # item = self.driver.find_element(By.XPATH, key)
            # item_div = webcmd.AddCmd2(CmdType.CLICK_Action, key)
            self.SetItemVisible(item_div)
            webcmd.DoCmd(item_div, CmdType.CLICK)

            time.sleep(1)

            pic = mainResource.GetOutPutScreenshotPathWin32(
                mainResource.GetProjectOutPut(), Source.TAPTAP,
                isHD) + "\\" + applan + "\\1080p\\" + str(i + 1) + ".jpg"
            if Platform.isMacSystem():
                # apk = FileUtil.GetLastDirofDir(apk)
                pic = pic.replace("\\", "/")
                pic = FileUtil.GetLastDirofDir(pic)
                test = 0

            flag = os.path.exists(pic)
            if flag:
                print(pic)
                self.OpenFileBrowser(pic, True)
                time.sleep(2)

            # 等待上传完成
            key = ".//span[@class='upload_img']"
            # print(key)
            item = webcmd.FindChild(item_root, key, True)
Пример #4
0
    def UpLoadSignAndroid(self):
        webcmd = WebDriverCmd(self.driver)
        # E:\Users\moon\Downloads

        if Platform.isWindowsSystem():
            downloadDir = "C:\\Users\\moon\\Downloads"

        if Platform.isMacSystem():
            downloadDir = "/Users/moon/Downloads"

        self.DeleteAllDownloadFile(downloadDir, ".apk")

        # 下载空包 E:\Users\moon\Downloads\mssp-verify-b8920a35.apk
        key = "//button[@class='veui-button bottom20']"
        webcmd.AddCmd(CmdType.CLICK, key)
        webcmd.Run(True)

        time.sleep(3)
        apk_unsign = self.GetDownloadFile(downloadDir, ".apk")
        apk_sign = mainResource.GetProjectOutPut() + "/mssp_baidu/signed.apk"
        FileUtil.CreateDir(FileUtil.GetLastDirofDir(apk_sign))
        jks = mainResource.GetDirProductCommon() + "/Ad/moonma.jks"

        if Platform.isWindowsSystem():

            # sign apk:
            # jarsigner -verbose -keystore ~/sourcecode/mssp_baidu/moonma.jks -signedjar ~/sourcecode/mssp_baidu/signed.apk ~/sourcecode/mssp_baidu/empty.apk moonma -storepass qianlizhiwai
            cmd = "jarsigner -verbose -keystore " + jks + " -signedjar " + apk_sign + " " + apk_unsign + " moonma -storepass qianlizhiwai"

        if Platform.isMacSystem():
            # sign apk:
            # jarsigner -verbose -keystore ~/sourcecode/mssp_baidu/moonma.jks -signedjar ~/sourcecode/mssp_baidu/signed.apk ~/sourcecode/mssp_baidu/empty.apk moonma -storepass qianlizhiwai
            cmd = "jarsigner -verbose -keystore " + jks + " -signedjar " + apk_sign + " " + apk_unsign + " moonma -storepass qianlizhiwai"

        print(cmd)
        os.system(cmd)
        time.sleep(1)

        # sign end

        # 滚动到浏览器顶部
        js_top = "var q=document.documentElement.scrollTop=0"
        # 滚动到浏览器底部
        js_bottom = "var q=document.documentElement.scrollTop=document.documentElement.scrollHeight"
        self.driver.execute_script(js_bottom)
        time.sleep(2)

        # 上传签名包
        # key = "//input[@accept='.apk' and @name='file']"
        key = "//label[@class='veui-button veui-uploader-input-label']"
        item = webcmd.AddCmd(CmdType.CLICK_Action, key)
        # webcmd.SetItemVisible(item)
        webcmd.Run(True)

        self.OpenFileBrowser(apk_sign)
Пример #5
0
    def UpLoadApk(self, isHD):
        webcmd = WebDriverCmd(self.driver)

        self.urlold = self.driver.current_url
        old_window = self.driver.current_window_handle
        print("urlold=", self.urlold)

        # key = "//span[contains(text(),上传APK)]"
        key = "//span[text()='上传APK']"
        item = webcmd.Find(key, True)

        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        key = "//span[text()='确 定']"
        webcmd.AddCmd(CmdType.CLICK_Action, key)
        webcmd.Run(True)

        # key =  "//div[@class='container--form upload-apk-wrapper old-style']"
        # item = webcmd.Find(key)
        # key = ".//button[@class='btn--edit ant-btn ant-btn-primary']"
        # subitem = webcmd.FindChild(item,key)
        # webcmd.DoCmd(subitem,CmdType.CLICK)

        # # <a data-toggle="modal" data-target=".confirm-upload-apk" class="btn btn-primary">上传APK</a>
        # # item = self.driver.find_element(
        # #     By.XPATH, "//a[@data-target='.confirm-upload-apk']")
        # # # item = self.driver.find_element(By.XPATH, "//a[@data-toggle='modal']")
        # # item.click()
        # time.sleep(2)

        # # <a id="selectfiles" href="javascript:void(0);" class="btn btn-primary" style="position: relative; z-index: 1;">开始上传APK</a>
        # item = self.driver.find_element(By.XPATH, "//a[@id='selectfiles']")
        # item.click()
        # time.sleep(2)

        # 手动点击上传
        # webcmd.WaitKeyBoard("q")
        apk = mainResource.GetOutPutApkPathWin32(
            mainResource.GetProjectOutPut(), Source.TAPTAP, isHD)
        if not os.path.exists(apk):
            apk = mainResource.GetOutPutApkPathWin32(
                mainResource.GetProjectOutPut(), Source.HUAWEI, isHD)

        if Platform.isMacSystem():
            apk = FileUtil.GetLastDirofDir(apk)

        # F:\\sourcecode\\unity\\product\\kidsgame\\ProjectOutPut\\xiehanzi\\hanziyuan\\screenshot\\shu\\cn\\480p\\1.jpg
        self.OpenFileBrowser(apk, True)
        time.sleep(1)

        # 等待文件長傳結束
        key = "//a[@title='基础信息']"
        item = webcmd.Find(key, True)
Пример #6
0
    def UploadIcon(self, webcmd, isHD, lan):
        # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器
        # self.SelectLanguage(webcmd,lan)
        # icon
        # <input type="file" name="image" data-valid-width="512" data-valid-height="512" data-taptap-ajax="upload" data-target="#icon-zh_CN" data-target-input="#icon-input-zh_CN" data-url="https://www.taptap.com/ajax/image">
        # "//input[@type='file' and @data-target='#icon-zh_CN']"
        key = "//div[@id='submitApp_translations.zh_CN.icon']"
        if lan == self.LAN_KEY_EN:
            key = "//div[@id='submitApp_translations.en_US.icon']"

            # key ="//img[@id='icon-" +   lanKeys[lan]+"']"
            # key = "//input[@type='file' and  @name='image']"
            # key = "//span[@class='fileinput-button fixed-size square icon']"

            # "//input[@name='anti_addiction_read']"
        print(key)
        item_root = webcmd.Find(key)

        key = ".//div[@class='ant-upload-drag-container']"
        item_div = webcmd.FindChild(item_root, key)

        # item = self.driver.find_element(By.XPATH, key)
        # item_div = webcmd.AddCmd2(CmdType.CLICK_Action, key)
        self.SetItemVisible(item_div)
        webcmd.DoCmd(item_div, CmdType.CLICK)
        # webcmd.Run(True)
        # self.driver.execute_script("arguments[0].click();", item)
        time.sleep(2)

        icon = mainResource.GetOutPutIconPathWin32(
            mainResource.GetProjectOutPut(), Source.TAPTAP,
            isHD) + "\\icon_android_512.png"
        print(icon)
        if Platform.isMacSystem():
            icon = icon.replace("\\", "/")
            icon = FileUtil.GetLastDirofDir(icon)
            test = 0

            # webcmd.Run(True)
        self.OpenFileBrowser(icon, True)
        time.sleep(1)

        # 等待上传完成
        key = ".//span[@class='upload_img']"
        # print(key)
        item = webcmd.FindChild(item_div, key, True)
Пример #7
0
 def SetCmdPath(self, str):
     dir = FileUtil.GetLastDirofDir(str)
     dir = FileUtil.GetLastDirofDir(dir)
     dir = FileUtil.GetLastDirofDir(dir)
     self.dirRoot = dir
     print("dir = ", dir)
Пример #8
0
 def getGameType(self):
     return FileUtil.GetDirNameofPath(FileUtil.GetLastDirofDir(
         self.cmdPath))
Пример #9
0
    def UploadAdHome(self, webcmd, isHD, lan, applan):
        # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器
        # self.SelectLanguage(webcmd,lan)
        # adhome
        # self.SelectLanguage(webcmd,lan)
        # self.driver.switch_to.window(self.driver.window_handles[0])

        key = "//div[@id='submitApp_translations.zh_CN.banner_4.android.developer.img']"
        if lan == self.LAN_KEY_EN:
            key = "//div[@id='submitApp_translations.en_US.banner_4.android.developer.img']"

        print(key)

        item_root = webcmd.Find(key)

        key = ".//div[@class='ant-upload-drag-container']"
        item_div = webcmd.FindChild(item_root, key)

        # item = self.driver.find_element(By.XPATH, key)
        # item_div = webcmd.AddCmd2(CmdType.CLICK_Action, key)
        self.SetItemVisible(item_div)
        webcmd.DoCmd(item_div, CmdType.CLICK)
        time.sleep(1)

        pic = mainResource.GetOutPutAdPathWin32(
            mainResource.GetProjectOutPut(), Source.TAPTAP,
            isHD) + "\\" + applan + "\\" + "ad_home_1920x1080.png"
        # pic = mainResource.GetOutPutScreenshotPathWin32(mainResource.GetProjectOutPut(), Source.TAPTAP, True) + "\\"+applan+"\\1080p\\"+"1.jpg"
        pic = os.path.normpath(pic)
        print(pic)
        if Platform.isMacSystem():
            pic = pic.replace("\\", "/")
            pic = FileUtil.GetLastDirofDir(pic)
            test = 0

        self.OpenFileBrowser(pic, True)
        time.sleep(1)

        # 等待上传完成
        key = ".//span[@class='upload_img']"
        # print(key)
        item = webcmd.FindChild(item_div, key, True)

        # bug 上传图片之前先要重新选择语言 不然无法弹出文件浏览器
        # self.SelectLanguage(webcmd,lan)
        key = "//div[@id='submitApp_translations.zh_CN.banner_4.ios.developer.img']"
        if lan == self.LAN_KEY_EN:
            key = "//div[@id='submitApp_translations.en_US.banner_4.ios.developer.img']"

        item_root = webcmd.Find(key)

        key = ".//div[@class='ant-upload-drag-container']"
        item_div = webcmd.FindChild(item_root, key)
        self.SetItemVisible(item_div)
        webcmd.DoCmd(item_div, CmdType.CLICK)
        time.sleep(1)

        # print(pic)
        self.OpenFileBrowser(pic, True)
        time.sleep(1)

        # 等待上传完成
        key = ".//span[@class='upload_img']"
        # print(key)
        item = webcmd.FindChild(item_div, key, True)