Merge branch 'master' into feature/gui

This commit is contained in:
2022-09-12 21:28:34 +02:00
+44 -16
View File
@@ -101,13 +101,22 @@ class CommandorPage {
}
async chooseCountry(page) {
await page.locator(COUNTRY_ID).focus();
await delay(getRandomWaitTime())
await page.click(COUNTRY_ID);
await delay(getRandomWaitTime())
await page.selectOption(COUNTRY_ID, 'FR');
await delay(getRandomWaitTime())
// await page.click(COUNTRY_ID);
if (!page.isClosed()) {
try {
await page.locator(COUNTRY_ID).focus();
await delay(getRandomWaitTime())
await page.click(COUNTRY_ID);
await delay(getRandomWaitTime())
await page.selectOption(COUNTRY_ID, 'FR');
await delay(getRandomWaitTime())
} catch (e) {
console.log(e);
this.isTerminated = true;
}
// await page.click(COUNTRY_ID);
}
}
async fillEmail(page) {
@@ -117,17 +126,34 @@ class CommandorPage {
}
async inputPhoneNumber(page) {
await page.locator(PHONE_NUMBER).focus()
await page.locator(PHONE_NUMBER).fill("0" + this.contact.phoneNumber)
try {
if (!page.isClosed()) {
await page.locator(PHONE_NUMBER).focus()
await page.locator(PHONE_NUMBER).fill("0" + this.contact.phoneNumber)
}
} catch (e) {
console.log(e);
this.isTerminated = true;
}
}
async inputName(page) {
await page.locator(LAST_NAME).focus()
await delay(getRandomWaitTime())
await page.locator(LAST_NAME).fill(this.contact.lastName)
await page.locator(FIRST_NAME).focus()
await delay(getRandomWaitTime())
await page.locator(FIRST_NAME).fill(this.contact.firstName)
try {
if (!page.isClosed()) {
await page.locator(LAST_NAME).fill(this.contact.lastName)
await page.locator(FIRST_NAME).focus()
await delay(getRandomWaitTime())
await page.locator(FIRST_NAME).fill(this.contact.firstName)
}
} catch (e) {
console.log(e);
this.isTerminated = true
}
}
async inputPassportId(page) {
@@ -178,9 +204,11 @@ class CommandorPage {
document.getElementsByClassName("btn")[0].focus();
})
await delay(getRandomWaitTime())
this.page.evaluate(() => {
document.getElementsByClassName("btn")[0].click();
})
if (!this.page.isClosed()) {
this.page.evaluate(() => {
document.getElementsByClassName("btn")[0].click();
})
}
}
} catch (e) {
console.log(e)