change timeout to 2 mins
This commit is contained in:
@@ -10,16 +10,13 @@ const GeoCaptchaSolver = require("./GeoCaptchaSolver");
|
|||||||
BLANK_URL = "about:blank"
|
BLANK_URL = "about:blank"
|
||||||
const ERROR_CAPTCHA_UNSOLVABLE = "ERROR_CAPTCHA_UNSOLVABLE";
|
const ERROR_CAPTCHA_UNSOLVABLE = "ERROR_CAPTCHA_UNSOLVABLE";
|
||||||
|
|
||||||
const TIME_OUT = 60 * 1000 * 4//4 mins
|
const TIME_OUT = 60 * 1000 * 2//2 mins
|
||||||
|
|
||||||
const CONFIRMED_MESSAGE = "Your request for a Leather Goods appointment has been registered"
|
const CONFIRMED_MESSAGE = "Your request for a Leather Goods appointment has been registered"
|
||||||
const CONFIRMED_MESSAGE_FR = "Votre demande de rendez-vous Maroquinerie a bien été enregistrée et nous vous en remercions."
|
const CONFIRMED_MESSAGE_FR = "Votre demande de rendez-vous Maroquinerie a bien été enregistrée et nous vous en remercions."
|
||||||
const CONFIRMED_MESSAGE_CN = "您的皮具预约申请已登记"
|
const CONFIRMED_MESSAGE_CN = "您的皮具预约申请已登记"
|
||||||
const SORRY_SENTENCE_FR = "nous sommes sincèrement désolés de n'avoir pu vous satisfaire cette fois-ci"
|
|
||||||
const DOUBLE_REQUEST_ERROR_MESSAGE_FR = "Une demande avec les données saisies a déjà été validée aujourd’hui."
|
const DOUBLE_REQUEST_ERROR_MESSAGE_FR = "Une demande avec les données saisies a déjà été validée aujourd’hui."
|
||||||
const EMPTY_RESPONSE_ERROR = "ERR_EMPTY_RESPONSE"
|
const EMPTY_RESPONSE_ERROR = "ERR_EMPTY_RESPONSE"
|
||||||
const MESSAGE_URL_VALIDATION_FR = "Nous avons envoyé un lien par e-mail."
|
|
||||||
const MESSAGE_URL_VALIDATION_EN = "Please click on the link we sent by email"
|
|
||||||
const DOUBLE_REQUEST_ERROR_MESSAGE = "A request with the same data has already been validated today."
|
const DOUBLE_REQUEST_ERROR_MESSAGE = "A request with the same data has already been validated today."
|
||||||
|
|
||||||
const TOO_MANY_REQUEST_ERROR_MESSAGE = "Due to a large number of requests"
|
const TOO_MANY_REQUEST_ERROR_MESSAGE = "Due to a large number of requests"
|
||||||
@@ -43,10 +40,6 @@ function getRandom() {
|
|||||||
return Math.floor(Math.random() * 3);
|
return Math.floor(Math.random() * 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomWaitTime() {
|
|
||||||
return getRandom() * 1000
|
|
||||||
}
|
|
||||||
|
|
||||||
function log(message) {
|
function log(message) {
|
||||||
appointmentLogger.log({level: "info", message: message})
|
appointmentLogger.log({level: "info", message: message})
|
||||||
}
|
}
|
||||||
@@ -170,9 +163,9 @@ class LinkValidator {
|
|||||||
|
|
||||||
async onResponse(response) {
|
async onResponse(response) {
|
||||||
// let rex = new RegExp(REGEX_RDV_URL)
|
// let rex = new RegExp(REGEX_RDV_URL)
|
||||||
log("onResponse url:" + response.url())
|
log(this.device.model + ":onResponse url:" + response.url())
|
||||||
log("onResponse with statusCode:" + response.statusCode)
|
log(this.device.model + ":onResponse with statusCode:" + response.statusCode)
|
||||||
log("onResponse with message:" + response.statusMessage)
|
log(this.device.model + ":onResponse with message:" + response.statusMessage)
|
||||||
// if (rex.test(response.url())) {
|
// if (rex.test(response.url())) {
|
||||||
// log("rdv url found:" + response.url())
|
// log("rdv url found:" + response.url())
|
||||||
// await this.push_message_to_db(PublishType.SUCCESS, response.url())
|
// await this.push_message_to_db(PublishType.SUCCESS, response.url())
|
||||||
@@ -208,12 +201,12 @@ class LinkValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async handleError(errorContent) {
|
async handleError(errorContent) {
|
||||||
log("handle error:" + errorContent);
|
log(this.device.model + ":handle error:" + errorContent);
|
||||||
if (errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE) || errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE_FR)) {
|
if (errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE) || errorContent.includes(DOUBLE_REQUEST_ERROR_MESSAGE_FR)) {
|
||||||
this.isTerminated = true;
|
this.isTerminated = true;
|
||||||
} else if (errorContent.includes(TOO_MANY_REQUEST_ERROR_MESSAGE) || errorContent.includes(TOO_MANY_REQUEST_ERROR_MESSAGE_FR)) {
|
} else if (errorContent.includes(TOO_MANY_REQUEST_ERROR_MESSAGE) || errorContent.includes(TOO_MANY_REQUEST_ERROR_MESSAGE_FR)) {
|
||||||
//add contact to black list and set terminated the task
|
//add contact to black list and set terminated the task
|
||||||
log("handle error: will save to black list db");
|
log(this.device.model + ":handle error: will save to black list db");
|
||||||
} else if (errorContent.includes(CAPTCHA_ERROR_MESSAGE) || errorContent.includes(CAPTCHA_ERROR_MESSAGE_FR)) {
|
} else if (errorContent.includes(CAPTCHA_ERROR_MESSAGE) || errorContent.includes(CAPTCHA_ERROR_MESSAGE_FR)) {
|
||||||
this.isTerminated = true;
|
this.isTerminated = true;
|
||||||
}
|
}
|
||||||
@@ -221,7 +214,7 @@ class LinkValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async resetBrowser() {
|
async resetBrowser() {
|
||||||
console.log("will reset browser")
|
console.log(this.device.model + ":will reset browser")
|
||||||
await this.device.shell("pm clear com.android.chrome")
|
await this.device.shell("pm clear com.android.chrome")
|
||||||
await delay(1000)
|
await delay(1000)
|
||||||
await this.device.shell("am set-debug-app --persistent com.android.chrome")
|
await this.device.shell("am set-debug-app --persistent com.android.chrome")
|
||||||
|
|||||||
Reference in New Issue
Block a user