|
exports.CatlogPage=
|
|
class CatlogPage {
|
|
|
|
constructor(page) {
|
|
this.page = page;
|
|
this.catlogButton="//span[normalize-space()='Catlog']";
|
|
this.catalogViewType="//select[@id='oba_bud_view']";
|
|
this.productsViewType="//select[@id='oba_product_view']";
|
|
this.categoryImage="#edit_image";
|
|
this.uploadImage="#oba_product_input_display";
|
|
this.saveButton="//button[@class='btn btn-primary btn-block']";
|
|
this.womenSelection="//a[@id='670767f7272db54e96e423e6_anchor']";
|
|
this.menSelection="//a[@id='670767e7272db54e96e423e5_anchor']";
|
|
this.kidsSelection="//a[@id='670767fd272db54e96e423e7_anchor']";
|
|
|
|
this.catlogPageValidate="//h3[normalize-space()='Category Tree']";
|
|
|
|
|
|
//API Testing
|
|
this.saveButtonAPI="//button[@class='btn btn-primary btn-block']";
|
|
this.childViewBUDS="";
|
|
this.womenNameAPI="//input[@id='oba_bud_name']";
|
|
|
|
|
|
//Mens API Test
|
|
this.mens = "//a[@id='670767e7272db54e96e423e5_anchor']";
|
|
this.catname ="//*[@id='oba_bud_name']";
|
|
this.merchantid ="header[class='app-header'] li:nth-child(3) a:nth-child(1)";
|
|
//cattlog and products xpaths
|
|
this.catname ="//*[@id='oba_bud_name']";
|
|
this.catlogViewType ="//select[@id='oba_bud_view']";
|
|
this.productViewtype ="//select[@id='oba_product_view']";
|
|
this.categoryImage ="//img[@id='oba_product_display_image']";
|
|
this.cateforyImageEdit ="//*[name()='path' and contains(@d,'M186.67-18')]";
|
|
this.postion ="//input[@id='oba_bud_position']";
|
|
this.islive ="//span[normalize-space()='Yes']";
|
|
this.productincluded ="//select[@id='oba_bud_final_products']";
|
|
|
|
|
|
//catlog creation xpaths
|
|
this.createcat ="//input[@id='oba_bud_child_name']";
|
|
|
|
this.women ="//a[@id='670767f7272db54e96e423e6_anchor']";
|
|
this.kids = "//a[@id='670767fd272db54e96e423e7_anchor']";
|
|
this.tree ="//div[@class='col-4']//div[@class='tile']";
|
|
|
|
|
|
|
|
|
|
}
|
|
async clickCatalogButton(){
|
|
await this.page.locator(this.catlogButton).click();
|
|
}
|
|
async clickCatalogViewType(catlogView){
|
|
await this.page.locator(this.catlogButton).click();
|
|
await this.page.locator(this.catalogViewType).selectOption({label:catlogView});
|
|
}
|
|
async clickProductViewType(catlogView, productView ){
|
|
await this.page.locator(this.catlogButton).click();
|
|
await this.page.locator(this.catalogViewType).selectOption({label:catlogView});
|
|
await this.page.locator(this.productsViewType).selectOption({label:productView});
|
|
}
|
|
async imageUpload(catlogView, productView ){
|
|
await this.page.locator(this.catlogButton).click();
|
|
await this.page.locator(this.catalogViewType).selectOption({label:catlogView});
|
|
await this.page.locator(this.productsViewType).selectOption({label:productView});
|
|
await this.page.locator(this.categoryImage).click();
|
|
await this.page.locator(this.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Biriyani.jpg");
|
|
await this.page.locator(this.saveButton).click();
|
|
}
|
|
|
|
async imageUpload(catlogView, productView ){
|
|
await this.page.locator(this.catlogButton).click();
|
|
await this.page.locator(this.catalogViewType).selectOption({label:catlogView});
|
|
await this.page.locator(this.productsViewType).selectOption({label:productView});
|
|
await this.page.locator(this.categoryImage).click();
|
|
await this.page.locator(this.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Biriyani.jpg");
|
|
await this.page.locator(this.saveButton).click();
|
|
}
|
|
|
|
|
|
async NavigateToMens(){
|
|
await this.page.locator(this.mens).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.mens).click();
|
|
let catnames = await this.page.locator(this.catname).getAttribute('value');
|
|
let merchatcode = await this.page.locator(this.merchantid).textContent();
|
|
let CatType =await this.page.locator(this.catlogViewType);
|
|
await this.page.locator(this.catname).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.catlogViewType).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.productViewtype).waitFor({ state: 'visible' });
|
|
const selecteddcattype = await CatType.evaluate((element) => {
|
|
return element.options[element.selectedIndex].value;
|
|
});
|
|
let Prodtype =await this.page.locator(this.productViewtype);
|
|
const selecctedprodtype = await Prodtype.evaluate((element) => {
|
|
return element.options[element.selectedIndex].value;
|
|
|
|
});
|
|
let isActive = await this.page.locator(this.islive).isChecked();
|
|
return{catnames,selecteddcattype,selecctedprodtype,isActive,merchatcode}
|
|
}
|
|
|
|
|
|
|
|
async NavigateToWomens(){
|
|
await this.page.locator(this.women).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.women).click();
|
|
let merchatcode = await this.page.locator(this.merchantid).textContent();
|
|
await this.page.locator(this.catname).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.catlogViewType).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.productViewtype).waitFor({ state: 'visible' });
|
|
let catnames = await this.page.locator(this.catname).getAttribute('value');
|
|
let CatType =await this.page.locator(this.catlogViewType);
|
|
const selecteddcattype = await CatType.evaluate((element) => {
|
|
return element.options[element.selectedIndex].value;
|
|
});
|
|
let Prodtype =await this.page.locator(this.productViewtype);
|
|
const selecctedprodtype = await Prodtype.evaluate((element) => {
|
|
return element.options[element.selectedIndex].value;
|
|
});
|
|
let isActive = await this.page.locator(this.islive).isChecked();
|
|
|
|
return{ catnames,selecteddcattype,selecctedprodtype,isActive,merchatcode}
|
|
}
|
|
|
|
async NavigateToKids(){
|
|
await this.page.locator(this.kids).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.kids).click();
|
|
let merchatcode = await this.page.locator(this.merchantid).textContent();
|
|
await this.page.locator(this.catname).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.catlogViewType).waitFor({ state: 'visible' });
|
|
await this.page.locator(this.productViewtype).waitFor({ state: 'visible' });
|
|
let catnames = await this.page.locator(this.catname).getAttribute('value');
|
|
let CatType =await this.page.locator(this.catlogViewType);
|
|
const selecteddcattype = await CatType.evaluate((element) => {
|
|
return element.options[element.selectedIndex].value;
|
|
});
|
|
let Prodtype =await this.page.locator(this.productViewtype);
|
|
const selecctedprodtype = await Prodtype.evaluate((element) => {
|
|
return element.options[element.selectedIndex].value;
|
|
|
|
});
|
|
let isActive = await this.page.locator(this.islive).isChecked();
|
|
|
|
return{ catnames,selecteddcattype,selecctedprodtype,isActive,merchatcode}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async womenAPISelection(){
|
|
|
|
await this.page.locator(this.catlogButton).click();
|
|
await this.page.locator(this.womenSelection).click();
|
|
await this.page.locator(this.saveButtonAPI).click();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|