adapt oppo

This commit is contained in:
2023-07-18 16:20:08 +02:00
parent b3e376cd05
commit 343449b17c
2 changed files with 20 additions and 16 deletions
+16 -14
View File
@@ -707,7 +707,7 @@ class CommandorPage {
} }
// save to mongoDb // save to mongoDb
let reserve = ReserveResultPojo.create_from_contact(this.contact, id, url, this.choosedStore, publishType); let reserve = ReserveResultPojo.create_from_contact(this.contact, id, url, this.choosedStore, publishType);
reserve.source_from = this.device.serial(); reserve.source_from = this.device.model();
await this.mongoManager.saveReserveToDb(reserve.to_mongo_dict()) await this.mongoManager.saveReserveToDb(reserve.to_mongo_dict())
await this.page.close(); await this.page.close();
// await this.deleteFromBlackList() // await this.deleteFromBlackList()
@@ -833,11 +833,13 @@ class CommandorPage {
logWithDevice("get pages", this.device) logWithDevice("get pages", this.device)
let pages = await this.browser.pages(); let pages = await this.browser.pages();
pages.forEach((currentPage) => { let needPages = pages.filter(currentPage => currentPage.url() === RDV_URL)
if (currentPage.url() === RDV_URL) { this.page = needPages[0]
this.page = currentPage; // pages.forEach((currentPage) => {
} // if (currentPage.url() === RDV_URL) {
}) // this.page = currentPage;
// }
// })
logWithDevice("this.page.bringToFront();", this.device) logWithDevice("this.page.bringToFront();", this.device)
await this.page.bringToFront(); await this.page.bringToFront();
@@ -856,11 +858,8 @@ class CommandorPage {
logWithDevice("get pages", this.device) logWithDevice("get pages", this.device)
let pages = await this.browser.pages(); let pages = await this.browser.pages();
logWithDevice("get current page", this.device) logWithDevice("get current page", this.device)
pages.forEach((currentPage) => { let needPages = pages.filter(currentPage => currentPage.url() === RDV_URL)
if (currentPage.url() === RDV_URL) { this.page = needPages[0]
this.page = currentPage;
}
})
logWithDevice("this.page.bringToFront();", this.device) logWithDevice("this.page.bringToFront();", this.device)
await this.page.bringToFront(); await this.page.bringToFront();
// this.page = pages; // this.page = pages;
@@ -1120,11 +1119,14 @@ class CommandorPage {
if (this.device.model() === "MI 5s") { if (this.device.model() === "MI 5s") {
if (this.browserPackageName.includes("brave")) if (this.browserPackageName.includes("brave"))
await this.device.shell("input tap " + 535 + " " + 1629) await this.device.shell("input tap " + 535 + " " + 1629)
else else
await this.device.shell("input tap " + 550 + " " + 1740) await this.device.shell("input tap " + 550 + " " + 1740)
} else } else {
await this.device.shell("input tap " + 411 + " " + 2100) if (this.browserPackageName.includes("brave") && this.device.model() === "CPH2219") {
await this.device.shell("input tap " + 411 + " " + 1977)
} else
await this.device.shell("input tap " + 411 + " " + 2100)
}
await delay(2000); await delay(2000);
} }
} }
+4 -2
View File
@@ -32,6 +32,7 @@ const ERR_CACHE_MISS_4 = "renvoyer les données"
const SLIDING_CAPTCHA_FR = "Pourquoi cette vérification" const SLIDING_CAPTCHA_FR = "Pourquoi cette vérification"
const SLIDING_CAPTCHA_FR_2 = "Glissez vers la droite pour" const SLIDING_CAPTCHA_FR_2 = "Glissez vers la droite pour"
const SLIDING_CAPTCHA_FR_3 = "la droite pour completer le puzzle" const SLIDING_CAPTCHA_FR_3 = "la droite pour completer le puzzle"
const SLIDING_CAPTCHA_FR_4 = " s'assure qu'on s'adresse bien"
const MESSAGE_FILL_FIELD_FR = "Demande de rendez-vous pour" 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 MESSAGE_FILL_FIELD_FR_2 = "Lensemble des champs de données doivent étre complétés"
const WELCOME_MESSAGE_FR = "Bienvenue dans Chrome" const WELCOME_MESSAGE_FR = "Bienvenue dans Chrome"
@@ -48,6 +49,7 @@ const CONFIRM_RESEND_FORM_FR = "Confirmer le nouvel envoi"
const CLOSED_MESSAGE_FR = "Depuis plus de 130 ans" const CLOSED_MESSAGE_FR = "Depuis plus de 130 ans"
const DIALOG_TO_SKIP = "facilement les commandes" const DIALOG_TO_SKIP = "facilement les commandes"
const ABOUT_BLANK = "about:blank" const ABOUT_BLANK = "about:blank"
const GOOGLE_DISCONNECT_FR_1 = "Connectez-vous a Google"
const GOOGLE_DISCONNECT_FR = "Rester déconnecté" const GOOGLE_DISCONNECT_FR = "Rester déconnecté"
const RECAPTCHA_FAILED_FR = "captcha a échoué" const RECAPTCHA_FAILED_FR = "captcha a échoué"
const BRAVE_NOTIFICATION = "notifications Brave " const BRAVE_NOTIFICATION = "notifications Brave "
@@ -96,13 +98,13 @@ class OCRChecker {
return OCRResult.TO_REFRESH return OCRResult.TO_REFRESH
} else if (result.includes(CHECKING_MSG_FR)) { } else if (result.includes(CHECKING_MSG_FR)) {
return OCRResult.RECHECK return OCRResult.RECHECK
} else if (result.includes(SLIDING_CAPTCHA_FR) || result.includes(SLIDING_CAPTCHA_FR_2) || result.includes(SLIDING_CAPTCHA_FR_3)) { } else if (result.includes(SLIDING_CAPTCHA_FR) || result.includes(SLIDING_CAPTCHA_FR_2) || result.includes(SLIDING_CAPTCHA_FR_3) || result.includes(SLIDING_CAPTCHA_FR_4)) {
return OCRResult.SLIDING_CAPTCHA return OCRResult.SLIDING_CAPTCHA
} else if (result.includes(MESSAGE_FILL_FIELD_FR) || result.includes(MESSAGE_FILL_FIELD_FR_2)) { } else if (result.includes(MESSAGE_FILL_FIELD_FR) || result.includes(MESSAGE_FILL_FIELD_FR_2)) {
return OCRResult.FILL_FIELD return OCRResult.FILL_FIELD
} else if (result.includes(WELCOME_MESSAGE_FR)) { } else if (result.includes(WELCOME_MESSAGE_FR)) {
return OCRResult.NEED_TO_CLICK_LATE_BTN return OCRResult.NEED_TO_CLICK_LATE_BTN
} else if (result.includes(GOOGLE_DISCONNECT_FR)) { } else if (result.includes(GOOGLE_DISCONNECT_FR) || result.includes(GOOGLE_DISCONNECT_FR_1)) {
return OCRResult.GOOGLE_DISCONNECT return OCRResult.GOOGLE_DISCONNECT
} else if (result.toLowerCase().includes(ONLINE_APPOINTMENT.toLowerCase())) { } else if (result.toLowerCase().includes(ONLINE_APPOINTMENT.toLowerCase())) {
return OCRResult.ONLINE_APPOINTMENT return OCRResult.ONLINE_APPOINTMENT