diff --git a/Biriyani.jpg b/Biriyani.jpg new file mode 100644 index 0000000..08a50db Binary files /dev/null and b/Biriyani.jpg differ diff --git a/pages/AppConfig.js b/pages/AppConfig.js new file mode 100644 index 0000000..aed65de --- /dev/null +++ b/pages/AppConfig.js @@ -0,0 +1,53 @@ +exports.AppConfig= +class AppConfig { + + constructor(page) { + this.page = page; + this.appConfLink="//span[normalize-space()='AppConfig']"; + this.currency="//select[@id='oba_appconfig_select_currency']"; + 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']"; + } + + 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 areaSelection(area){ + + await this.page.locator(this.areaSelection).selectOption({label:area}); + } + async functionalityAppConfig(currency, minValue, charge, Number, area, text){ + await this.page.locator(this.appConfLink).click(); + await this.page.locator(this.currency).selectOption({label:currency}); + 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).selectOption({label:area}); + await this.page.locator(this.typingText).fill(text); + await this.page.waitForTimeout(5000); + await this.page.locator(this.movingTypingText).click(); + await this.page.waitForTimeout(5000); + await this.page.locator(this.saveButton).click(); + } + + + + + + +} diff --git a/pages/CatlogPage.js b/pages/CatlogPage.js new file mode 100644 index 0000000..abe301a --- /dev/null +++ b/pages/CatlogPage.js @@ -0,0 +1,56 @@ +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']"; + + + + + + + + + + + } + 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(); + } + + + + + + + + + +} + +//await this.page.locator("#edit_image").click(); +//await this.page.locator("#oba_product_input_display").setInputFiles("C:/Automate Testing/OBA Automation/Biriyani.jpg"); +//await this.page.locator(this.saveButton).click(); \ No newline at end of file diff --git a/pages/LoginPage.js b/pages/LoginPage.js index a7b61d8..4b52af4 100644 --- a/pages/LoginPage.js +++ b/pages/LoginPage.js @@ -6,6 +6,8 @@ class LoginPage { this.usernameInput = "//input[@name='oba_login_emailid']"; this.passwordInput = "//input[@placeholder='Password']"; this.signinButton = "//button[normalize-space()='SIGN IN']"; + this.forgotPassword = "//a[normalize-space()='Forgot Password ?']"; + this.backToLogin="//a[normalize-space()='Back to Login']"; } async gotoLoginPage(){ @@ -17,15 +19,27 @@ class LoginPage { await this.page.locator(this.usernameInput).fill(username); await this.page.locator(this.passwordInput).fill(password); await this.page.locator(this.signinButton).click(); + await this.page.waitForTimeout(5000); } async loginWithCrtPassword(){ - await this.page.fill(this.usernameInput,'rabisundaram@gmail.com'); await this.page.locator(this.passwordInput).fill('#12345678A'); await this.page.locator(this.signinButton).click(); } -} \ No newline at end of file + async forgetPasswordLink(){ + await this.page.locator(this.forgotPassword).click(); + + } + async backToLoginLink(){ + await this.page.locator(this.backToLogin).click(); + + } + +} + + + diff --git a/pages/MerchantAppConf.js b/pages/MerchantAppConf.js deleted file mode 100644 index aa868c0..0000000 --- a/pages/MerchantAppConf.js +++ /dev/null @@ -1,32 +0,0 @@ -exports.MerchantAppConf= -class MerchantAppConf { - - constructor(page) { - this.page = page; - this.appConfLink="//span[normalize-space()='AppConfig']"; - this.currency="//select[@id='oba_appconfig_select_currency']"; - 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']"; - } - - 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); - } - - - - - -} diff --git a/pages/MerchantOrder.js b/pages/MerchantOrder.js deleted file mode 100644 index 9a252a4..0000000 --- a/pages/MerchantOrder.js +++ /dev/null @@ -1,18 +0,0 @@ -exports.MerchantOrder= -class MerchantOrder { - - constructor(page) { - this.page = page; - this. - - - - - - - - - - - } -} diff --git a/pages/OrderPage.js b/pages/OrderPage.js new file mode 100644 index 0000000..411d8cd --- /dev/null +++ b/pages/OrderPage.js @@ -0,0 +1,49 @@ +exports.OrderPage = +class OrderPage { + + constructor(page) { + this.page = page; + this.ordersButton="//span[normalize-space()='Orders']"; + this.ordersListButton="//a[normalize-space()='Order List']"; + this.exportButton="//a[@class='treeview-item active']"; + this.orderStatus="//select[@id='oba_edit_order_status_filter']"; + this.usernameTextbox="//input[@id='oba_order_search']"; + this.textBox="//input[@id='oba_order_search']"; + this.filterButton="#oba_edit_order_filter"; + + } + async clickOrdersButton(){ + await this.page.locator(this.ordersButton).click(); + } + async clickOrdersListButton(){ + await this.page.locator(this.ordersButton).click(); + //await page.waitForTimeout(5000); + await this.page.locator(this.ordersListButton).click(); + } + async orderStatusCheck(orderStatus){ + await this.page.locator(this.ordersButton).click(); + //await page.waitForTimeout(5000); + await this.page.locator(this.ordersListButton).click(); + await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); + // await page.waitForTimeout(5000); + } + async checkFilterButton(orderStatus){ + await this.page.locator(this.ordersButton).click(); + //await page.waitForTimeout(5000); + await this.page.locator(this.ordersListButton).click(); + await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); + // await page.waitForTimeout(5000); + await this.page.locator(this.filterButton).click(); + } + async textBoxSearch(orderStatus, textBox){ + await this.page.locator(this.ordersButton).click(); + //await page.waitForTimeout(5000); + await this.page.locator(this.ordersListButton).click(); + await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); + // await page.waitForTimeout(5000); + await this.page.locator(this.textBox).fill(textBox); + await this.page.locator(this.filterButton).click(); + + } + } + diff --git a/pages/ProductPage.js b/pages/ProductPage.js new file mode 100644 index 0000000..6ee7fc9 --- /dev/null +++ b/pages/ProductPage.js @@ -0,0 +1,102 @@ +exports.ProductPage= +class ProductPage { + + constructor(page) { + this.page = page; + this.productsButton = "//span[normalize-space()='Products']"; + this.productListButton= "//a[normalize-space()='Product List']"; + this.addProductButton="//a[normalize-space()='Add Product']"; + this.productName="//input[@id='oba_product_name']"; + this.productPrize="//input[@id='oba_product_price']"; + this.managedRadioButton="//input[@id='managed']"; + this.unmanagedRadioButton="//input[@id='unmanaged']"; + this.productQuantityValue="//input[@id='oba_product_quantity']"; + this.orderLimit="//input[@id='oba_product_order_limit']"; + this.taxIn="//input[@id='oba_product_tax']"; + this.productAvailableCheck="//input[@name='isAvailable']"; + this.isLiveCheck="//input[@name='isLive']"; + this.shortDescription="//textarea[@id='oba_product_short_description']"; + this.productDescription="//textarea[@name='editor-html-code']"; + this.productImage="#edit_image"; + this.uploadImage="#oba_product_input_display"; + this.productlistSearchBox="//input[@id='oba_product_search']"; + this.searchBox="//i[@class='fa fa-lg fa-fw fa-search']"; + this.editButton="//i[@class='fa fa-lg fa-edit']"; + this.saveButton="//button[@class='btn btn-primary btn-block']"; + } + + async clickProductsButton(){ + await this.page.locator(this.productsButton).click(); + } + async clickProductlistButton(){ + await this.page.locator(this.productsButton).click(); + await this.page.locator(this.productListButton).click(); + } + async clickAddProductButton(){ + await this.page.locator(this.productsButton).click(); + await this.page.locator(this.addProductButton).click(); + } + async addProductFunctionality(productName, productPrize, productQuantity, orderLimitvalue, taxin, shortDescription){ + await this.page.locator(this.productsButton).click(); + + await this.page.locator(this.addProductButton).click(); + await this.page.locator(this.productName).fill(productName); + await this.page.locator(this.productPrize).fill(productPrize); + await this.page.locator(this.managedRadioButton).check(); + await this.page.locator(this.productQuantityValue).fill(productQuantity); + await this.page.locator(this.orderLimit).fill(orderLimitvalue); + await this.page.locator(this.taxIn).fill(taxin); + await this.page.locator(this.productAvailableCheck).check(); + await this.page.locator(this.isLiveCheck).check(); + await this.page.locator(this.shortDescription).fill(shortDescription); + await this.page.waitForSelector('.CodeMirror'); + await this.page.evaluate(() => { + const codeMirrorElement = document.querySelector('.CodeMirror'); + codeMirrorElement.CodeMirror.setValue('Yummy! Delicious Biriyani Taste the Beauty of Kanyakumari'); + }); + + await this.page.locator(this.productImage).click(); + await this.page.locator(this.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Biriyani.jpg"); + await this.page.locator(this.saveButton).click(); + } + + async addProductFunctionalityUnmanaged(productName, productPrize, orderLimitvalue, taxin, shortDescription){ + await this.page.locator(this.productsButton).click(); + await this.page.locator(this.addProductButton).click(); + await this.page.locator(this.productName).fill(productName); + await this.page.locator(this.productPrize).fill(productPrize); + await this.page.locator(this.unmanagedRadioButton).check(); + await this.page.locator(this.orderLimit).fill(orderLimitvalue); + await this.page.locator(this.taxIn).fill(taxin); + await this.page.locator(this.productAvailableCheck).check(); + await this.page.locator(this.isLiveCheck).check(); + await this.page.locator(this.shortDescription).fill(shortDescription); + await this.page.waitForSelector('.CodeMirror'); + await this.page.evaluate(() => { + const codeMirrorElement = document.querySelector('.CodeMirror'); + codeMirrorElement.CodeMirror.setValue('Yummy! Delicious Biriyani Taste the Beauty of Kanyakumari'); + }); + + await this.page.locator(this.productImage).click(); + await this.page.locator(this.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Biriyani.jpg"); + await this.page.locator(this.saveButton).click(); + } + + + + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/tests/AppConfig.spec.js b/tests/AppConfig.spec.js new file mode 100644 index 0000000..5c9c15e --- /dev/null +++ b/tests/AppConfig.spec.js @@ -0,0 +1,28 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { AppConfig } from '../pages/AppConfig'; + + + +test('AppConfig 1',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const config = new AppConfig(page); + await config.openAppConf(); + await page.waitForTimeout(3000) + await expect(await page.locator("//select[@id='oba_appconfig_select_currency']n")).toBeVisible(); +}) + + +test('AppConfig 2',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const config = new AppConfig(page); + await config.functionalityAppConfig('UAE dirham (د.إ;)', '400', '35', '9565456737', 'State', 'Tamil Nadu'); + await page.waitForTimeout(3000) + +}) \ No newline at end of file diff --git a/tests/CatlogPage.spec.js b/tests/CatlogPage.spec.js new file mode 100644 index 0000000..ddf51b1 --- /dev/null +++ b/tests/CatlogPage.spec.js @@ -0,0 +1,17 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { CatlogPage } from '../pages/CatlogPage'; + + + +test('Catlog 1',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const catlog = new CatlogPage(page); + //await catlog.clickCatalogButton(); + await catlog.imageUpload('BUDS_LIST', 'PRODUCTS_LEFT'); + await page.waitForTimeout(3000) + +}) \ No newline at end of file diff --git a/tests/LoginPage.spec.js b/tests/LoginPage.spec.js index 8a09d86..3c7dab0 100644 --- a/tests/LoginPage.spec.js +++ b/tests/LoginPage.spec.js @@ -1,12 +1,64 @@ const {test, expect} =require('@playwright/test') import { LoginPage } from '../pages/LoginPage'; + + test('Login Page1',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaram@gmail.com','#12345678A') - await page.waitForTimeout(3000) - console.log('Password is Logged in Successfully'); - // await login.gotoLoginPage(); - // await login.loginWithCrtPassword() + await expect(page).toHaveURL('https://jaicrm1.orderbookings.com/merchant/index/index') + await expect(page).toHaveTitle('OBA') + await expect(await page.locator("//p[contains(text(),'Micheal Rabi')]")).toBeVisible(); await page.close(); -}) \ No newline at end of file +}) +test('Login Page2',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaram@gmail.com','') + const msg=await page.locator("//input[@placeholder='Password']").getAttribute("ariaHasPopup"); + console.log(msg); + await page.close(); +}) + +test('Login Page3',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('','#12345678A') + await expect(page).toHaveURL('https://jaicrm1.orderbookings.com/merchant/index/index') + await expect(page).toHaveTitle('OBA') + await expect(await page.locator("//p[contains(text(),'Micheal Rabi')]")).toBeVisible(); + //document.querySelector('input').value = 'New Value'; + // await page.waitForTimeout(3000) +// await expect(await this.page.getByLabel('rabisundaram@gmail.com')).toBeVisible(); + await page.close(); +}) + +test('ForgotPassword',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await page.waitForTimeout(3000) + await login.forgetPasswordLink() + await page.waitForTimeout(3000) + await expect(await page.locator("//button[normalize-space()='RESET']")).toBeVisible(); +}) +test('BacktoLogin',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await page.waitForTimeout(3000) + await login.forgetPasswordLink() + await page.waitForTimeout(3000) + await login.backToLoginLink() + await page.waitForTimeout(3000) + await expect(await page.locator("//button[normalize-space()='SIGN IN']")).toBeVisible(); +}) + +test('Login Page1',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('midhaja','#12345678A') + await page.waitForTimeout(3000) + const errorMessage = await page.locator("//div[@role='alert']").textContent() + console.log(errorMessage); + await expect(await page.locator("//div[@role='alert']")).toBeVisible(); +}) + diff --git a/tests/Merchant_AppConf.spec.js b/tests/Merchant_AppConf.spec.js deleted file mode 100644 index bebfb51..0000000 --- a/tests/Merchant_AppConf.spec.js +++ /dev/null @@ -1,183 +0,0 @@ -const {test, expect} =require('@playwright/test') -import { LoginPage } from '../pages/LoginPage'; -import { MerchantAppConf } from '../pages/MerchantAppConf'; - - - - -test.describe('AppConfButton',()=>{ -test('AppConfButton1',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - // await appConf.selectCurrency(); - await page.waitForTimeout(5000); - console.log('AppConfiguration button is working'); - await page.close(); -}) -}) -test.describe('TC_Currency',()=>{ - test('Currency1',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.selectCurrency('UAE dirham (د.إ;)'); - await page.waitForTimeout(5000); - console.log('Each option in the currency is selected'); - await page.close(); - }) - test('Currency2',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - // await page. - - - // const value=await appConf.selectCurrency(); - // await expect(value).toBeVisible(); - // if(value=='Indian rupee (₹)') - // { - //await page.waitForTimeout(5000); - console.log('Default option Indian rupee is selected'); - // }else - // { - // console.log('Given Currency is not default'); - // } - await page.close(); - }) - test('Currency3',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.selectCurrency('Bangladeshi taka (৳)'); - await page.waitForTimeout(5000); - console.log('Selected currency symbol is selected correctlty'); - await page.close(); - }) - test('Currency4',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.selectCurrency('Azerbaijani manat (AZN)'); - await page.waitForTimeout(5000); - await appConf.selectCurrency('Burundi franc (FBu)'); - await page.waitForTimeout(5000); - await appConf.selectCurrency('Brunei dollar (B$)'); - console.log('Currency codes are visible and correctly associated'); - await page.close(); - }) -}) -test.describe('TC_callToAction',()=>{ - test('CTA1',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction('DATAANALYS'); - console.log('Characters not allowed'); - await page.close(); - }) - test('CTA2',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction('@#$%%^^&*&*'); - console.log('Special Characters not allowed'); - await page.close(); - }) - test('CTA3',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction('Asdfghjk'); - console.log('Alphabets not allowed'); - await page.close(); - }) - test('CTA4',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction('98745612332'); - console.log('11digits not allowed'); - await page.close(); - }) - test('CTA5',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction('987456123'); - console.log('9digits not allowed'); - await page.close(); - }) - test('CTA6',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction(' 987456123'); - console.log('space at the start of the number is not allowed'); - await page.close(); - }) - test('CTA7',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction(''); - console.log('Blank number is not allowed'); - await page.close(); - }) - test('CTA8',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction('+1 82645289918'); - console.log('International number is not allowed'); - await page.close(); - }) - test('CTA9',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction('8870596481'); - console.log('10 digit numbers are allowed'); - await page.close(); - }) - test('CTA10',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const appConf = new MerchantAppConf(page); - await appConf.openAppConf(); - await appConf.callToAction('8870596481'); - console.log('Number Starts with 6,7,8,9 are allowed'); - await page.close(); - }) - - -}) \ No newline at end of file diff --git a/tests/Merchant_Order.spec.js b/tests/Merchant_Order.spec.js deleted file mode 100644 index f82a417..0000000 --- a/tests/Merchant_Order.spec.js +++ /dev/null @@ -1,70 +0,0 @@ -const {test, expect} =require('@playwright/test'); -const { clear } = require('console'); - -test.describe('MerchantOrder',()=>{ - - test('OrderTest1',async ({page})=>{ - await page.goto('https://jaicrm1.orderbookings.com/login/'); - await page.fill("//input[@name='oba_login_emailid']",'rabisundaram@gmail.com') - await page.fill("//input[@placeholder='Password']",'#12345678A') - await page.click("//button[normalize-space()='SIGN IN']") - await page.click("//li[@id='app-menu-list-orders']//a[@class='app-menu__item']") - // await page.click("//li[@id='app-menu-list-orders']//a[@class='app-menu__item']") - const orderlistlink = await page.locator("//a[normalize-space()='Order List']") - await expect(orderlistlink).toBeVisible(); - console.log('Order Button is working'); - // await page.close(); - }) - - test('OrderTest2',async ({page})=>{ - await page.goto('https://jaicrm1.orderbookings.com/login/'); - await page.fill("//input[@name='oba_login_emailid']",'rabisundaram@gmail.com') - await page.fill("//input[@placeholder='Password']",'#12345678A') - await page.click("//button[normalize-space()='SIGN IN']") - await page.click("//li[@id='app-menu-list-orders']//a[@class='app-menu__item']") - await page.click("//a[normalize-space()='Order List']") - console.log('OrderList Button is working'); - // await page.click("//select[@id='oba_edit_order_status_filter']") - await page.close(); - }) - - test('OrderTest3',async ({page})=>{ - await page.goto('https://jaicrm1.orderbookings.com/login/'); - await page.fill("//input[@name='oba_login_emailid']",'rabisundaram@gmail.com') - await page.fill("//input[@placeholder='Password']",'#12345678A') - await page.click("//button[normalize-space()='SIGN IN']") - await page.click("//li[@id='app-menu-list-orders']//a[@class='app-menu__item']") - await page.click("//a[normalize-space()='Order List']") - await page.click("//select[@id='oba_edit_order_status_filter']") - console.log('order status dropdown is working') - await page.close(); - }) - test('OrderTest4',async ({page})=>{ - await page.goto('https://jaicrm1.orderbookings.com/login/'); - await page.fill("//input[@name='oba_login_emailid']",'rabisundaram@gmail.com') - await page.fill("//input[@placeholder='Password']",'#12345678A') - await page.click("//button[normalize-space()='SIGN IN']") - await page.click("//li[@id='app-menu-list-orders']//a[@class='app-menu__item']") - await page.click("//a[normalize-space()='Order List']") - await page.locator("//select[@id='oba_edit_order_status_filter']").selectOption({label:'ORDER_STATUS_DECLINED'}); - await page.waitForTimeout(5000); - console.log('Order status declined is selected'); - await page.locator("//select[@id='oba_edit_order_status_filter']").selectOption({label:'ORDER_STATUS_REQUESTED'}); - await page.waitForTimeout(5000); - console.log('Order status requested is selected'); - await page.locator("//select[@id='oba_edit_order_status_filter']").selectOption({label:'ORDER_STATUS_PENDING'}); - await page.waitForTimeout(5000); - console.log('Order status Pending is selected'); - await page.locator("//select[@id='oba_edit_order_status_filter']").selectOption({label:'ORDER_STATUS_CANCELLED'}); - await page.waitForTimeout(5000); - console.log('Order status cancelled is selected'); - await page.locator("//select[@id='oba_edit_order_status_filter']").selectOption({label:'ORDER_STATUS_COMPLETE'}); - console.log('Order status complete is selected'); - await page.close(); - }) -}) - - - - - diff --git a/tests/OrderPage.spec.js b/tests/OrderPage.spec.js new file mode 100644 index 0000000..6ab1f05 --- /dev/null +++ b/tests/OrderPage.spec.js @@ -0,0 +1,70 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { OrderPage } from '../pages/OrderPage'; + + +test('Order Page1',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const order = new OrderPage(page); + await order.clickOrdersButton(); + await page.waitForTimeout(5000); + await expect(await page.locator("//a[normalize-space()='Order List']")).toBeVisible(); +}) +test('Order Page2',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const order = new OrderPage(page); + await order.clickOrdersListButton(); + // await page.waitForTimeout(5000); + await expect(await page.locator("//select[@id='oba_edit_order_status_filter']")).toBeVisible(); +}) +test('Order Page3',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const order = new OrderPage(page); + await order.clickOrdersListButton(); + await page.waitForTimeout(5000); + //await order.orderStatusCheck('ORDER_STATUS_REQUESTED'); + // const value= await page.locator("//select[@id='oba_edit_order_status_filter']").textContent() + // console.log('value' +value); + //await expect(await page.locator("//select[@id='oba_edit_order_status_filter']")).textContent() + const options = await page.locator('#oba_edit_order_status_filter option') + await expect(options).toHaveCount(5); +}) +test('Order Page4',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + // await page.waitForTimeout(5000); + const order = new OrderPage(page); + await order.clickOrdersListButton(); + // await page.waitForTimeout(5000); + const value= await page.locator("//select[@id='oba_edit_order_status_filter']").textContent() + console.log(value); +}) + +test('Order Page5',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + //await page.waitForTimeout(5000); + const order = new OrderPage(page); + await order.orderStatusCheck('ORDER_STATUS_DECLINED'); +}) + +test('Order Page6',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const order = new OrderPage(page); + await order.textBoxSearch('ORDER_STATUS_DECLINED', 'Tomato Rice and Chicken Biriyani'); +}) + diff --git a/tests/ProductPage.spec.js b/tests/ProductPage.spec.js new file mode 100644 index 0000000..5a2c82d --- /dev/null +++ b/tests/ProductPage.spec.js @@ -0,0 +1,85 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { ProductPage } from '../pages/ProductPage'; +/* +test('Product Page1',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.clickProductsButton(); + await page.waitForTimeout(5000); + await expect(await page.locator("//a[normalize-space()='Product List']")).toBeVisible(); +}) +test('Product Page2',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.clickProductlistButton(); + await page.waitForTimeout(5000); + await expect(await page.locator("//input[@id='oba_product_search']")).toBeVisible(); +}) +test('Product Page3',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.clickAddProductButton(); + await page.waitForTimeout(5000); + await expect(await page.locator("//input[@id='oba_product_name']")).toBeVisible(); +}) +test('Product Page4',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionality('Biriyani', '250', '10', '5', '20','Dum Dum KK Biriyani'); + await page.waitForTimeout(5000); + await expect(await page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); + +}) +test('Product Page5',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityUnmanaged('Biriyani', '250', '5', '20','Dum Dum KK Biriyani'); + + await page.waitForTimeout(5000); + await expect(await page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); +}) +test('Product Page6',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityUnmanaged('Biriyani', '250', '5', '20','Dum Dum KK Biriyani'); + + await page.waitForTimeout(5000); + await expect(await page.locator("//td[normalize-space()='Un-managed']")).toBeVisible(); +})*/ +test('Product Page7',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionality('Biriyani', '250', '10', '5', '20','Dum Dum KK Biriyani'); + + await page.waitForTimeout(5000); + const options = await page.locator('//tbody/tr[1]/td[4]') + await expect(options).toHaveCount(10); + //await expect(await page.locator("//tbody/tr[1]/td[4]")).toBeVisible(); +}) + + + + +