• 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()
  • 相关阅读:
    Mysql 使用触发器,把插入的数据在插入到宁一张表里
    Mysql 查询今天的某些时间之外的数据
    PHPStorm+XDEBUG 调试Laravel
    Python 2.7 爬取51job 全国java岗位
    Tp3.1 文件上传到七牛云
    TP3.1 一对多模型关联
    Mysql 主从配置
    自动化测试Java一:Selenium入门
    Selenium基于Python 进行 web 自动化测试
    Python 创建XML
  • 原文地址:https://www.cnblogs.com/chenxiaomeng/p/16567014.html
Copyright © 2020-2023  润新知