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.
 

65 lines
2.1 KiB

exports.CouponPage=
class CouponPage {
constructor(page) {
this.page = page;
this.couponButton="//span[normalize-space()='Coupon']";
this.createCouponButton="//a[normalize-space()='Create coupon']";
this.viewCouponButton="//a[normalize-space()='View coupon']";
this.selectDiscountRule="//select[@id='oba_coupon_criteria']";
this.discountType="//select[@id='oba_coupon_discount_type']";
this.minCartAmount="//input[@id='coupon_dicsount_cart_amount']";
this.enterDiscountAmount="//input[@id='coupon_discount']";
this.calenderSelect="//input[@id='valid_from']";
this.validFromDate="//input[@id='valid_from']";
this.validFromMonth="//input[@id='valid_from']";
this.shortDescription="//td[normalize-space()='50%OFF']";
this.descriptionCheck="//td[normalize-space()='Happy Diwali Makkalaeeee']";
this.internalCouponValue="//td[normalize-space()='MKSd20472']";
this.couponCode="//td[normalize-space()='COUPON50']";
this.forUsers="//td[normalize-space()='individual_users']";
this.shortDescriptionGuest="//td[normalize-space()='Diwali Design']";
this.descriptionCheckGuest="//td[normalize-space()='Wonderful and Beautiful Design']";
this.internalCouponValueGuest="//td[normalize-space()='0nk8e6137']";
this.couponCodeGuest="//td[normalize-space()='MIN500']";
this.forUsersGuest="(//td[contains(text(),'all_users')])[1]";
}
async CalenderCheck(){
await this.page.locator(this.couponButton).click();
await this.page.locator(this.createCouponButton).click();
// await this.page.locator(this.couponButton).click();
await this.page.locator(this.calenderSelect).click();
//await page.waitForTimeout(5000);
const year ="2024";
const month ="11";
const date="3";
await this.page.locator(this.validFromDate).fill('11/12/2024');
}
async viewCoupon(){
await this.page.locator(this.couponButton).click();
// await page.waitForTimeout(5000);
await this.page.locator(this.viewCouponButton).click();
}
}