• IDP自动化项目


    -pageObject

    --mobileLoginPage

    import { adbInput } from "../../../utils/adbHelper"
    import { UiSelector } from "../../../utils/andriodSelector"
    import { ocr } from "../../../utils/ocrService/ocr"
    import ProfilePage from "./profilePage"
    
    class MobileLoginPage {
        get SignInButton() { return android.$(UiSelector('text','Sign in')()) }
        //get SignInWithEmailButton() { return android.$(UiSelector('text','Sign in with email')()) }
        //get SignInWithEmailButton() {return android.$(new UiSelector().className("android.widget.RelativeLayout").index(2)())}
        get SignInWithEmailButton() { return android.$(UiSelector('className','android.widget.RelativeLayout')('index','2')())}
        get EmailInput() { return android.$(UiSelector('resourceId','email')()) }
        get PasswordInput() { return android.$(UiSelector('resourceId','password')()) }
        get SignInWithGoogleButton() { return android.$(UiSelector('text','Sign in with Google')()) }
        get SignInWithMicrosoftButton() { return android.$(UiSelector('text','Sign in with Microsoft')()) }
        get YesButton() { return android.$(UiSelector('text','Yes')()) }
    
        async signInWithEmail(email,password) {
            await this.SignInButton.waitForExist({timeout: 10000})
            await this.SignInButton.click()
            await browser.pause(10000)
            await this.SignInWithEmailButton.waitForDisplayed()
            await this.SignInWithEmailButton.click()
            await this.EmailInput.setValue(email)
            await this.PasswordInput.setValue(password)
            await this.SignInButton.click()
            await ProfilePage.ProfileButton.waitForExist({timeout: 20000})
        }
    
        async googleSignInFlow(email, password){
            await ocr.waitUntilTextInScreen('android','prometheanproduct.com',{top:400,height:200})
            adbInput.text(androidID, email)
            adbInput.keyevent(androidID, 'KEYCODE_ENTER')
            await ocr.waitUntilTextInScreen('android',email,{top:400,height:200})
            adbInput.text(androidID, password)
            adbInput.keyevent(androidID, 'KEYCODE_ENTER')
            await ProfilePage.ProfileButton.waitForExist({timeout: 20000})
        }
    
        async signInWithGoogle(email,password) {
            await this.SignInButton.waitForExist({timeout: 10000})
            await this.SignInButton.click()
            await this.SignInWithGoogleButton.waitForDisplayed()
            await browser.pause(3000)
            await this.SignInWithGoogleButton.click()
            await this.googleSignInFlow(email,password)
        }
    
        async googleSSOSignIn(email,password){
            await this.SignInButton.waitForExist({timeout: 10000})
            await this.SignInButton.click()
            await this.SignInWithGoogleButton.waitForDisplayed()
            await browser.pause(3000)
            await this.SignInWithGoogleButton.click()
            try {
                await ocr.waitUntilTextInScreen('android','ActivPanel',{height:700})
            } catch (error) {
                await this.googleSignInFlow(email,password)
            }
            
        }
    
        async microsoftSignInFlow(email,password){
            await ocr.waitUntilTextInScreen('android','Microsoft',{area:['top']})
            adbInput.text(androidID, email)
            adbInput.keyevent(androidID, 'KEYCODE_ENTER')
            await ocr.waitUntilTextInScreen('android',email,{top:300,height:200})
            adbInput.text(androidID, password)
            adbInput.keyevent(androidID, 'KEYCODE_ENTER')
            await this.YesButton.waitForExist()
            await this.YesButton.click()
            await ProfilePage.ProfileButton.waitForExist({timeout: 20000})
        }
    
        async signInWithMicrosoft(email,password) {
            await this.SignInButton.waitForExist({timeout: 10000})
            await this.SignInButton.click()
            await this.SignInWithMicrosoftButton.waitForDisplayed()
            await browser.pause(3000)
            await this.SignInWithMicrosoftButton.click()
            await this.microsoftSignInFlow(email,password)
        }
    
        async checkSignedIn(){
            if (await this.SignInButton.isExisting()){
                return false
            }else{
                return true
            }
        }
    
    }
    
    export default new MobileLoginPage()
  • 相关阅读:
    SolrCloud阶段总结
    Solr总结
    机器学习算法与Python实践之(六)二分k均值聚类
    机器学习问题方法总结
    浅谈Kmeans聚类
    AVL树的算法思路整理
    Solr4.6从数据库导数据的步骤
    红黑树
    浅谈 Adaboost 算法
    POJ 1836 Alignment
  • 原文地址:https://www.cnblogs.com/chenxiaomeng/p/16567014.html
Copyright © 2020-2023  润新知