add serial number and random actions
This commit is contained in:
@@ -15,6 +15,7 @@ class ReserveResultPojo {
|
||||
this.email = mail;
|
||||
this.type = type;
|
||||
this.source_from = ""
|
||||
this.serial = ""
|
||||
this.hostName = hostName
|
||||
this.created_at = new Date().toLocaleString()
|
||||
}
|
||||
@@ -30,6 +31,7 @@ class ReserveResultPojo {
|
||||
url: this.url,
|
||||
store_type: this.storeType,
|
||||
source_from: this.source_from,
|
||||
serial: this.serial,
|
||||
created_at: this.created_at,
|
||||
hostName: this.hostName
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ class CommandorPage {
|
||||
this.isCountryChoosen = false;
|
||||
this.isPhoneInput = false;
|
||||
this.firstStart = true;
|
||||
this.isAlreadyRefresh = false;
|
||||
}
|
||||
|
||||
async connect_to_browser(ocrResult) {
|
||||
@@ -142,6 +143,23 @@ class CommandorPage {
|
||||
}
|
||||
}
|
||||
|
||||
async generateRandomActions() {
|
||||
logWithDevice("will reload page", this.device)
|
||||
await this.handleBraveSkipBtn()
|
||||
await delay(1000);
|
||||
let cmd = "input swipe 382 482 382 1682"
|
||||
logWithDevice("will send cmd:" + cmd, this.device)
|
||||
this.device.shell(cmd);
|
||||
await delay(2000);
|
||||
let limit = getRandom()
|
||||
for (let i = 1; i <= limit; i++) {
|
||||
this.device.shell(cmd);
|
||||
await delay(1000);
|
||||
}
|
||||
await this.clickOnConfirmBtn();
|
||||
await this.checkResultWithOcr();
|
||||
}
|
||||
|
||||
async checkIfSuccessful() {
|
||||
let content = await this.page.content();
|
||||
if (content.includes(MESSAGE_URL_VALIDATION_FR) || content.includes(MESSAGE_URL_VALIDATION_EN)) {
|
||||
@@ -167,7 +185,9 @@ class CommandorPage {
|
||||
}
|
||||
// await this.acceptCookies();
|
||||
await this.enableDisableAirPlanMode();
|
||||
// await delay(10 * 1000);
|
||||
// await openUrlWithAdb("https://www.google.fr", this.device)
|
||||
// await delay(2 * 1000)
|
||||
|
||||
await openUrlWithAdb(RDV_URL, this.device)
|
||||
await delay(10 * 1000)
|
||||
await this.checkResultWithOcr()
|
||||
@@ -715,6 +735,7 @@ class CommandorPage {
|
||||
// save to mongoDb
|
||||
let reserve = ReserveResultPojo.create_from_contact(this.contact, id, url, this.choosedStore, publishType);
|
||||
reserve.source_from = this.device.model();
|
||||
reserve.serial = this.device.serial();
|
||||
await this.mongoManager.saveReserveToDb(reserve.to_mongo_dict())
|
||||
if (!this.page.isClosed()) {
|
||||
try {
|
||||
@@ -1036,7 +1057,12 @@ class CommandorPage {
|
||||
case
|
||||
OCRResult.BLOCKED
|
||||
:
|
||||
if (this.isAlreadyRefresh) {
|
||||
await this.resetBrowser();
|
||||
} else {
|
||||
this.isAlreadyRefresh = true;
|
||||
await this.generateRandomActions()
|
||||
}
|
||||
break;
|
||||
case
|
||||
OCRResult.ONLINE_APPOINTMENT
|
||||
|
||||
Reference in New Issue
Block a user