diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index e9b83d0..46facbd 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -110,12 +110,6 @@ class CommandorPage { break; case OCRResult.TO_REFRESH: logWithDevice("will reload page", this.device) - // if (this.browser.isConnected()) { - // await this.page.reload(); - // await this.checkIfSuccessful() - // } else { - // await delay(10000); - // if (!await this.checkIfSuccessful()) { let cmd = "input swipe 382 682 382 1682" logWithDevice("will send cmd:" + cmd, this.device) this.device.shell(cmd); @@ -485,6 +479,7 @@ class CommandorPage { } } catch (e) { log(e); + await this.checkResultWithOcr() } } } @@ -735,7 +730,8 @@ class CommandorPage { if (isSuccessful) { checkResult = await this.ocrChecker.get_result(); } else { - this.isTerminated = true + await this.checkResultWithOcr() + // this.isTerminated = true } // await this.checkResultWithOcr() }) @@ -856,7 +852,10 @@ class CommandorPage { OCRResult.GOOGLE_DISCONNECT : logWithDevice("GOOGLE_DISCONNECT", this.device) - this.device.shell("input tap " + 411 + " " + 2100) + if (this.device.model() === "MI 5s") { + this.device.shell("input tap " + 550 + " " + 1740) + } else + this.device.shell("input tap " + 411 + " " + 2100) await delay(2000); await this.checkResultWithOcr(); break @@ -897,6 +896,8 @@ class CommandorPage { async clickOnConfirmBtn() { if (this.device.model() === "CPH2219") { this.device.shell("input tap " + 900 + " " + 1532) + } else if (this.device.model() === "MI 5s") { + this.device.shell("input tap " + 925 + " " + 1325) } else this.device.shell("input tap " + 933 + " " + 1538) await delay(2000); @@ -939,6 +940,10 @@ class CommandorPage { this.device.shell("input tap " + 772 + " " + 2146) await delay(2000); this.device.shell("input tap " + 772 + " " + 2146) + } else if (model === "MI 5s") { + this.device.shell("input tap " + 790 + " " + 1807) + await delay(2000); + this.device.shell("input tap " + 790 + " " + 1807) await delay(1000); } else { this.device.shell("input tap " + 800 + " " + 2215) @@ -960,17 +965,19 @@ class CommandorPage { this.device.shell("input tap " + 550 + " " + 1920) } else if (model === "ONEPLUS A6000") { this.device.shell("input tap " + 535 + " " + 1945) + } else if (model === "MI 5s") { + this.device.shell("input tap " + 510 + " " + 1615) } else this.device.shell("input tap " + 385 + " " + 2050) - await delay(2000); + await delay(1000); } async enableDisableAirPlanMode() { logWithDevice("will enable airplane mode", this.device) await this.device.shell("cmd connectivity airplane-mode enable") - await this.device.shell("adb shell settings put global airplane_mode_on 1") + // await this.device.shell("adb shell settings put global airplane_mode_on 1") await delay(1000) - await this.device.shell("adb shell settings put global airplane_mode_on 0") + // await this.device.shell("adb shell settings put global airplane_mode_on 0") await this.device.shell("cmd connectivity airplane-mode disable") } } diff --git a/src/workers/OCRChecker.js b/src/workers/OCRChecker.js index cf82902..cd91dcf 100644 --- a/src/workers/OCRChecker.js +++ b/src/workers/OCRChecker.js @@ -31,6 +31,7 @@ const ERR_CACHE_MISS_3 = "appuyer sur le bouton d'actualisation" const ERR_CACHE_MISS_4 = "renvoyer les données" const SLIDING_CAPTCHA_FR = "Pourquoi cette vérification" const SLIDING_CAPTCHA_FR_2 = "Glissez vers la droite pour" +const SLIDING_CAPTCHA_FR_3 = "la droite pour completer le puzzle" const MESSAGE_FILL_FIELD_FR = "Demande de rendez-vous pour" const MESSAGE_FILL_FIELD_FR_2 = "Lensemble des champs de données doivent étre complétés" const WELCOME_MESSAGE_FR = "Bienvenue dans Chrome" @@ -40,6 +41,7 @@ const PAGE_OPTIMIZATION_CHROME_FR_2 = "Vous pouvez modifier vos options a tout m const PAGE_OPTIMIZATION_CHROME_FR_3 = "Vous pouvez effectuer des modifications" const PAGE_OPTIMIZATION_CHROME_FR_4 = "de nouvelles fonctionnalités" const PAGE_OPTIMIZATION_CHROME_FR_5 = "Avec la mesure des performance" +const PAGE_OPTIMIZATION_CHROME_FR_7 = "Les annonces suggérées par les" const ONLINE_APPOINTMENT = "Online Appointment" const CONFIRM_RESEND_FORM_FR = "Confirmer le nouvel envoi" const CLOSED_MESSAGE_FR = "Depuis plus de 130 ans" @@ -84,15 +86,21 @@ class OCRChecker { return OCRResult.TO_REFRESH } else if (result.includes(CHECKING_MSG_FR)) { return OCRResult.RECHECK - } else if (result.includes(SLIDING_CAPTCHA_FR) || result.includes(SLIDING_CAPTCHA_FR_2)) { + } else if (result.includes(SLIDING_CAPTCHA_FR) || result.includes(SLIDING_CAPTCHA_FR_2) || result.includes(SLIDING_CAPTCHA_FR_3)) { return OCRResult.SLIDING_CAPTCHA } else if (result.includes(MESSAGE_FILL_FIELD_FR) || result.includes(MESSAGE_FILL_FIELD_FR_2)) { return OCRResult.FILL_FIELD } else if (result.includes(WELCOME_MESSAGE_FR)) { return OCRResult.NEED_TO_CLICK_LATE_BTN + } else if (result.includes(GOOGLE_DISCONNECT_FR)) { + return OCRResult.GOOGLE_DISCONNECT } else if (result.toLowerCase().includes(ONLINE_APPOINTMENT.toLowerCase())) { return OCRResult.ONLINE_APPOINTMENT - } else if (result.includes(PAGE_OPTIMIZATION_CHROME_FR) || result.includes(PAGE_OPTIMIZATION_CHROME_FR_2) || result.includes(PAGE_OPTIMIZATION_CHROME_FR_3) || result.includes(PAGE_OPTIMIZATION_CHROME_FR_4) || result.includes(PAGE_OPTIMIZATION_CHROME_FR_5) || result.includes(PAGE_OPTIMIZATION_CHROME_FR_6)) { + } else if (result.includes(PAGE_OPTIMIZATION_CHROME_FR) || result.includes(PAGE_OPTIMIZATION_CHROME_FR_2) || result.includes(PAGE_OPTIMIZATION_CHROME_FR_3) + || result.includes(PAGE_OPTIMIZATION_CHROME_FR_4) || result.includes(PAGE_OPTIMIZATION_CHROME_FR_5) + || result.includes(PAGE_OPTIMIZATION_CHROME_FR_6) + || result.includes(PAGE_OPTIMIZATION_CHROME_FR_7) + ) { return OCRResult.PAGE_OPTIMIZATION } else if (result.includes(CONFIRM_RESEND_FORM_FR)) { return OCRResult.CONFIRM_RESEND_FORM @@ -102,8 +110,6 @@ class OCRChecker { return OCRResult.TERMINAED } else if (result.includes(DIALOG_TO_SKIP)) { return OCRResult.TO_SKIP - } else if (result.includes(GOOGLE_DISCONNECT_FR)) { - return OCRResult.GOOGLE_DISCONNECT } else if (result.includes(RECAPTCHA_FAILED_FR)) { return OCRResult.TERMINAED } else {