diff --git a/Chicken Lollipop.jpg b/Chicken Lollipop.jpg new file mode 100644 index 0000000..eb18741 Binary files /dev/null and b/Chicken Lollipop.jpg differ diff --git a/Tandori.jpg b/Tandori.jpg new file mode 100644 index 0000000..791430f Binary files /dev/null and b/Tandori.jpg differ diff --git a/pages/AddressListAPI.js b/pages/AddressListAPI.js new file mode 100644 index 0000000..168bd91 --- /dev/null +++ b/pages/AddressListAPI.js @@ -0,0 +1,17 @@ +exports.AddressListAPI= +class AddressListAPI { + + constructor(page) { + this.page = page; + this.addressLine="//div[normalize-space()='Address : 37, Thomas Mount, 627109']"; + + + } + + async clickCatalogButton(){ + await this.page.locator(this.catlogButton).click(); + } + + + +} \ No newline at end of file diff --git a/pages/AppConfig.js b/pages/AppConfig.js index aed65de..cf671dc 100644 --- a/pages/AppConfig.js +++ b/pages/AppConfig.js @@ -3,17 +3,31 @@ 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.areaSelection=".form-control col-3 mt-4"; + 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(){ @@ -27,27 +41,32 @@ class AppConfig { await this.page.locator(this.callToAction).fill(Number); } - async areaSelection(area){ + async areaSelectionTest(area){ + await this.page.locator(this.appConfLink).click(); await this.page.locator(this.areaSelection).selectOption({label:area}); } - async functionalityAppConfig(currency, minValue, charge, Number, area, text){ + 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).selectOption({label:area}); + 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.waitForTimeout(5000); + // await this.page.waitForTimeout(5000); await this.page.locator(this.saveButton).click(); } - - - - - - + async toggleButton() + { + await this.page.locator(this.appConfLink).click(); + await this.page.locator(this.onOffButton).click(); + } } diff --git a/pages/CatlogPage.js b/pages/CatlogPage.js index abe301a..dec0189 100644 --- a/pages/CatlogPage.js +++ b/pages/CatlogPage.js @@ -10,15 +10,6 @@ class CatlogPage { this.uploadImage="#oba_product_input_display"; this.saveButton="//button[@class='btn btn-primary btn-block']"; - - - - - - - - - } async clickCatalogButton(){ await this.page.locator(this.catlogButton).click(); @@ -37,10 +28,20 @@ class CatlogPage { 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(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(); + } + + diff --git a/pages/ContentPage.js b/pages/ContentPage.js new file mode 100644 index 0000000..903bae2 --- /dev/null +++ b/pages/ContentPage.js @@ -0,0 +1,27 @@ +exports.ContentPage= +class ContentPage { + + constructor(page) { + this.page = page; + this.contentButton="//span[normalize-space()='Content']"; + this.contentToEdit="//select[@id='select_content_to_edit']"; + this.contentPageValidate="//h1[normalize-space()='Content Editor']"; + this.contentText="//div[@class='CodeMirror-scroll']"; + this.contentSave="//button[normalize-space()='Save']"; + } + async clickContentButton(){ + await this.page.locator(this.contentButton).click(); + } + async ContentToSave(contentToEditOption){ + await this.page.locator(this.contentButton).click(); + await this.page.locator(this.contentToEdit).selectOption({label:contentToEditOption}); + //await this.page.locator(this.contentText).fill(mainContent); + await this.page.waitForSelector('.CodeMirror'); + await this.page.evaluate(() => { + const codeMirrorElement = document.querySelector('.CodeMirror'); + codeMirrorElement.CodeMirror.setValue('Everything goes good'); + }); + await this.page.locator(this.contentSave).click(); + } + + } \ No newline at end of file diff --git a/pages/Couponpage.js b/pages/Couponpage.js new file mode 100644 index 0000000..2b04f1d --- /dev/null +++ b/pages/Couponpage.js @@ -0,0 +1,65 @@ +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(); + } + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/pages/Feedback.js b/pages/Feedback.js new file mode 100644 index 0000000..03074a8 --- /dev/null +++ b/pages/Feedback.js @@ -0,0 +1,15 @@ +exports.Feedback= +class Feedback { + + constructor(page) { + this.page = page; + this.selectFeedbackType="//span[@class='flip-indecator']"; + this.searchFeedback="//input[@id='oba_feedback_search']"; + this.searchButton="//i[@class='fa fa-lg fa-fw fa-search']"; + this.feedbackButton="//span[normalize-space()='Feedback']"; + + } + async clickContentButton(){ + await this.page.locator(this.contentButton).click(); + } +} \ No newline at end of file diff --git a/pages/LoginPage.js b/pages/LoginPage.js index 4b52af4..33a9c41 100644 --- a/pages/LoginPage.js +++ b/pages/LoginPage.js @@ -11,7 +11,7 @@ class LoginPage { } async gotoLoginPage(){ - await this.page.goto('https://jaicrm1.orderbookings.com/login/'); + await this.page.goto('https://dev.orderbookings.com/'); } async login(username, password){ @@ -25,8 +25,11 @@ class LoginPage { async loginWithCrtPassword(){ - await this.page.fill(this.usernameInput,'rabisundaram@gmail.com'); - await this.page.locator(this.passwordInput).fill('#12345678A'); + await this.page.fill(this.usernameInput,'xpcv2@rustyload.com'); + // await this.page.fill(this.usernameInput,'rabisundaram@gmail.com'); + await this.page.locator(this.passwordInput).fill('7777777777'); + // await this.page.locator(this.passwordInput).fill('#12345678A'); + await this.page.locator(this.signinButton).click(); } @@ -36,7 +39,6 @@ class LoginPage { } async backToLoginLink(){ await this.page.locator(this.backToLogin).click(); - } } diff --git a/pages/NotificationPage.js b/pages/NotificationPage.js new file mode 100644 index 0000000..cc64446 --- /dev/null +++ b/pages/NotificationPage.js @@ -0,0 +1,39 @@ +const { clear } = require("console"); + +exports.NotificationPage= +class NotificationPage { + + constructor(page) { + this.page = page; + this.notificationButton="//span[normalize-space()='Notification']"; + this.target = "//select[@id='notification_target']"; + this.title = "//input[@id='notificationtitle']"; + this.content = "//textarea[@id='notificationtext']"; + this.hours = "//select[@id='notification_hours']"; + this.minutes="//select[@id='notification_minutes']"; + this.scheduleNotification="//main[@class='app-content']//button[1]"; + this.sendNotification="//button[2]" + this.calenderSelector="//input[@id='notification_date']"; + this.monthYear='October 2024'; + this.calenderNext="//div[@class='datepicker-days']//th[@class='next'][normalize-space()='»']"; + } + + async datePicker(){ + await this.page.locator(this.notificationButton).click(); + //const year="2024"; + //const month="November"; + //const date="5"; + await this.page.locator(this.calenderSelector).click(); + const yearMonth = "January 2025" + const currentYearMonth=await this.page.locator('this.monthYear').textContent(); + while(true) + { + const currentYearMonth=await this.page.locator('this.monthYear').textContent().toString(); + if(currentYearMonth == yearMonth ) + { + break; + } + await this.page.locator(this.calenderNext).click(); + } + } +} \ No newline at end of file diff --git a/pages/OrderPage.js b/pages/OrderPage.js index 411d8cd..19336c8 100644 --- a/pages/OrderPage.js +++ b/pages/OrderPage.js @@ -10,7 +10,12 @@ class OrderPage { this.usernameTextbox="//input[@id='oba_order_search']"; this.textBox="//input[@id='oba_order_search']"; this.filterButton="#oba_edit_order_filter"; - + this.orderName="//div[normalize-space()='Name : Shubya']"; + this.orderEmail="//div[normalize-space()='Email : Shubya111@gmail.com']"; + this.orderPhone="//div[normalize-space()='Phone : 919480111222']"; + this.orderCost="//td[normalize-space()='200']"; + this.orderQty="//tbody/tr[1]/td[6]"; + this.orderAddressAPI="//div[normalize-space()='Address : 37, Thomas Mount, 627109']"; } async clickOrdersButton(){ await this.page.locator(this.ordersButton).click(); @@ -43,7 +48,6 @@ class OrderPage { // 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 index 6ee7fc9..f6d639d 100644 --- a/pages/ProductPage.js +++ b/pages/ProductPage.js @@ -23,6 +23,8 @@ class ProductPage { 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']"; + this.searchProduct="//input[@id='oba_product_search']"; + this.searchButton="//button[@id='oba_product_search_btn']"; } async clickProductsButton(){ @@ -58,7 +60,30 @@ class ProductPage { 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 addProductFunctionalityForAll(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 Taste, LifteTime Settlement'); + }); + + //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(); @@ -74,14 +99,54 @@ class ProductPage { 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'); + codeMirrorElement.CodeMirror.setValue('Crispy Chicken Tandori'); }); 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.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Tandori.jpg"); await this.page.locator(this.saveButton).click(); } + async addProductFunctionality1(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('Chicken Lollipop'); + }); + + await this.page.locator(this.productImage).click(); + await this.page.locator(this.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Chicken Lollipop.jpg"); + await this.page.locator(this.saveButton).click(); + } + + async searchProductName(productName){ + await this.page.locator(this.productsButton).click(); + await this.page.locator(this.productListButton).click(); + await this.page.locator(this.searchProduct).fill(productName); + await this.page.locator(this.searchButton).click(); + } + + async editProduct(){ + await this.page.locator(this.productsButton).click(); + await this.page.locator(this.productListButton).click(); + await this.page.locator(this.editButton).click(); + await this.page.locator(this.productAvailableCheck).click(); + await this.page.locator(this.saveButton).click(); + + } + diff --git a/pages/RunnerListPage.js b/pages/RunnerListPage.js new file mode 100644 index 0000000..8345e2e --- /dev/null +++ b/pages/RunnerListPage.js @@ -0,0 +1,15 @@ +exports.RunnerListPage= +class RunnerListPage { + + constructor(page) { + this.page = page; + this.runnerListButton="//span[normalize-space()='Runner list']"; + this.userTypeFlip="//span[@class='flip-indecator']"; + this.searchText="//input[@id='oba_user_search']"; + this.searchButton="//button[@id='oba_user_search_btn']"; + + } + async clickrunnerListButton(){ + await this.page.locator(this.runnerListButton).click(); + } +} \ No newline at end of file diff --git a/pages/UserPage.js b/pages/UserPage.js new file mode 100644 index 0000000..45e0ad1 --- /dev/null +++ b/pages/UserPage.js @@ -0,0 +1,36 @@ +exports.UserPage= +class UserPage { + + constructor(page) { + this.page = page; + this.Users = "//span[normalize-space()='Users']"; + this.activeUserButton = "//span[@class='flip-indecator']"; + this.enableButton = "//button[@id='66eaa9656b2f4a3d52a42549']"; + } + + async userPageButton(){ + await this.page.locator(this.Users).click(); + + } + async activeUserButtonCheck(){ + await this.page.locator(this.Users).click(); + await this.page.locator(this.activeUserButton).click(); + // const text =await this.page.locator("button:active").allInnerTexts(); + console.log(text); + + } + async activeUserButtonEdit(){ + await this.page.locator(this.Users).click(); + await this.page.locator(this.activeUserButton).click(); + await this.page.locator(this.enableButton).click(); + + + } + + + + + + + +} \ No newline at end of file diff --git a/tests/AddressListAPI.spec.js b/tests/AddressListAPI.spec.js new file mode 100644 index 0000000..4ac9ec6 --- /dev/null +++ b/tests/AddressListAPI.spec.js @@ -0,0 +1,81 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { AdddressListAPI } from '../pages/AddressListAPI'; +import { OrderPage } from '../pages/OrderPage'; + + +test('API Testing',async function ({ request, page }) { + const responsePost=await request.post('https://dev.orderbookings.com/api/user/addresslist?user_id=670e14cf14f563f755f3e2a1',{ + data: { + "addressLine1": "25", + "addressLine2": "ParangiMalai", + "city": "Chennai", + "stateOrProvince": "TN", + "postalCode": "6000025", + "phone": "919480111111", + "deliveryInstructions": null, + "isDefault": false, + "user_id": "670e14cf14f563f755f3e2a1", + "title": "test address", + "area": "Chennai" + } + + }) + + const res1 = await responsePost.json(); + useraddressid= res1.data.id; + + console.log(res1); + +/* + const response = await request.get('https://dev.orderbookings.com/api/user/addresslist?user_id=670e14cf14f563f755f3e2a1'); + console.log(await response.json()); + const res = await response.json(); + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const order = new OrderPage(page); + await order.clickOrdersListButton(); + // await address.openAppConf(); + // await page.waitForTimeout(3000) + // await expect(await page.locator(config.notificationSoundLoop)).toBeVisible(); + // expect.soft("//div[normalize-space()='Address : 37, Thomas Mount, 627109']").toContain(res.data[0].addressLine1); + //expect.soft("//div[normalize-space()='Address : 37, Thomas Mount, 627109']").toContain(res.data[0].addressLine2); + //expect.soft("//div[normalize-space()='Address : 37, Thomas Mount, 627109']").toContain((res.data[0].postalCode).toString()); + //expect.soft("//div[normalize-space()='Phone : 919480111111']").toContain((res.data[0].phone).toString()); + //expect.soft("//div[normalize-space()='order_id : 670e249314f563f755f3e2a5']").toContain(res.data[0].id); + //expect.soft("//div[normalize-space()='Phone : 919480111111']").toContain((res.data[0].phone).toString()); + + + + const responseDelete = await request.delete('https://dev.orderbookings.com/api/user/deleteaddress', { + data: { + "user_id": "670e14cf14f563f755f3e2a1", + "address_id": "670e249314f563f755f3e2a3" + } + }) + console.log(await responseDelete.json()); + + + await page.reload(); + + + + + + + + + + + + +*/ + + + + + + }) + diff --git a/tests/AppConfig.spec.js b/tests/AppConfig.spec.js index 5c9c15e..715052f 100644 --- a/tests/AppConfig.spec.js +++ b/tests/AppConfig.spec.js @@ -3,8 +3,7 @@ import { LoginPage } from '../pages/LoginPage'; import { AppConfig } from '../pages/AppConfig'; - -test('AppConfig 1',async ({page})=>{ +test('AppConfig button is working or not',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -12,17 +11,146 @@ test('AppConfig 1',async ({page})=>{ 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(); + await expect(await page.locator(config.notificationSoundLoop)).toBeVisible(); +}) + + +test('complete AppConfig page to check API',async ({page,request})=>{ + 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 (د.إ;)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); + + await page.close(); + + const response = await request.get('https://dev.orderbookings.com/api/config/919480707707?merchantCode=919480707707') + console.log(await response.json()) + const res = await response.json(); + //const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + //await page.waitForTimeout(5000); + // const config = new AppConfig(page); + await config.openAppConf(); + + expect.soft(config.merchantCode).toContain(res.data.merchantCode); + + const textBoxValue=await page.locator(config.calltoactionAPI).inputValue(); + expect.soft(textBoxValue).toContain(res.data.call_to_action); + + //const currencyValue=await page.locator(config.currencyAPI).inputValue(); + // expect.soft(currencyValue).toContain(res.data.currency_code); + + const notificationLoop = await page.locator(config.notificationSoundLoopAPI).inputValue(); + expect.soft(notificationLoop).toContain((res.data.notification_sound_loop).toString()); + + const cancellationTillResponse = await page.locator(config.cancellationTillAPI).inputValue(); + expect.soft(cancellationTillResponse).toContain((res.data.cancellation_till).toString()); + + const minimumCartPrizeResponse = await page.locator(config.minimumCartPrizeAPI).inputValue(); + expect.soft( minimumCartPrizeResponse).toContain((res.data.minimum_cart_price).toString()); + + const deliveryChargeResponse = await page.locator(config.deliveryChargeAPI).inputValue(); + expect.soft( deliveryChargeResponse).toContain((res.data.delivery_charge).toString()); + + expect.soft(config.areaSelection).toContain(res.data.area_type); + +}) + + +test('complete AppConfig page to check API',async ({page,request})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const config = new AppConfig(page); + await config.functionalityAppConfig('Argentine peso ($)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); + // await page.close(); + // await page.waitForTimeout(5000); + + //await login.gotoLoginPage(); + //await login.loginWithCrtPassword(); + //await page.waitForTimeout(5000); + //await config.openAppConf(); + //const text =page.locator(config.currency).allInnerTexts(); + //console.log(text); + + + //expect.soft(config.currencyAPI).toContain("Argentine peso ($)"); + + }) -test('AppConfig 2',async ({page})=>{ + + + +/* +test('AppConfig 3',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 config.toggleButton(); + await config.areaSelectionTest('State'); await page.waitForTimeout(3000) - -}) \ No newline at end of file + // await expect(await page.locator("//div[@class='card is_shop_open_card']//span[@class='flip-indecator']").isChecked()).toBeTruthy(); + // await expect(await expect("//div[@class='card is_shop_open_card']//span[@class='flip-indecator']").toHaveText('ON')) + // await config.functionalityAppConfig('UAE dirham (د.إ;)', '400', '35', '9565456737', 'State', 'Tamil Nadu'); + // await page.waitForTimeout(3000) + // await expect(page.getByLabel("ON")).toBeVisible(); + +}) + +test('APITesting for app config',async ({request,page})=>{ + const response = await request.get('https://dev.orderbookings.com/api/config/919480707707?merchantCode=919480707707') + console.log(await response.json()) + const res = await response.json(); + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const config = new AppConfig(page); + await config.openAppConf(); + + expect.soft(config.merchantCode).toContain(res.data.merchantCode); + + const textBoxValue=await page.locator(config.calltoactionAPI).inputValue(); + expect.soft(textBoxValue).toContain(res.data.call_to_action); + + //const currencyValue=await page.locator(config.currencyAPI).inputValue(); + // expect.soft(currencyValue).toContain(res.data.currency_code); + + const notificationLoop = await page.locator(config.notificationSoundLoopAPI).inputValue(); + expect.soft(notificationLoop).toContain((res.data.notification_sound_loop).toString()); + + const cancellationTillResponse = await page.locator(config.cancellationTillAPI).inputValue(); + expect.soft(cancellationTillResponse).toContain((res.data.cancellation_till).toString()); + + const minimumCartPrizeResponse = await page.locator(config.minimumCartPrizeAPI).inputValue(); + expect.soft( minimumCartPrizeResponse).toContain((res.data.minimum_cart_price).toString()); + + const deliveryChargeResponse = await page.locator(config.deliveryChargeAPI).inputValue(); + expect.soft( deliveryChargeResponse).toContain((res.data.delivery_charge).toString()); + + expect.soft(config.areaTypeAPI).toContain(res.data.area_type); + + + + + + // const toggleButton = await page.locator(config.onOffButton).isChecked(); + // const isNowToggledOn = await toggleButton.getAttribute('OFF') === 'true'; + // expect.soft(toggleButton).toContain(res.data.isShopOpen); + // expect(toggleButton).toBe(true) + + + //expect.soft(config.currencyAPI).toContain(res.data.currency_code); + // expect.soft(coupon.couponCodeGuest).toContain(res.data[0].campaign_code); + // expect.soft(coupon.forUsersGuest).toContain(res.data[0].for); +}) + +*/ \ No newline at end of file diff --git a/tests/CatlogPage.spec.js b/tests/CatlogPage.spec.js index ddf51b1..4cdc1c2 100644 --- a/tests/CatlogPage.spec.js +++ b/tests/CatlogPage.spec.js @@ -3,8 +3,19 @@ import { LoginPage } from '../pages/LoginPage'; import { CatlogPage } from '../pages/CatlogPage'; +test('CatlogButton is working?',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.clickCatalogButton(); + await page.waitForTimeout(3000) + +}) -test('Catlog 1',async ({page})=>{ +test('Buds List is selected',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -14,4 +25,105 @@ test('Catlog 1',async ({page})=>{ await catlog.imageUpload('BUDS_LIST', 'PRODUCTS_LEFT'); await page.waitForTimeout(3000) -}) \ No newline at end of file +}) +test('Buds sliding is selected',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_SLIDING', 'PRODUCTS_LEFT'); + await page.waitForTimeout(3000) + +}) +test('Buds grid is selected',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_GRID', 'PRODUCTS_LEFT'); + await page.waitForTimeout(3000) + +}) +test('product left is selected',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_GRID', 'PRODUCTS_LEFT'); + await page.waitForTimeout(3000) + +}) +test('product ping pong is selected',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_GRID', 'PRODUCTS_PING_PONG'); + await page.waitForTimeout(3000) + +}) +test('product right is selected',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_GRID', 'PRODUCTS_RIGHT'); + await page.waitForTimeout(3000) + +}) +test('product grid is selected',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_GRID', 'PRODUCTS_GRID'); + await page.waitForTimeout(3000) + +}) + + +test('Categories API Testing',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_GRID', 'PRODUCTS_GRID'); + + + await page.waitForTimeout(3000) + +}) + + +/*const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { ContentPage } from '../pages/ContentPage'; + + +test('Content page is opening?',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const content = new ContentPage(page); + await content.clickContentButton(); + await expect(await page.locator(content.contentPageValidate)).toBeVisible(); + // await page.waitForTimeout(3000) + +}) + +*/ \ No newline at end of file diff --git a/tests/ContentPage.spec.js b/tests/ContentPage.spec.js new file mode 100644 index 0000000..1e9ba8a --- /dev/null +++ b/tests/ContentPage.spec.js @@ -0,0 +1,54 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { ContentPage } from '../pages/ContentPage'; + +/* +test('Content page is opening?',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const content = new ContentPage(page); + await content.clickContentButton(); + await expect(await page.locator(content.contentPageValidate)).toBeVisible(); + // await page.waitForTimeout(3000) + +}) +*/ +test('Content page is able to save in privacy policy',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const content = new ContentPage(page); + await content.ContentToSave('Privacy Policy'); + // await expect(await page.locator(content.contentPageValidate)).toBeVisible(); + await page.waitForTimeout(3000); + + +}) + +test('Content page is able to save in Terms & Conditions',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const content = new ContentPage(page); + await content.ContentToSave('Terms & Conditions'); +// await expect(await page.locator(content.contentPageValidate)).toBeVisible(); + await page.waitForTimeout(3000); + + +}) +test('Content page is able to save in About Us',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const content = new ContentPage(page); + await content.ContentToSave('About Us'); +// await expect(await page.locator(content.contentPageValidate)).toBeVisible(); + await page.waitForTimeout(3000); + + +}) \ No newline at end of file diff --git a/tests/CouponPage.spec.js b/tests/CouponPage.spec.js new file mode 100644 index 0000000..66cb9f4 --- /dev/null +++ b/tests/CouponPage.spec.js @@ -0,0 +1,48 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { CouponPage } from '../pages/Couponpage'; + + +test('Login test with correct credentials',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + //const coupon = new CouponPage(page); + // await coupon.CalenderCheck(); +}) +test('APITesting_Coupon Get Details as User',async ({request,page})=>{ + const response = await request.get('https://dev.orderbookings.com/api/available-coupon/670e14cf14f563f755f3e2a1/919480707707') + console.log(await response.json()) + //expect(response.status()).toBe(200) + // const text = await response.text(); + // expect(text).toContain('Manju') + const res = await response.json(); + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const coupon = new CouponPage(page); + await coupon.viewCoupon(); + expect.soft(coupon.shortDescription).toContain(res.data[2].name); + expect.soft(coupon.descriptionCheck).toContain(res.data[2].description); + expect.soft(coupon.internalCouponValue).toContain(res.data[2].code); + expect.soft(coupon.couponCode).toContain(res.data[2].campaign_code); + expect.soft(coupon.forUsers).toContain(res.data[2].for); +}) +test('APITesting_Coupon Get Details as Guest',async ({request,page})=>{ + const response = await request.get('https://dev.orderbookings.com/api/available-coupon-guest/919480707707') + console.log(await response.json()) + const res = await response.json(); + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const coupon = new CouponPage(page); + await coupon.viewCoupon(); + expect.soft(coupon.shortDescriptionGuest).toContain(res.data[0].name); + expect.soft(coupon.descriptionCheckGuest).toContain(res.data[0].description); + expect.soft(coupon.internalCouponValueGuest).toContain(res.data[0].code); + expect.soft(coupon.couponCodeGuest).toContain(res.data[0].campaign_code); + expect.soft(coupon.forUsersGuest).toContain(res.data[0].for); +}) diff --git a/tests/Feedback.spec.js b/tests/Feedback.spec.js new file mode 100644 index 0000000..c32f350 --- /dev/null +++ b/tests/Feedback.spec.js @@ -0,0 +1,16 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { Feedback } from '../pages/Feedback'; + + +test('Content page is opening?',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const content = new ContentPage(page); + await content.clickContentButton(); + await expect(await page.locator(content.contentPageValidate)).toBeVisible(); + // await page.waitForTimeout(3000) + +}) \ No newline at end of file diff --git a/tests/LoginPage.spec.js b/tests/LoginPage.spec.js index 3d4c12c..721bc7f 100644 --- a/tests/LoginPage.spec.js +++ b/tests/LoginPage.spec.js @@ -2,34 +2,94 @@ const {test, expect} =require('@playwright/test') import { LoginPage } from '../pages/LoginPage'; -test('Login Page1',async ({page})=>{ +test('Login test with correct credentials',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); - await login.login('rabisundaram@gmail.com','#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(); + await login.login('xpcv2@rustyload.com','7777777777') + await expect(page).toHaveURL('https://dev.orderbookings.com/merchant/index/index') + // await expect(await page.locator("//p[contains(text(),'Micheal Rabi')]")).toBeVisible(); await page.close(); }) -test('Login Page2',async ({page})=>{ + +test('Login test with wrong password',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaram@gmail.com','#123466678A') + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); + //const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent() + // console.log(errorMessage); + await page.close(); +}) +test('Login test with wrong Email',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaatram@gmail.com','#12345678A') + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); + //const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent() + // console.log(errorMessage); + await page.close(); +}) +test('Login test Merchant enters email without @ symbol',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaatramgmail.com','#12345678A') + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); + //const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent() + // console.log(errorMessage); + await page.close(); +}) +test('Login test Merchant enters Email with excessive Length',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaatramiuegkdsfyuydklashmnfbdkashnbv@gmail.com','#12345678A') + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); + //const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent() + // console.log(errorMessage); + await page.close(); +}) + +test('Login test Merchant enters email without domain',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaatram@.com','#12345678A') + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); + //const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent() + // console.log(errorMessage); + await page.close(); +}) +test('Login test Merchant enters Email with consecutive dots',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaatram@gmail..com','#12345678A') + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); + //const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent() + // console.log(errorMessage); + await page.close(); +}) + +test('Login test with Empty Email',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('','#12345678A') + // await expect(await page.locator("//p[contains(text(),'Micheal Rabi')]")).toBeVisible(); + await page.close(); +}) +test('Login test with no password',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); +// const msg=await page.locator("//input[@placeholder='Password']").getAttribute("ariaHasPopup"); + // console.log(msg); await page.close(); }) -test('Login Page3',async ({page})=>{ +test('Login test with no Email',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.waitForTimeout(3000) + // await expect(await this.page.getByLabel('rabisundaram@gmail.com')).toBeVisible(); await page.close(); }) @@ -52,7 +112,7 @@ test('BacktoLogin',async ({page})=>{ await expect(await page.locator("//button[normalize-space()='SIGN IN']")).toBeVisible(); }) -test('Login Page 4',async ({page})=>{ +test('Invalid mail',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('midhaja','#12345678A') diff --git a/tests/NotificationPage.spec.js b/tests/NotificationPage.spec.js new file mode 100644 index 0000000..c111546 --- /dev/null +++ b/tests/NotificationPage.spec.js @@ -0,0 +1,13 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { NotificationPage } from '../pages/NotificationPage'; + +test('datepicker',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const notify = new NotificationPage(page); + await notify.datePicker(); + await page.close(); +}) \ No newline at end of file diff --git a/tests/OrderPage.spec.js b/tests/OrderPage.spec.js index 6ab1f05..89fcb7f 100644 --- a/tests/OrderPage.spec.js +++ b/tests/OrderPage.spec.js @@ -1,9 +1,10 @@ const {test, expect} =require('@playwright/test') +import { clear } from 'console'; import { LoginPage } from '../pages/LoginPage'; import { OrderPage } from '../pages/OrderPage'; -test('Order Page1',async ({page})=>{ +test('Order Button',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -13,7 +14,8 @@ test('Order Page1',async ({page})=>{ await page.waitForTimeout(5000); await expect(await page.locator("//a[normalize-space()='Order List']")).toBeVisible(); }) -test('Order Page2',async ({page})=>{ + +test('Order List Button',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -23,7 +25,7 @@ test('Order Page2',async ({page})=>{ // await page.waitForTimeout(5000); await expect(await page.locator("//select[@id='oba_edit_order_status_filter']")).toBeVisible(); }) -test('Order Page3',async ({page})=>{ +test('Order Status Dropdown Count',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -31,14 +33,10 @@ test('Order Page3',async ({page})=>{ 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); + const options = await page.locator('#oba_edit_order_status_filter option') + await expect(options).toHaveCount(5); }) -test('Order Page4',async ({page})=>{ +test('Order status dropdown menu',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -50,16 +48,17 @@ test('Order Page4',async ({page})=>{ console.log(value); }) -test('Order Page5',async ({page})=>{ +test('Order status selected',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'); + await order.orderStatusCheck('ORDER_STATUS_REQUESTED'); + //need to fi }) -test('Order Page6',async ({page})=>{ +test('Order declined',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -67,4 +66,97 @@ test('Order Page6',async ({page})=>{ const order = new OrderPage(page); await order.textBoxSearch('ORDER_STATUS_DECLINED', 'Tomato Rice and Chicken Biriyani'); }) +test('Order requested',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_REQUESTED', 'Tomato Rice and Chicken Biriyani'); +}) +test('Order pending',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_PENDING', 'Tomato Rice and Chicken Biriyani'); +}) +test('Order cancelled',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_CANCELLED', 'Tomato Rice and Chicken Biriyani'); + + + + +}) + +test('Order by ID API',async ({request,page})=>{ + + const response = await request.get('https://dev.orderbookings.com/api/order/syncOrders?user_id=670766e4272db54e96e423e0&phone=919480111222&lastupdatetime=0&merchantCode=919480707707&role=ROLE_TYPE_MERCHANT') + console.log(await response.json()) + //expect(response.status()).toBe(200) + // const text = await response.text(); + // expect(text).toContain('Manju') + const res = await response.json(); + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const order = new OrderPage(page); + const result = await order.textBoxSearch('ORDER_STATUS_COMPLETE', 'Shubya'); + // await page.waitForTimeout(5000); + //const username= result.OrderId; + //expect.soft("//td[normalize-space()='Shubya']").toContain(res.data[0].ordered_by_name); + expect.soft(order.orderName).toContain(res.data[0].ordered_by_name); + expect.soft(order.orderEmail).toContain(res.data[0].ordered_by_email); + expect.soft(order.orderPhone).toContain((res.data[0].ordered_by_address.phone).toString()); + expect.soft(order.orderCost).toContain((res.data[0].order_cost).toString()); + expect.soft(order.orderQty).toContain((res.data[0].ordered_items_qty[0]).toString()); + +}) +/* + + + + + + + + + + + +test('Order by POST request',async ({request})=>{ + + + const response = await request.post('https://jaicrm1.orderbookings.com/api/order/getorder/66ff73966374728214363781'{ + data: { + "ordered_by_name": "Micheal", + "ordered_by_email": "rabi2000@gmail.com", + "ordered_by_phone": "9600520046" + + } + }) + // console.log(await response.json()) + expect(response.status()).toBe(201) + + const text = await response.text(); + expect(text).toContain('Micheal') + + console.log(await response.json()); + + + + // 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_COMPLETE', 'Manju'); +})*/ \ No newline at end of file diff --git a/tests/ProductPage.spec.js b/tests/ProductPage.spec.js index 5a2c82d..1e9d2a2 100644 --- a/tests/ProductPage.spec.js +++ b/tests/ProductPage.spec.js @@ -1,8 +1,9 @@ const {test, expect} =require('@playwright/test') import { LoginPage } from '../pages/LoginPage'; import { ProductPage } from '../pages/ProductPage'; -/* -test('Product Page1',async ({page})=>{ + +test.describe('Product Name Test Cases',()=>{ +test('Product button',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -10,9 +11,9 @@ test('Product Page1',async ({page})=>{ const product = new ProductPage(page); await product.clickProductsButton(); await page.waitForTimeout(5000); - await expect(await page.locator("//a[normalize-space()='Product List']")).toBeVisible(); + await expect(page.locator("//a[normalize-space()='Product List']")).toBeVisible(); }) -test('Product Page2',async ({page})=>{ +test('Product list button',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -20,9 +21,9 @@ test('Product Page2',async ({page})=>{ const product = new ProductPage(page); await product.clickProductlistButton(); await page.waitForTimeout(5000); - await expect(await page.locator("//input[@id='oba_product_search']")).toBeVisible(); + await expect(page.locator("//input[@id='oba_product_search']")).toBeVisible(); }) -test('Product Page3',async ({page})=>{ +test('Add product button',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); @@ -30,56 +31,601 @@ test('Product Page3',async ({page})=>{ const product = new ProductPage(page); await product.clickAddProductButton(); await page.waitForTimeout(5000); - await expect(await page.locator("//input[@id='oba_product_name']")).toBeVisible(); + await expect(page.locator("//input[@id='oba_product_name']")).toBeVisible(); }) -test('Product Page4',async ({page})=>{ +test('Product Name is Empty',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('', '250', '10', '5', '20','KK Biriyani'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); + //Empty Name (Please fill out this field) need to locate. +}) +test('Product Name starts with space',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 product.addProductFunctionality(' Biriyani', '250', '10', '5', '20','KK Biriyani'); await page.waitForTimeout(5000); - await expect(await page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); + // await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); + //Name with space is accepted i.e space button is not working. +}) +test('Enter Number instead of name',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('96152456321', '250', '10', '5', '20','KK Biriyani'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); + //Name with space is accepted i.e space button is not working. +}) +test('Enter 50 Alphabet ',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('asdfghjklzmxncbvqwertyuioplkjhgfdsazxcvbnmqwertyui', '250', '10', '5', '20','KK Biriyani'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); + //Name with space is accepted i.e space button is not working. +}) +test('Enter Special Characters and symbol ',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('#4nskiu*()', '250', '10', '5', '20','KK Biriyani'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); + //Name with space is accepted i.e space button is not working. +}) +test('Product Name with Alphabet',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','KK Biriyani'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); }) -test('Product Page5',async ({page})=>{ +test('Product Name with space',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 product.addProductFunctionalityForAll('Butter Naan', '30', '10', '5', '20','Tasty Butter Naan'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='Butter Naan']")).toBeVisible(); +}) +test('Product Name with special character',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '50', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); +}) +}) +test.describe('Product Price Test Cases',()=>{ + test('Empty product prize',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Product prize entered other than numeric value',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai','1F', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + + test('Product prize entered with Negative value',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai','-40', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Product prize entered with Special Characters',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai','80%', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) +test('Valid Product prize',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); await page.waitForTimeout(5000); - await expect(await page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai','50', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//b[normalize-space()='50']")).toBeVisible(); }) -test('Product Page6',async ({page})=>{ +test('Product prize in decimal value',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 product.addProductFunctionalityForAll('Vadai','12.27', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//b[normalize-space()='12.27']")).toBeVisible(); +}) + test('Valid Product prize',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai','50', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//b[normalize-space()='50']")).toBeVisible(); +}) +test('Currency Symbol',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(page.locator("//span[@class='input-group-text']")).toBeVisible(); +}) + +test('merchant verify price leading with zero',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Vadai','1209.06', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//b[normalize-space()='12,09.06']")).toBeVisible(); +}) +test('merchant verify maximum length allowed',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Vadai','12095262', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//b[normalize-space()='12095262']")).toBeVisible(); +}) +test('merchant enters prize zero allowed',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Vadai','0', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//b[normalize-space()='0']")).toBeVisible(); +}) +}) + +test.describe('Quantity Limit Test Cases',()=>{ + test('Managed Radio button Check',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Empty quantity',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter other than number',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', 'Apple', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('merchant enters negative product quantity',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '-30', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('merchant enters special characters in product quantity',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '$5', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('merchant verify valid quantity entry in product quantity',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '5', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='5']")).toBeVisible(); + }) + + test('merchant enters decimal quantity',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '50.5', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + + test('merchant enters zero',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '0', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='0']")).toBeVisible(); + }) +}) +test.describe('Unmanaged Button',()=>{ +test('UnManaged Radio Button working',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('Tandoori', '450', '5', '20','Crispy Tandoori'); + await page.waitForTimeout(5000); + //await expect(page.locator("//td[normalize-space()='Tandoori']")).toBeVisible(); await expect(await page.locator("//td[normalize-space()='Un-managed']")).toBeVisible(); -})*/ -test('Product Page7',async ({page})=>{ +}) +}) +test.describe('Order Limit Test Cases',()=>{ + test('Empty order',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Space at the start of order limit',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', ' 6', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter character other than numeric value',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', 'one', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Negative order limit',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '-52', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Special characters in order limit',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '5%', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Decimal Value in order limit',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '100.5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Order limit leading with zero',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '050', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Maximum order limit',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '050', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Zero order limit',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '0', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) +}) + +test.describe('Product Description',()=>{ + test('Empty order',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) +}) + +test.describe('Tax in % Test Cases',()=>{ + test('Enter special character',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '^%','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter Alphabet',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', 'ab','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter space at the start of the word',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', ' 21','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Placeholder check for tax %',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(page.locator("//input[@id='oba_product_tax']")).toBeVisible(); + }) + test('Empty Tax %',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter Tax leading with zero',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '055','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter Tax% is maximum 100',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '100','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter Tax% is maximum 110',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '110','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter Tax% in negative value',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '-10','Idli is Tasty'); + await page.waitForTimeout(5000); + // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + test('Enter Tax% is decimal value',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '11.23','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) + +}) + +test.describe('Product Live CheckBox',()=>{ + test('Available and not available checkbox',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10','8','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='true']")).toBeVisible(); + await product.editProduct(); + await expect(page.locator("//td[normalize-space()='false']")).toBeVisible(); + + }) +}) + +/* +test.describe('Product Live CheckBox',()=>{ + test('available checkbox',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10','8','Idli is Tasty'); + await page.waitForTimeout(5000); + await expect(page.locator("//td[normalize-space()='true']")).toBeVisible(); + await product.editProduct(); + await expect(page.locator("//td[normalize-space()='false']")).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 product.addProductFunctionality('Biriyani', '250', '10', '5', '20','KK Biriyani'); + await page.waitForTimeout(5000); + await expect(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 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(); + const product = new ProductPage(page); + await product.addProductFunctionalityUnmanaged('Tandoori', '450', '5', '20','Crispy Tandoori'); + await page.waitForTimeout(5000); + //await expect(page.locator("//td[normalize-space()='Tandoori']")).toBeVisible(); + await expect(await page.locator("//td[normalize-space()='Un-managed']")).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.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(); +//}) +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.searchProductName('Biriyani'); + await page.waitForTimeout(5000); + const value= await page.locator("//td[normalize-space()='Biriyani']").textContent() + console.log(value); + await expect(page.locator("//td[normalize-space()='Biriyani']")).toContainText('Biriyani'); +}) +*/ \ No newline at end of file diff --git a/tests/RegisterPage.spec.js b/tests/RegisterPage.spec.js index f87df00..aebc5bb 100644 --- a/tests/RegisterPage.spec.js +++ b/tests/RegisterPage.spec.js @@ -2,362 +2,401 @@ const {test, expect} =require('@playwright/test') import { RegisterPage } from '../pages/RegisterPage'; test.describe('GroupWithCorrectDetails',()=>{ -test('RegisterTest1',async ({page})=>{ +test('RegisterLink Check',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); - console.log('RegisterLink is working'); + await expect(await page.locator("//button[@class='btn btn-primary btn-block']")).toBeVisible(); + //console.log('RegisterLink is working'); }) -test('RegisterTest2',async ({page})=>{ +test('Register page entering with correvt details',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Successfully Registered'); - console.log('Email is registered successfully and mail is sent'); + //console.log('Successfully Registered'); + // console.log('Email is registered successfully and mail is sent'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) }) + + test.describe('TC_Name',()=>{ - test('Name1',async ({page})=>{ + test('Name with empty space is entered',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Name is empty it should get error'); + // console.log('Name is empty it should get error'); await page.close(); }) - test('Name2',async ({page})=>{ + + test('Instead of names, Numbers is entered',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('52658954623', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Number is entered it should get error'); + // console.log('Number is entered it should get error'); await page.close(); }) - test('Name3',async ({page})=>{ + test('50 characters are entered',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('dhjdgabjfbdiuafhdkjbaiughjfkshloadfishjkfglik', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('50 Characters is entered it should get error'); + // console.log('50 Characters is entered it should get error'); await page.close(); }) - test('Name4',async ({page})=>{ + + test('Merchant enters special characters and symbol',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('^%$#%$^&*&', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Special Characters is entered it should get error'); + // console.log('Special Characters is entered it should get error'); await page.close(); }) - test('Name5',async ({page})=>{ + + test('Name with Alphabet',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Mano', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Alphabets are acceptable'); + //console.log('Alphabets are acceptable'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Name6',async ({page})=>{ + test('Name with space',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Mano Aravind', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Names with Space are acceptable'); + //console.log('Names with Space are acceptable'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Name7',async ({page})=>{ + test('Name with special character',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Mano_Aravind', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Names with Special character are acceptable'); + //console.log('Names with Special character are acceptable'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Name8',async ({page})=>{ + test('Names with accented characters',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Ôôerwed', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Names with accented characters are acceptable'); + // console.log('Names with accented characters are acceptable'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) }) test.describe('TC_Email',()=>{ - test('Email1',async ({page})=>{ + test('Email with empty space',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', '','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email is empty it should get error'); + //console.log('Email is empty it should get error'); await page.close(); }) - test('Email2',async ({page})=>{ + + test('Email without @',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaramgmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email without @ symbol it should get error'); + // console.log('Email without @ symbol it should get error'); await page.close(); }) - test('Email3',async ({page})=>{ + + test('Email without domain',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email without domain it should get error'); + // console.log('Email without domain it should get error'); await page.close(); }) - test('Email4',async ({page})=>{ + + test('Invalid email format',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); - await register.register('Micheal Rabi', 'asfg@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Invalid email format it should get error'); + await register.register('Micheal Rabi', ' asfg@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + // console.log('Invalid email format it should get error'); await page.close(); }) - test('Email5',async ({page})=>{ + test('Invalid email domain',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'asfg@asfg.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Invalid email domain it should get error'); + // console.log('Invalid email domain it should get error'); await page.close(); }) - test('Email6',async ({page})=>{ + test('Email with invalid characters',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'user!@.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email with invalid characters it should get error'); + // console.log('Email with invalid characters it should get error'); await page.close(); }) - test('Email7',async ({page})=>{ + test('Email with Excessive length',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); - await register.register('Micheal Rabi', 'userudgjhbdsayiujhgbkujhgvbvkujyhgdsakhgjvkdjf!@.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email with Excessive length it should get error'); + await register.register('Micheal Rabi', 'userudgjhbdsayiujhgbkujhgvbvkujyhgdsakhgjvkdjf!@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + //console.log('Email with Excessive length it should get error'); await page.close(); }) - test('Email8',async ({page})=>{ + test('Email with consecutive dots',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'manoaravcind...com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email with consecutive dots it should get error'); + // console.log('Email with consecutive dots it should get error'); await page.close(); }) - test('Email9',async ({page})=>{ + test('Email with subdomain ',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'example@gmail.example.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email with subdomain is accepted'); + // console.log('Email with subdomain is accepted'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Email10',async ({page})=>{ + test('Email with special character in local part',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email with special character in local part is accepted'); + //console.log('Email with special character in local part is accepted'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Email11',async ({page})=>{ + test('Email with uppercase characters',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Email with uppercase characters is accepted'); + //console.log('Email with uppercase characters is accepted'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - }) test.describe('TC_Phone',()=>{ - test('Phone1',async ({page})=>{ + test('Phone number with 10 characters',async ({page})=>{ + const register = new RegisterPage(page); + await register.gotoRegisterPage(); + await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + // console.log('10 characters is not accepted'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); + await page.close(); + }) + test('Phone number with 10 characters',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','asdfghjklk','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('10 characters is not accepted'); + // console.log('10 characters is not accepted'); await page.close(); }) - test('Phone2',async ({page})=>{ + test('Phone number with Special characters',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','%$%^%^&&*','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Special characters is not accepted'); + // console.log('Special characters is not accepted'); await page.close(); }) - test('Phone3',async ({page})=>{ + test('Phone with Alphabets',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','ASDFGHJK','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Alphabets is not accepted'); + // console.log('Alphabets is not accepted'); await page.close(); }) - test('Phone4',async ({page})=>{ + test('Phone with 11 numbers',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','96005200465','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('11 numbers is not accepted'); + //console.log('11 numbers is not accepted'); await page.close(); }) - test('Phone5',async ({page})=>{ + test('Phone with 9 numbers',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','960052004','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('9 numbers is not accepted'); + //console.log('9 numbers is not accepted'); await page.close(); }) - test('Phone6',async ({page})=>{ + test('Phone with starting with space',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com',' 960052004','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('space at the start of the number is not accepted'); + //console.log('space at the start of the number is not accepted'); await page.close(); }) - test('Phone7',async ({page})=>{ + test('Phone number empty',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com',' ','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('blank number is not accepted'); + //console.log('blank number is not accepted'); await page.close(); }) - test('Phone8',async ({page})=>{ + test('Phone with International number',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','123453678798','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('International number is not accepted'); + //console.log('International number is not accepted'); await page.close(); }) }) test.describe('TC_Address',()=>{ - test('Address1',async ({page})=>{ + test('Empty address',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Empty address is not accepted'); + //console.log('Empty address is not accepted'); await page.close(); }) - test('Address2',async ({page})=>{ + test('Exccesive length address',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Main road thalavai panagudim nindia tamil nadu england ntirunelveli gwhsjdas8iukjgbiu7gk uifygh8idhb','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Exccesive length address is not accepted'); + // console.log('Exccesive length address is not accepted'); await page.close(); }) - test('Address3',async ({page})=>{ + test('Except & all other alphanumeric',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','#$@#^%$#@main road','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Except & all other alphanumeric are not accepted'); + //console.log('Except & all other alphanumeric are not accepted'); await page.close(); }) - test('Address4',async ({page})=>{ + test('Valid Address',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - console.log('Valid address'); + //console.log('Valid address'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) }) test.describe('TC_Company Name',()=>{ - test('CompanyName1',async ({page})=>{ + test('Company name is empty',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', '', 'SweetMart', 'Balurghat'); - console.log('Company name is empty not acceptable'); + //console.log('Company name is empty not acceptable'); await page.close(); }) - test('CompanyName2',async ({page})=>{ + test('Company name with numbers',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic 12345', 'SweetMart', 'Balurghat'); - console.log('Company name with numbers is not acceptable'); + //console.log('Company name with numbers is not acceptable'); await page.close(); }) - test('CompanyName3',async ({page})=>{ + test('Company name with 1000 Alphabets',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'sarhjkfgbdsiugfjksdauygasjbiuadsgbjhsdbauifgadsjhbfuifgj', 'SweetMart', 'Balurghat'); - console.log('Company name with 1000 Alphabets is not acceptable'); + // console.log('Company name with 1000 Alphabets is not acceptable'); await page.close(); }) - test('CompanyName4',async ({page})=>{ + test('Company name with special characters symbols',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic@1234', 'SweetMart', 'Balurghat'); - console.log('Company name with special characters symbols is not acceptable'); + // console.log('Company name with special characters symbols is not acceptable'); await page.close(); }) - test('CompanyName5',async ({page})=>{ + test('Company name with special characters '-' is acceptable',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); - await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'SweetMart', 'Balurghat'); - console.log('Company name with special characters '-' is acceptable'); + await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram - panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'SweetMart', 'Balurghat'); + // console.log('Company name with special characters '-' is acceptable'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) }) test.describe('TC_BusinessType',()=>{ - test('BusinessType1',async ({page})=>{ + test('SweetMart Selection',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'SweetMart', 'Balurghat'); - console.log('Sweetmart is selected'); + // console.log('Sweetmart is selected'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('BusinessType2',async ({page})=>{ + test('Fruitmart Selection',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'FruitMart', 'Balurghat'); - console.log('Fruitmart is selected'); + // console.log('Fruitmart is selected'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('BusinessType3',async ({page})=>{ + test('Bisleri supply selection',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'BisleriSupply', 'Balurghat'); - console.log('BisleriSupply is selected'); + // console.log('BisleriSupply is selected'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('BusinessType4',async ({page})=>{ + test('Others Selection',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - console.log('Others is selected'); + // console.log('Others is selected'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) }) test.describe('TC_Password',()=>{ - test('Password1',async ({page})=>{ + test('minimum 8 length password',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#123456' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - console.log('minimum 8 length password is needed, it shows error'); + // console.log('minimum 8 length password is needed, it shows error'); await page.close(); }) - test('Password2',async ({page})=>{ + test('Password with space',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#123 456' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - console.log('password with space, it shows error'); + // console.log('password with space, it shows error'); + await page.close(); + }) + test('Password entered with 25 characters',async ({page})=>{ + const register = new RegisterPage(page); + await register.gotoRegisterPage(); + await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','dsojarlgpojldm905432kjbnk' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); + // console.log('password with only special character, it shows error'); await page.close(); }) - test('Password3',async ({page})=>{ + test('Password with only special character',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#%^$%^&&**' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - console.log('password with only special character, it shows error'); + //console.log('password with only special character, it shows error'); await page.close(); }) - test('Password4',async ({page})=>{ + test('Password with upper and lower case',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#ADgrdomi' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - console.log('password with upper and lower case is accepted'); - await page.close(); + // console.log('password with upper and lower case is accepted'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); + await page.close(); }) - test('Password5',async ({page})=>{ + test('Too short Password is not accepted',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','1' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - console.log('password is too short,it shows error'); + // console.log('password is too short,it shows error'); await page.close(); }) }) test.describe('TC_City',()=>{ - - test('City1',async ({page})=>{ + test('City Selection',async ({page})=>{ const register = new RegisterPage(page); await register.gotoRegisterPage(); await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#1234567A' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - console.log('City is selected'); + // console.log('City is selected'); + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) -}) \ No newline at end of file +}) + \ No newline at end of file diff --git a/tests/RunnerList.spec.js b/tests/RunnerList.spec.js new file mode 100644 index 0000000..d0575a2 --- /dev/null +++ b/tests/RunnerList.spec.js @@ -0,0 +1,16 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { RunnerListPage } from '../pages/RunnerListPage'; + + + test('RunnerList Button is working?',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const runner = new RunnerListPage(page); + await runner.clickrunnerListButton(); + await page.waitForTimeout(5000); + await expect(await page.locator("//span[@class='flip-indecator']")).toBeVisible(); + //await page.locator("//span[@class='flip-indecator']").waitFor({ state: 'visible' }); + }) \ No newline at end of file diff --git a/tests/UserPage.spec.js b/tests/UserPage.spec.js new file mode 100644 index 0000000..65b4fd7 --- /dev/null +++ b/tests/UserPage.spec.js @@ -0,0 +1,42 @@ +const {test, expect} =require('@playwright/test') +import { LoginPage } from '../pages/LoginPage'; +import { UserPage } from '../pages/UserPage'; + +/* +test('User Button is working',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const user = new UserPage(page); + await user.userPageButton(); + await page.waitForTimeout(5000); + await expect(await page.locator("//span[@class='flip-indecator']")).toBeVisible(); +}) +*/ +test('Active user Button check',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const user = new UserPage(page); + await user.activeUserButtonCheck(); + await page.waitForTimeout(5000); + + + //await expect(await page.locator("//span[@class='flip-indecator']")).toBeVisible(); +}) +/* +test('User Page3',async ({page})=>{ + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const user = new UserPage(page); + await user.activeUserButtonEdit(); + await page.waitForTimeout(5000); + //await expect(await page.locator("//span[@class='flip-indecator']")).toBeVisible(); + +}) + +*/ \ No newline at end of file