Merge branch 'master' of bitbucket.org:panleicim/appointment_tool_js
This commit is contained in:
+9
-6
@@ -1,6 +1,9 @@
|
|||||||
adb -s 76a3ac8d shell pm clear com.android.chrome
|
adb -s RQ3005CA88 shell pm clear com.android.chrome
|
||||||
adb -s 76a3ac8d shell am set-debug-app --persistent com.android.chrome
|
adb -s RQ3005CA88 shell am set-debug-app --persistent com.android.chrome
|
||||||
adb -s 76a3ac8d shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
adb -s RQ3005CA88 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
adb -s 07f9c883 shell pm clear com.android.chrome
|
adb -s J4AXB761H2322WJ shell pm clear com.android.chrome
|
||||||
adb -s 07f9c883 shell am set-debug-app --persistent com.android.chrome
|
adb -s J4AXB761H2322WJ shell am set-debug-app --persistent com.android.chrome
|
||||||
adb -s 07f9c883 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
adb -s J4AXB761H2322WJ shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
adb -s e30eb015 shell pm clear com.android.chrome
|
||||||
|
adb -s e30eb015 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s e30eb015 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
@@ -7,7 +7,14 @@ const mongoManager = new MongoManager();
|
|||||||
|
|
||||||
let excelUtil = new ExcelUtil();
|
let excelUtil = new ExcelUtil();
|
||||||
let contactList = excelUtil.readContacts();
|
let contactList = excelUtil.readContacts();
|
||||||
mongoManager.connect().then(r => console.log("mongo connected"))
|
mongoManager.connect().then(r =>
|
||||||
|
|
||||||
|
android.devices().then((devices) => {
|
||||||
|
let segmentNumber = contactList.length / devices.length;
|
||||||
|
for (let i = 0; i < devices.length; i++) {
|
||||||
|
startWithList(contactList.slice(i * segmentNumber, segmentNumber * (i + 1)), devices[i]);
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
// Connect to the device.
|
// Connect to the device.
|
||||||
|
|
||||||
@@ -48,12 +55,12 @@ async function startWithList(contacts, device) {
|
|||||||
}, Promise.resolve());
|
}, Promise.resolve());
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
// (async () => {
|
||||||
android.devices().then((devices) => {
|
// android.devices().then((devices) => {
|
||||||
let segmentNumber = contactList.length / devices.length;
|
// let segmentNumber = contactList.length / devices.length;
|
||||||
for (let i = 0; i < devices.length; i++) {
|
// for (let i = 0; i < devices.length; i++) {
|
||||||
startWithList(contactList.slice(i * segmentNumber, segmentNumber * (i + 1)), devices[i]);
|
// startWithList(contactList.slice(i * segmentNumber, segmentNumber * (i + 1)), devices[i]);
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
})()
|
// })()
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class CommandorPage {
|
|||||||
this.page.on("response", (response) => {
|
this.page.on("response", (response) => {
|
||||||
this.onResponse(response)
|
this.onResponse(response)
|
||||||
})
|
})
|
||||||
await this.page.goto(RDV_URL);
|
await this.page.goto(RDV_URL, {timeout: 90 * 1000});
|
||||||
//wait 10 mins
|
//wait 10 mins
|
||||||
// Close the device.
|
// Close the device.
|
||||||
|
|
||||||
@@ -230,10 +230,12 @@ class CommandorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onResponse(response) {
|
async onResponse(response) {
|
||||||
let rex = new RegExp(REGEX_RDV_URL)
|
// let rex = new RegExp(REGEX_RDV_URL)
|
||||||
if (rex.test(response.url)) {
|
// console.log("onResponse with url:" + response.url())
|
||||||
console.log("rdv url found:" + response.url)
|
// if (rex.test(response.url())) {
|
||||||
}
|
// console.log("rdv url found:" + response.url())
|
||||||
|
// await this.push_message_to_db(PublishType.SUCCESS, response.url())
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
async push_message_to_queue(publishType) {
|
async push_message_to_queue(publishType) {
|
||||||
@@ -250,6 +252,20 @@ class CommandorPage {
|
|||||||
this.isTerminated = true
|
this.isTerminated = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async push_message_to_db(publishType, url) {
|
||||||
|
let splitedUrl = url.split("/");
|
||||||
|
let id = splitedUrl[splitedUrl.length - 1];
|
||||||
|
if (url === "https://rendezvousparis.hermes.com/client/welcome") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// save to mongoDb
|
||||||
|
let reserve = ReserveResultPojo.create_from_contact(this.contact, id, this.page.url(), 1, publishType);
|
||||||
|
reserve.source_from = this.device.model();
|
||||||
|
await this.mongoManager.saveReserveToDb(reserve.to_mongo_dict())
|
||||||
|
await delay(2 * 1000)
|
||||||
|
this.isTerminated = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
getErrors() {
|
getErrors() {
|
||||||
if (this.page.url() === BLANK_URL) {
|
if (this.page.url() === BLANK_URL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user