OBA Website automated using playwright
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

72 lines
3.6 KiB

exports.AppConfig=
class AppConfig {
constructor(page) {
this.page = page;
this.onOffButton="//div[@class='card is_shop_open_card']//span[@class='flip-indecator']";
this.appConfLink="//span[normalize-space()='AppConfig']";
this.appconfIsShopOpen="//label[normalize-space()='Is Shop Open ?']";
this.currency="//select[@id='oba_appconfig_select_currency']";
this.notificationSoundLoop="//input[@id='oba_notification_sound_loop']";
this.cancellationTill="//input[@id='oba_cancellation_till']";
this.minimumCartPrize="//label[@id='oba_appconfig_minimum_cart_price_label']//input[@id='oba_appconfig_minimum_cart_price']";
this.deliveryCharge="//label[@id='oba_appconfig_delivery_charge_label']//input[@id='oba_appconfig_minimum_cart_price']";
this.callToAction="//input[@id='oba_appconfig_call_to_action']";
this.areaSelection="//select[@id='oba_appconfig_city_selection_list']";
this.typingText="//input[@id='oba_appconfig_area_selection']";
this.selectedText="//select[@id='oba_appconfig_area_selection_list']";
this.movingTypingText="//button[normalize-space()='>>']";
this.replaceMovedText="//button[normalize-space()='<<']";
this.saveButton="//button[@id='oba_appconfig_save']";
this.merchantCode="//a[normalize-space()='919480707707']";
this.calltoactionAPI="#oba_appconfig_call_to_action";
this.currencyAPI="#oba_appconfig_select_currency";
this.notificationSoundLoopAPI="#oba_notification_sound_loop";
this.cancellationTillAPI="#oba_cancellation_till";
this.minimumCartPrizeAPI="//label[@id='oba_appconfig_minimum_cart_price_label']//input[@id='oba_appconfig_minimum_cart_price']";
this.deliveryChargeAPI="//label[@id='oba_appconfig_delivery_charge_label']//input[@id='oba_appconfig_minimum_cart_price']";
this.areaTypeAPI="#oba_appconfig_city_selection_list";
}
async openAppConf(){
await this.page.locator(this.appConfLink).click();
}
async selectCurrency(currency){
await this.page.locator(this.currency).selectOption({label:currency});
}
async callToAction(Number){
await this.page.locator(this.callToAction).fill(Number);
}
async areaSelectionTest(area){
await this.page.locator(this.appConfLink).click();
await this.page.locator(this.areaSelection).selectOption({label:area});
}
async functionalityAppConfig(currency, notificationLoop, cancellationtill, minValue, charge, Number, input, text){
await this.page.locator(this.appConfLink).click();
await this.page.locator(this.onOffButton).click();
await this.page.locator(this.currency).selectOption({label:currency});
await this.page.locator(this.notificationSoundLoop).fill(notificationLoop);
await this.page.locator(this.cancellationTill).fill(cancellationtill);
await this.page.locator(this.minimumCartPrize).fill(minValue);
await this.page.locator(this.deliveryCharge).fill(charge);
await this.page.locator(this.callToAction).fill(Number);
await this.page.locator(this.areaSelection).click();
await this.page.waitForTimeout(5000);
await this.page.locator(this.areaSelection).selectOption({label:input});
await this.page.locator(this.typingText).fill(text);
await this.page.waitForTimeout(5000);
await this.page.locator(this.movingTypingText).click();
await this.page.locator(this.saveButton).click();
}
async toggleButton()
{
await this.page.locator(this.appConfLink).click();
await this.page.locator(this.onOffButton).click();
}
}