diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index e74e2ed..4068a93 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -33,8 +33,6 @@ const MESSAGE_URL_VALIDATION_EN = "Please click on the link we sent by email" const REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0-9]+" const DEFAULT_STORE = 'faubourg'; -const searchTexts = ['hermes+rdv+online+paris', 'hermes+rdv+enligne+paris', 'hermes+rdv+en+ligne+paris', 'hermes+rendezvous+en+ligne+paris', 'hermes+appointment+online+paris', 'hermes+appointment+online+paris', 'appointment+hermes+paris+on+line', 'hermes+rendez+vous+online+paris', 'hermes+rendez+vous+paris+en+ligne', 'hermes+rendez+vous+paris+enligne', 'hermes+rendez+vous+paris+online', 'online+appointment+hermes+paris', 'hermes+online+appointment+paris', 'paris+hermes+online+appointment'] - function delay(delayInMs) { return new Promise(resolve => { setTimeout(() => { @@ -92,31 +90,6 @@ class CommandorPage { this.firstStart = true; } - async getActivePage(browser, timeout) { - const start = new Date().getTime(); - while (new Date().getTime() - start < timeout) { - logWithDevice("get pages", this.device) - let pages = await browser.pages(); - try { - pages.forEach((currentPage) => { - if (currentPage.url() === RDV_URL) { - return currentPage; - } else { - try { - currentPage.close() - } catch (e) { - console.log(e) - } - } - }) - } catch (e) { - this.isTerminated = true; - console.log(e) - } - } - throw "Unable to get active page"; - } - async connect_to_browser(ocrResult) { console.log("connect_to_browser() called"); if (this.browser === undefined) { @@ -193,7 +166,7 @@ class CommandorPage { await this.enableDisableAirPlanMode(); // await delay(10 * 1000); await openUrlWithAdb(RDV_URL, this.device) - await delay(5000) + await delay(10000) await this.checkResultWithOcr() // await this.clickOnlineAppointment(); // } else { @@ -748,10 +721,6 @@ class CommandorPage { this.isTerminated = true } - async deleteFromBlackList() { - await this.mongoManager.removeFromBlackList(this.contact) - } - async getErrors() { logWithDevice("getErrors", this.device); await this.checkResultWithOcr(); @@ -1193,21 +1162,21 @@ class CommandorPage { async enableDisableAirPlanMode() { logWithDevice("will enable/disable airplane mode", this.device) - try { - // await this.device.shell("cmd connectivity airplane-mode enable") - await exceutShellCmd(this.device, "cmd connectivity airplane-mode enable") - await delay(1000) - await exceutShellCmd(this.device, "cmd connectivity airplane-mode disable") - // await this.device.shell("cmd connectivity airplane-mode disable") - await delay(2000) - } catch (e) { - try { - await this.device.shell("cmd connectivity airplane-mode disable") - } catch (e) { - console.log(e) - } - console.log(e) - } + // try { + // // await this.device.shell("cmd connectivity airplane-mode enable") + // await exceutShellCmd(this.device, "cmd connectivity airplane-mode enable") + // await delay(1000) + // await exceutShellCmd(this.device, "cmd connectivity airplane-mode disable") + // // await this.device.shell("cmd connectivity airplane-mode disable") + // await delay(2000) + // } catch (e) { + // try { + // await this.device.shell("cmd connectivity airplane-mode disable") + // } catch (e) { + // console.log(e) + // } + // console.log(e) + // } } async tapGoogleDisconnectBtn() {