From 89e8ac285da815ce381b834e745bee417ff663ec Mon Sep 17 00:00:00 2001 From: Micheal Date: Fri, 27 Dec 2024 16:24:06 +0530 Subject: [PATCH] need to correct Commit --- pages/AddressListAPI.js | 17 - pages/AppConfig.js | 4 +- pages/CatlogPage.js | 16 +- pages/ContentPage.js | 5 +- pages/Couponpage.js | 14 +- pages/Feedback.js | 2 + pages/LoginPage.js | 13 +- pages/NotificationPage.js | 91 +- pages/OrderPage.js | 35 +- pages/ProductPage.js | 80 +- pages/RegisterPage.js | 14 +- pages/RunnerListPage.js | 4 + Biriyani.jpg => pages/TestData/Biriyani.jpg | Bin .../TestData/Chicken Lollipop.jpg | Bin Tandori.jpg => pages/TestData/Tandori.jpg | Bin pages/UserPage.js | 36 +- playwright.config.js | 8 +- tests/APITest.spec.js | 378 +++--- tests/AppConfig.spec.js | 321 +++-- tests/CatlogPage.spec.js | 79 +- tests/ContentPage.spec.js | 54 +- tests/CouponPage.spec.js | 51 +- tests/Feedback.spec.js | 32 +- tests/LoginPage.spec.js | 128 +- tests/NotificationPage.spec.js | 10 +- tests/OrderPage.spec.js | 76 +- tests/ProductPage.spec.js | 1040 ++++++++++------- tests/RegisterPage.spec.js | 621 +++++++--- tests/RunnerList.spec.js | 13 +- tests/UserPage.spec.js | 44 +- 30 files changed, 1819 insertions(+), 1367 deletions(-) delete mode 100644 pages/AddressListAPI.js rename Biriyani.jpg => pages/TestData/Biriyani.jpg (100%) rename Chicken Lollipop.jpg => pages/TestData/Chicken Lollipop.jpg (100%) rename Tandori.jpg => pages/TestData/Tandori.jpg (100%) diff --git a/pages/AddressListAPI.js b/pages/AddressListAPI.js deleted file mode 100644 index 168bd91..0000000 --- a/pages/AddressListAPI.js +++ /dev/null @@ -1,17 +0,0 @@ -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 cf671dc..7d28595 100644 --- a/pages/AppConfig.js +++ b/pages/AppConfig.js @@ -3,6 +3,7 @@ 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 ?']"; @@ -13,7 +14,7 @@ class AppConfig { 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']"; @@ -61,7 +62,6 @@ class AppConfig { await this.page.locator(this.typingText).fill(text); await this.page.waitForTimeout(5000); await this.page.locator(this.movingTypingText).click(); - // await this.page.waitForTimeout(5000); await this.page.locator(this.saveButton).click(); } async toggleButton() diff --git a/pages/CatlogPage.js b/pages/CatlogPage.js index a8b56bd..30dcc68 100644 --- a/pages/CatlogPage.js +++ b/pages/CatlogPage.js @@ -47,17 +47,6 @@ class CatlogPage { - - - - - - - - - - - } async clickCatalogButton(){ await this.page.locator(this.catlogButton).click(); @@ -108,7 +97,6 @@ class CatlogPage { }); let isActive = await this.page.locator(this.islive).isChecked(); - // Productsincluded = await this.page.locator(this.productincluded).textContent(); return{catnames,selecteddcattype,selecctedprodtype,isActive,merchatcode} } @@ -131,7 +119,7 @@ class CatlogPage { return element.options[element.selectedIndex].value; }); let isActive = await this.page.locator(this.islive).isChecked(); - // Productsincluded = await this.page.locator(this.productincluded).textContent(); + return{ catnames,selecteddcattype,selecctedprodtype,isActive,merchatcode} } @@ -153,7 +141,7 @@ class CatlogPage { }); let isActive = await this.page.locator(this.islive).isChecked(); - // Productsincluded = await this.page.locator(this.productincluded).textContent(); + return{ catnames,selecteddcattype,selecctedprodtype,isActive,merchatcode} } diff --git a/pages/ContentPage.js b/pages/ContentPage.js index 903bae2..1b06bec 100644 --- a/pages/ContentPage.js +++ b/pages/ContentPage.js @@ -9,13 +9,16 @@ class ContentPage { 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'); diff --git a/pages/Couponpage.js b/pages/Couponpage.js index 7a214e5..b0283cd 100644 --- a/pages/Couponpage.js +++ b/pages/Couponpage.js @@ -25,22 +25,15 @@ class CouponPage { this.internalCouponValueGuest="//td[normalize-space()='dFkhI6142']"; this.couponCodeGuest="//td[normalize-space()='Christmas30']"; this.forUsersGuest="//tbody/tr[6]/td[5]"; - - - - - - - - } + 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"; @@ -48,7 +41,6 @@ class CouponPage { } async viewCoupon(){ await this.page.locator(this.couponButton).click(); - // await page.waitForTimeout(5000); await this.page.locator(this.viewCouponButton).click(); } diff --git a/pages/Feedback.js b/pages/Feedback.js index 398bf62..cc31e12 100644 --- a/pages/Feedback.js +++ b/pages/Feedback.js @@ -13,6 +13,8 @@ class Feedback { this.phone="//td[normalize-space()='919480111111']"; } + + async clickFeedbackButton(){ await this.page.locator(this.feedbackButton).click(); } diff --git a/pages/LoginPage.js b/pages/LoginPage.js index 33a9c41..1f1a059 100644 --- a/pages/LoginPage.js +++ b/pages/LoginPage.js @@ -15,7 +15,6 @@ class LoginPage { } async login(username, password){ - await this.page.locator(this.usernameInput).fill(username); await this.page.locator(this.passwordInput).fill(password); await this.page.locator(this.signinButton).click(); @@ -26,13 +25,19 @@ class LoginPage { async loginWithCrtPassword(){ 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(); } + async OpenOBA(){ + + await this.page.goto('https://dev.orderbookings.com/'); + await this.page.fill(this.usernameInput,'xpcv2@rustyload.com'); + await this.page.locator(this.passwordInput).fill('7777777777'); + await this.page.locator(this.signinButton).click(); + + } + async forgetPasswordLink(){ await this.page.locator(this.forgotPassword).click(); diff --git a/pages/NotificationPage.js b/pages/NotificationPage.js index e444fb2..ad4d680 100644 --- a/pages/NotificationPage.js +++ b/pages/NotificationPage.js @@ -2,43 +2,6 @@ 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(); - } - } -} - */ - constructor(page) { @@ -73,13 +36,6 @@ constructor(page) this.chooseFile ="//input[@id='notificationimage']"; - //Whole Notification Check - - - - - - } @@ -87,8 +43,7 @@ constructor(page) - - +//Check notification page async notificationPageCheck(){ await this.page.locator(this.notificationButtonCheck).click(); @@ -122,7 +77,7 @@ async wholeNotificationSetting(SelectType,TitleName,UserName,TextArea,year,month await this.page.locator( this.content).fill(TextArea); - // await this.page.locator(this.NotifyButton).click(); + await this.page.locator(this.calendar).click(); // Wait for year selection while (true) @@ -231,38 +186,6 @@ async setTime(Hour, Min) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //send notification based on the area async NotifyMewithArea(SelectType,TitleName,Area,TextArea){ await this.page.locator(this.NotifyButton).click(); @@ -419,15 +342,7 @@ async scheduleNotification (){ } if (!dayFound) throw new Error('Day selection failed.'); - // File Upload - // await this.page.locator(this.chooseFile).setInputFiles(filePath); - // console.log('Attached file:', filePath); - // Set Time - // await this.page.locator(this.hours).selectOption(Hour); - //console.log('Selected Hour:', Hour); - // await this.page.locator(this.mins).selectOption(Min); - // console.log('Selected Minute:', Min); // Schedule Notification await this.page.locator(this.scheduleNotificationButton).waitFor({ state: 'visible' }); @@ -442,6 +357,7 @@ async scheduleNotification (){ } } +//set file async selectFile(filePath) { try { await this.page.locator(this.NotifyButton).click(); @@ -452,6 +368,7 @@ async selectFile(filePath) { } } +//set time async setTime(Hour, Min) { try { await this.page.locator(this.hours).selectOption(Hour); diff --git a/pages/OrderPage.js b/pages/OrderPage.js index 5420ef1..95b6e9f 100644 --- a/pages/OrderPage.js +++ b/pages/OrderPage.js @@ -48,49 +48,47 @@ this.orderIdCancel="//div[normalize-space()='order_id : 670e240e14f563f755f3e2a4 this.orderRate="//tbody/tr[3]/td[8]"; - - - - - - - - } + + //Click Order button async clickOrdersButton(){ await this.page.locator(this.ordersButton).click(); } + + //Click order list button async clickOrdersListButton(){ await this.page.locator(this.ordersButton).click(); - //await page.waitForTimeout(5000); await this.page.locator(this.ordersListButton).click(); } + + //Check order status async orderStatusCheck(orderStatus){ await this.page.locator(this.ordersButton).click(); - //await page.waitForTimeout(5000); await this.page.locator(this.ordersListButton).click(); await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); - // await page.waitForTimeout(5000); + } + + + //Check filter button async checkFilterButton(orderStatus){ await this.page.locator(this.ordersButton).click(); - //await page.waitForTimeout(5000); await this.page.locator(this.ordersListButton).click(); await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); - // await page.waitForTimeout(5000); await this.page.locator(this.filterButton).click(); } + + //Search text async textBoxSearch(orderStatus, textBox){ await this.page.locator(this.ordersButton).click(); - //await page.waitForTimeout(5000); await this.page.locator(this.ordersListButton).click(); await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); - // await page.waitForTimeout(5000); await this.page.locator(this.textBox).fill(textBox); await this.page.locator(this.filterButton).click(); } + //search order async searchOrder(orderStatus,username){ await this.page.locator(this.OrderStatus).selectOption(orderStatus); // add order status await this.page.locator(this.usernameTextbox).fill(username); // add user name @@ -104,15 +102,12 @@ this.orderIdCancel="//div[normalize-space()='order_id : 670e240e14f563f755f3e2a4 const Order_latestupdate =await this.page.locator(this.orderlatestUpdate).textContent(); //get oder latest update var Order_qty =await this.page.locator(this.Order_qty).textContent(); // get order quanity return {OrderId,OrderStatusis,Order_cost,Order_items,Order_price,Order_payment,Order_latestupdate,Order_qty} - // returning all those values. + + } - - - - } diff --git a/pages/ProductPage.js b/pages/ProductPage.js index f1be603..f76f375 100644 --- a/pages/ProductPage.js +++ b/pages/ProductPage.js @@ -3,6 +3,9 @@ class ProductPage { constructor(page) { this.page = page; + + //Locators for Product Page + this.productsButton = "//span[normalize-space()='Products']"; this.productListButton= "//a[normalize-space()='Product List']"; this.addProductButton="//a[normalize-space()='Add Product']"; @@ -21,42 +24,48 @@ class ProductPage { this.uploadImage="#oba_product_input_display"; this.productlistSearchBox="//input[@id='oba_product_search']"; this.searchBox="//i[@class='fa fa-lg fa-fw fa-search']"; + this.editButton="//i[@class='fa fa-lg fa-edit']"; + this.edittButton="//a[@class='btn btn-primary']"; this.saveButton="//button[@class='btn btn-primary btn-block']"; this.deleteButton="//i[@class='fa fa-lg fa-trash']"; this.searchProduct="//input[@id='oba_product_search']"; this.searchButton="//button[@id='oba_product_search_btn']"; + //API Validation - - //API this.nameAPI="//td[normalize-space()='T-Shirt']"; this.priceAPI="//b[normalize-space()='200']"; this.quantityAPI="//td[normalize-space()='79971']"; this.availableAPI="//td[normalize-space()='true']"; this.orderlimitAPI="//td[normalize-space()='100']"; - - - - - - - + //Delete the Product from product list after assertion + this.editButtonAssertion="//tbody/tr[2]/td[7]/div[1]/a[1]"; + this.deleteButtonAssertion="(//a[@class='btn btn-primary'])[2]"; + this.deleteitAssertion="//button[@class='swal2-confirm swal2-styled']"; } + // Check Product button async clickProductsButton(){ await this.page.locator(this.productsButton).click(); } + + + //Check ProductListButton async clickProductlistButton(){ await this.page.locator(this.productsButton).click(); await this.page.locator(this.productListButton).click(); } + + //Check Add Product Button async clickAddProductButton(){ await this.page.locator(this.productsButton).click(); await this.page.locator(this.addProductButton).click(); } + + //Complete Add Product Functionality async addProductFunctionality(productName, productPrize, productQuantity, orderLimitvalue, taxin, shortDescription){ await this.page.locator(this.productsButton).click(); @@ -77,9 +86,14 @@ 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.uploadImage).setInputFiles("./pages/TestData/Biriyani.jpg"); await this.page.locator(this.saveButton).click(); } + + + + // Add Product functionality and delete it + async addProductFunctionalityDelete(productName, productPrize, productQuantity, orderLimitvalue, taxin, shortDescription){ await this.page.locator(this.productsButton).click(); @@ -96,13 +110,16 @@ 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('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.uploadImage).setInputFiles("./pages/TestData/Biriyani.jpg"); await this.page.locator(this.deleteButton).click(); } + + + async addProductFunctionalityForAll(productName, productPrize, productQuantity, orderLimitvalue, taxin, shortDescription){ await this.page.locator(this.productsButton).click(); @@ -121,9 +138,6 @@ class ProductPage { 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(); } @@ -135,8 +149,6 @@ class ProductPage { await this.page.locator(this.unmanagedRadioButton).check(); await this.page.locator(this.orderLimit).fill(orderLimitvalue); await this.page.locator(this.taxIn).fill(taxin); - await this.page.locator(this.productAvailableCheck).check(); - await this.page.locator(this.isLiveCheck).check(); await this.page.locator(this.shortDescription).fill(shortDescription); await this.page.waitForSelector('.CodeMirror'); await this.page.evaluate(() => { @@ -145,7 +157,7 @@ class ProductPage { }); await this.page.locator(this.productImage).click(); - await this.page.locator(this.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Tandori.jpg"); + await this.page.locator(this.uploadImage).setInputFiles("./pages/TestData/Tandori.jpg"); await this.page.locator(this.saveButton).click(); } @@ -165,14 +177,15 @@ class ProductPage { await this.page.waitForSelector('.CodeMirror'); await this.page.evaluate(() => { const codeMirrorElement = document.querySelector('.CodeMirror'); - codeMirrorElement.CodeMirror.setValue('Chicken Lollipop'); + 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/Chicken Lollipop.jpg"); + await this.page.locator(this.uploadImage).setInputFiles("./pages/TestData/Chicken Lollipop.jpg"); await this.page.locator(this.saveButton).click(); } + //Working of Search Product Button async searchProductName(productName){ await this.page.locator(this.productsButton).click(); await this.page.locator(this.productListButton).click(); @@ -180,30 +193,25 @@ class ProductPage { await this.page.locator(this.searchButton).click(); } + //Working of Edit Button 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.edittButton).click(); await this.page.locator(this.productAvailableCheck).click(); await this.page.locator(this.saveButton).click(); } + //delete product after storing + async deleteProduct(){ + //Delete the Product from product list after assertion + await this.page.locator(this.editButtonAssertion).click(); + await this.page.locator(this.deleteButtonAssertion).click(); + await this.page.waitForTimeout(5000); + await this.page.locator(this.deleteitAssertion).click(); + await this.page.close(); - - - - - - - - - - - - - - - + } } \ No newline at end of file diff --git a/pages/RegisterPage.js b/pages/RegisterPage.js index 6a6f8b8..9cef103 100644 --- a/pages/RegisterPage.js +++ b/pages/RegisterPage.js @@ -2,6 +2,7 @@ exports.RegisterPage = class RegisterPage { constructor(page) { this.page =page; + this.registerHereLink="//a[normalize-space()='Register Here ?']"; this.name="//input[@id='oba_signup_username']"; this.email="//input[@id='oba_signup_emailid']"; @@ -15,12 +16,15 @@ exports.RegisterPage = class RegisterPage { this.signupButton=" //button[normalize-space()='SIGN UP']"; this.alreadysignupLink="//a[normalize-space()='Already Sign Up ?']"; } + + //Navigate to Register Page async gotoRegisterPage(){ await this.page.goto('https://dev.orderbookings.com/login/'); await this.page.locator(this.registerHereLink).click(); } + //Check Alreagy sign up working? async alreadySignUpCheck(){ await this.page.goto('https://dev.orderbookings.com/login/'); await this.page.locator(this.registerHereLink).click(); @@ -30,27 +34,21 @@ exports.RegisterPage = class RegisterPage { - + //Complete functionality to register async register(name, email, phoneNumber, address, password,phoneCode, companyName, businessType, city){ await this.page.locator(this.name).fill(name); await this.page.locator(this.email).fill(email); await this.page.locator(this.phoneCode).selectOption({label:phoneCode}); - //await page.waitForTimeout(5000); await this.page.locator(this.phoneNumber).fill(phoneNumber); await this.page.locator(this.address).fill(address); await this.page.locator(this.companyName).fill(companyName); await this.page.locator(this.businessType).selectOption({label:businessType}); - //await page.waitForTimeout(5000); await this.page.locator(this.city).selectOption({label:city}); - //await page.waitForTimeout(5000); await this.page.locator(this.password).fill(password); await this.page.locator(this.signupButton).click(); - //await page.waitForTimeout(5000); - // console.log('Successfully Registered'); - // console.log('Email is registered successfully and mail is sent'); - // await page.close(); + } diff --git a/pages/RunnerListPage.js b/pages/RunnerListPage.js index 8345e2e..15ea07c 100644 --- a/pages/RunnerListPage.js +++ b/pages/RunnerListPage.js @@ -3,12 +3,16 @@ class RunnerListPage { constructor(page) { this.page = page; + + //LOcators for runner list 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']"; } + + //Runnerlist Button working? async clickrunnerListButton(){ await this.page.locator(this.runnerListButton).click(); } diff --git a/Biriyani.jpg b/pages/TestData/Biriyani.jpg similarity index 100% rename from Biriyani.jpg rename to pages/TestData/Biriyani.jpg diff --git a/Chicken Lollipop.jpg b/pages/TestData/Chicken Lollipop.jpg similarity index 100% rename from Chicken Lollipop.jpg rename to pages/TestData/Chicken Lollipop.jpg diff --git a/Tandori.jpg b/pages/TestData/Tandori.jpg similarity index 100% rename from Tandori.jpg rename to pages/TestData/Tandori.jpg diff --git a/pages/UserPage.js b/pages/UserPage.js index e5f866e..985d0b2 100644 --- a/pages/UserPage.js +++ b/pages/UserPage.js @@ -5,7 +5,9 @@ class UserPage { this.page = page; this.Users = "//span[normalize-space()='Users']"; this.activeUserButton = "//span[@class='flip-indecator']"; + this.searchUser="//input[@id='oba_user_search']"; this.enableButton = "//button[@id='66eaa9656b2f4a3d52a42549']"; + this.filterButton="//button[@id='oba_user_search_btn']"; //AssertionForAPI this.userNameAPI="//td[normalize-space()='DAYA']"; @@ -16,49 +18,47 @@ class UserPage { //Assertion for address this.addressList="//td[normalize-space()='35, Mount Main Road , Tamil Nadu, 123111']"; - - this.addressPatch="//td[normalize-space()='35, Mount Kitchen Main Road, Tamil Nadu, 123111']"; - - - - - } + //UserPage Button Validation async userPageButton(){ await this.page.locator(this.Users).click(); } + + + //Validate active user button Check 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); } + + //Validate SearchUserValidation + async searchUserValidation(user){ + await this.page.locator(this.Users).click(); + await this.page.locator(this.searchUser).fill(user); + await this.page.locator(this.filterButton).click(); + } + + + //Edit the active user Button async activeUserButtonEdit(){ await this.page.locator(this.Users).click(); await this.page.locator(this.activeUserButton).click(); await this.page.locator(this.enableButton).click(); - - } + //Navigate to user page in API for user details async userAPI(){ await this.page.locator(this.Users).click(); } + //Navigate to user page in API for address async addressListAPI(){ await this.page.locator(this.Users).click(); } - - - - - - - } \ No newline at end of file diff --git a/playwright.config.js b/playwright.config.js index c3fc2d8..4cea8d0 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -38,10 +38,10 @@ module.exports = defineConfig({ use: { ...devices['Desktop Chrome'] }, }, - { - name: 'firefox', - use: { ...devices['Desktop Firefox'] }, - }, + // { + // name: 'firefox', + // use: { ...devices['Desktop Firefox'] }, + // }, //{ // name: 'webkit', diff --git a/tests/APITest.spec.js b/tests/APITest.spec.js index df85b6a..d4f7d2b 100644 --- a/tests/APITest.spec.js +++ b/tests/APITest.spec.js @@ -7,70 +7,66 @@ import { UserPage } from '../pages/UserPage'; import { CatlogPage } from '../pages/CatlogPage'; import { ProductPage } from '../pages/ProductPage'; +//dont put commented code in repo +//its better to give discription for the steps you are following in comments +//add the ids of manual testcases in test.describe also suggest if the testcase is from regression suit or not and add tags respectively -/*----------------------------------------OrderID Complete Check-------------------------------------------*/ +const baseURL="https://dev.orderbookings.com/api"; -test('Get Orders-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')//base uri should maintan separately - console.log(await response.json()) - //expect(response.status()).toBe(200) //dont put commented code in repo - // const text = await response.text(); //its better to give discription for the steps you are following in comments - // expect(text).toContain('Manju') //add the ids of manual testcases in test.describe also suggest if the testcase is from regression suit or not and add tags respectively - const res = await response.json(); +// Validate Orders by UserID(In regression suite) +test('TC_API_01: Validate Get Orders API by User ID)',async ({request,page})=>{ + + + // Get Request and store response + const response = await request.get(baseURL+'/order/syncOrders?user_id=670766e4272db54e96e423e0&phone=919480111222&lastupdatetime=0&merchantCode=919480707707&role=ROLE_TYPE_MERCHANT'); + const res = await response.json(); + + // Navigate to login page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + + await page.waitForTimeout(5000); + + // Navigate to order page and search + 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()); + await order.textBoxSearch('ORDER_STATUS_COMPLETE', 'Shubya'); + + + //Assertions + 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()); }) -/*---------------------------------------------App Config----------------------------------------------------*/ +//Validate App Config Page (In regression suite) +test('TC-API-11: complete AppConfig page to check API',async ({page,request})=>{ -test('complete AppConfig page to check API',async ({page,request})=>{ + // Navigate to login page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + // Navigate to App Config Page 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()) + //get request and response + const response = await request.get(baseURL+'/config/919480707707?merchantCode=919480707707'); const res = await response.json(); - //await page.close(); - - //await login.gotoLoginPage(); - // await login.loginWithCrtPassword(); - - // await config.openAppConf(); - + //Assertions 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).toString(); - - //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()); @@ -80,107 +76,115 @@ test('complete AppConfig page to check API',async ({page,request})=>{ 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).toString()); - }) -/*----------------------------------------------Coupon---------------------------------------------------*/ -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()) - +//Validate API Testing to get coupon details as user(In Regression Suite) +test('TC_API_16: APITesting_Coupon Get Details as User',async ({request,page})=>{ + + + //Get request and response + const response = await request.get(baseURL+'/available-coupon/670e14cf14f563f755f3e2a1/919480707707'); const res = await response.json(); + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to coupon page const coupon = new CouponPage(page); await coupon.viewCoupon(); + + //Assertions expect.soft(coupon.shortDescription).toContain(res.data[1].name); expect.soft(coupon.descriptionCheck).toContain(res.data[1].description); expect.soft(coupon.internalCouponValue).toContain(res.data[1].code); expect.soft(coupon.couponCode).toContain(res.data[1].campaign_code); - // expect.soft(coupon.forUsers).toContain(res.data[0].for); }) +//Validate Coupon details as Guest(In Regression Suite) +test('TC_API_16: APITesting_Coupon Get Details as Guest',async ({request,page})=>{ -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()) + //get request and response + const response = await request.get(baseURL+'/available-coupon-guest/919480707707'); const res = await response.json(); + + //Navigate to login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to coupon page const coupon = new CouponPage(page); await coupon.viewCoupon(); + + //Assertions 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); }) -/*----------------------------------------------OrderId Pending---------------------------------------------*/ -//get order by order id and compare with web ui in the order list. -test('GET ORDER BY ORDER_ID',async ({request,page})=>{ +//get order by order id and compare with web ui in the order list.(In Regression Suite) +test('TC_API_06: GET ORDER BY ORDER_ID',async ({request,page})=>{ + + //Get request and response + const response1 = await request.get(baseURL+'/order/getorder/670e249314f563f755f3e2a5'); + const res = await response1.json(); + + //Navigate to Login Page + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); - - const response1 = await request.get('https://dev.orderbookings.com/api/order/getorder/670e249314f563f755f3e2a5') - - console.log(await response1.json()) - - const res = await response1.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_PENDING', 'DAYA'); + //Navigate to order page + const order = new OrderPage(page); + await order.textBoxSearch('ORDER_STATUS_PENDING', 'DAYA'); + //Assertions expect.soft(order.userid).toContain(res.data.id); //id expect.soft(order.username).toContain(res.data.ordered_by_name); //name expect.soft(order.useremail).toContain(res.data.ordered_by_email); //email expect.soft(order.userphone).toContain(res.data.ordered_by_phone); //phone - // expect.soft(order.userorderitems).toContain((res.data.ordered_items[0]).toString()); //order items + const element = await page.locator(order.userorderitems); const text = await element.textContent(); - expect(text).toContain(res.data.ordered_items[0]); - // expect.soft(order.ordercost).toContain((res.data.order_cost).toString()); //order cost is different 604 vs 654 + expect(text).toContain(res.data.ordered_items[0]); //order items + expect.soft(order.orderqty).toContain((res.data.ordered_items_qty[0]).toString()); // order qty - //expect.soft(order.userorderstatus).toContain(res.data.order_status); // order status is complete + await page.close(); }) - /*---------------------------------------------------------User Details----------------------------------*/ - - -//get order by order id and compare with web ui in the order list. -test('GET USER Details',async ({request,page})=>{ - - - - const response2 = await request.get('https://dev.orderbookings.com/api/user/userreg?phone=919480111111&merchantCode=919480707707') - - console.log(await response2.json()) +//get order by order id and compare with web ui in the order list.(In Regression Suite) +test('TC_API_10: GET USER Details',async ({request,page})=>{ + //Get request and response + const response2 = await request.get(baseURL+'/user/userreg?phone=919480111111&merchantCode=919480707707'); const res = await response2.json(); + //Navigate to login page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); await page.waitForTimeout(5000); + //Navigate to user page const user = new UserPage(page); await user.userAPI(); + //Assertions expect.soft(user.userNameAPI).toContain(res.data.name); expect.soft(user.userPhoneAPI).toContain(res.data.phone); expect.soft(user.userEmailAPI).toContain(res.data.email); @@ -188,35 +192,30 @@ test('GET USER Details',async ({request,page})=>{ expect.soft(user.addressAPI).toContain(res.data.area[0]); expect.soft(user.addressAPI).toContain(res.data.area[1]); expect.soft(user.addressAPI).toContain(res.data.area[2]); - await page.close(); }) - - - -/*--------------------------------------------------------------Get Categories and Products-----------------------------------------------*/ - - test('Get Categories and products',async ({page,request})=>{ +//Validate Categories(In Regression Suite) +test('TC-API-12: Get Categories and products',async ({page,request})=>{ - //Main Page Element locating - const response = await request.get('https://dev.orderbookings.com/api/bud/919480707707') - - console.log(await response.json()) - + //Get request and response + const response = await request.get(baseURL+'/bud/919480707707'); const res = await response.json(); + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); await page.waitForTimeout(5000); + //Navigate to categories Page const catlog = new CatlogPage(page); await catlog.clickCatalogButton(); + //Assertions const obaBudView = page.locator('//select[@id="oba_bud_view"]'); const obaProductView = page.locator('//select[@id="oba_product_view"]'); @@ -226,17 +225,19 @@ test('GET USER Details',async ({request,page})=>{ expect.soft(budValue).toContain(res.data.buds[0].childview); expect.soft(productValue).toContain(res.data.buds[0].product_childview); - // Mens Page + // Mens Page + //Navigate to Login Page await login.gotoLoginPage(); await login.loginWithCrtPassword(); await page.waitForTimeout(5000); + //Navigate to Catlog Page await catlog.clickCatalogButton(); let Category1 = await catlog.NavigateToMens(); - + //Initialize values let Name1 = await Category1.catnames; let catlogViewType1 = await Category1.selecteddcattype; let Productviewtype1 = await Category1.selecctedprodtype; @@ -253,6 +254,7 @@ test('GET USER Details',async ({request,page})=>{ var cat3 = res.data.buds[3].name; //kids + //Assertions expect.soft(Name1).toEqual(cat1); expect.soft(merchantid).toEqual(merchantcode) expect.soft(catlogViewType1).toEqual(catlog1ViewType1); @@ -260,7 +262,8 @@ test('GET USER Details',async ({request,page})=>{ expect.soft(Catislive1).toEqual(cat1islive); - // Womens Page + // Womens Page + //Initialize values let Category2 = await catlog.NavigateToWomens(); @@ -268,20 +271,21 @@ test('GET USER Details',async ({request,page})=>{ const catlogViewType2 = await Category2.selecteddcattype; const Productviewtype2 = await Category2.selecctedprodtype; const Catislive2 = Category2.isActive; - console.log('For Womens' +Catislive2); - // const Catproducts2 = await Category2.Productsincluded; + + let cat2logViewType =res.data.buds[2].childview; let cat2Productviewtype =res.data.buds[2].product_childview; let cat2islive = res.data.buds[2].is_live; let merchantcode2 =res.data.buds[2].merchantCode; + //Assertions expect.soft(Name2).toEqual(cat2); expect.soft(merchantid).toEqual(merchantcode2) expect.soft(catlogViewType2).toEqual(cat2logViewType); expect.soft(Productviewtype2).toEqual(cat2Productviewtype); expect.soft(Catislive2).toEqual(cat2islive); - // expect.soft(Catproducts2).toEqual(res.data.buds[2].products); + //this cat3 is kids let Category3 = await catlog.NavigateToKids(); @@ -289,47 +293,49 @@ test('GET USER Details',async ({request,page})=>{ const catlogViewType3 = await Category3.selecteddcattype; const Productviewtype3 = await Category3.selecctedprodtype; const Catislive3 = Category3.isActive; - console.log('for kids:' +Catislive3); - //const Catproducts3 = await Category3.Productsincluded; + + - //api request response are in object so we need save in the letibale to compare. + let cat3ogViewType =res.data.buds[3].childview; let cat3Productviewtype =res.data.buds[3].product_childview; let cat3islive = res.data.buds[3].is_live; let merchantcode3 =res.data.buds[3].merchantCode; + //Assertions expect.soft(Name3).toEqual(cat3); expect.soft(merchantid).toEqual(merchantcode3); expect.soft(catlogViewType3).toEqual(cat3ogViewType); expect.soft(Productviewtype3).toEqual(cat3Productviewtype); expect.soft(Catislive3).toEqual(cat3islive); - }) +//Get products(In regression suite) +test('TC-API-12: Get Products',async ({request,page})=>{ -test('Get Products',async ({request,page})=>{ - - const response = await request.get('https://dev.orderbookings.com/api/bud/919480707707') - console.log(await response.json()) + //Get request and response + const response = await request.get(baseURL+'/bud/919480707707'); const res = await response.json(); + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); await page.waitForTimeout(5000); + //Navigate to product page const product = new ProductPage(page); await product.clickProductlistButton(); + //Assertions const productName = await page.textContent("//td[normalize-space()='T-Shirt']"); expect.soft(productName.trim()).toContain(res.data.products[0].name.trim()); - // expect.soft(product.nameAPI).toContain(res.data.products[0].name); expect.soft(product.priceAPI).toContain((res.data.products[0].price).toString()); expect.soft(product.quantityAPI).toContain((res.data.products[0].quantity).toString()); @@ -343,9 +349,8 @@ test('Get Products',async ({request,page})=>{ }) -/*---------------------------------------------------Address API-----------------------------------------------------------------------------------------------------*/ - -test('Complete Address API',async({page,request})=>{ +//Complete address list process(In regression suite) +test('TC_API-02,03,01,17: Complete Address API',async({page,request})=>{ let resourceId; @@ -353,7 +358,7 @@ test('Complete Address API',async({page,request})=>{ // 1. Post Response - const postResponse = await request.post('https://dev.orderbookings.com/api/user/addnewaddress',{ + const postResponse = await request.post(baseURL+'/user/addnewaddress',{ data: { "addressLine1": "35", "addressLine2": "Mount Main Road ", @@ -370,19 +375,22 @@ test('Complete Address API',async({page,request})=>{ }); + + //Navigate to login const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); await page.waitForTimeout(5000); + //Navigate to user const user = new UserPage(page); await user.addressListAPI(); - expect(postResponse.status()).toBe(200); // HTTP 200 indicates a successful creation - const postResponseBody = await postResponse.json(); // Parse the response body - console.log(postResponseBody); + expect(postResponse.status()).toBe(200); + const postResponseBody = await postResponse.json(); + // Validate response body expect(postResponseBody.data).toHaveProperty('id'); // Assuming the API returns an `id` for the new resource @@ -394,31 +402,32 @@ test('Complete Address API',async({page,request})=>{ expect.soft(user.addressList).toContain(postResponseBody.data.stateOrProvince); expect.soft(user.addressList).toContain((postResponseBody.data.postalCode).toString()); - // 2. Get address list +//2. Get address list - const getResponse = await request.get('https://dev.orderbookings.com/api/user/addresslist?user_id=670e14cf14f563f755f3e2a1') - - console.log(await getResponse.json()) - + + + const getResponse = await request.get(baseURL+'/user/addresslist?user_id=670e14cf14f563f755f3e2a1'); const getResponseBody = await getResponse.json(); + //Navigate to Login Page await login.gotoLoginPage(); await login.loginWithCrtPassword(); await page.waitForTimeout(5000); + //Navigate to User Page await user.addressListAPI(); - + //Assertions expect.soft(user.addressList).toContain(getResponseBody.data[1].addressLine1); expect.soft(user.addressList).toContain(getResponseBody.data[1].addressLine2); expect.soft(user.addressList).toContain(getResponseBody.data[1].stateOrProvince); expect.soft(user.addressList).toContain((getResponseBody.data[1].postalCode).toString()); - //3.Patch Request +//3.Patch Request - const patchResponse = await request.patch('https://dev.orderbookings.com/api/user/updateaddress',{ + const patchResponse = await request.patch(baseURL+'/user/updateaddress',{ data: { "addressLine1": "35", @@ -436,16 +445,18 @@ test('Complete Address API',async({page,request})=>{ }, }); -console.log(await patchResponse.json()) + const patchResponseBody = await patchResponse.json(); +//Navigate to Login Page await login.gotoLoginPage(); await login.loginWithCrtPassword(); + //Navigate to user page await user.addressListAPI(); - +//Assertions expect.soft(user.addressPatch).toContain(patchResponseBody.data.addressLine1); expect.soft(user.addressPatch).toContain(patchResponseBody.data.addressLine2); expect.soft(user.addressPatch).toContain(patchResponseBody.data.stateOrProvince); @@ -453,7 +464,7 @@ const patchResponseBody = await patchResponse.json(); // 4. Delete Request - const deleteResponse = await request.delete('https://dev.orderbookings.com/api/user/deleteaddress', { + const deleteResponse = await request.delete(baseURL+'/user/deleteaddress', { data:{ "user_id": "670e14cf14f563f755f3e2a1", "address_id": resourceId, @@ -462,18 +473,18 @@ const patchResponseBody = await patchResponse.json(); // Validate DELETE response expect(deleteResponse.status()).toBe(200); // Typically, HTTP 200 or 204 is expected for successful deletions - const deleteResponseBody = await deleteResponse.text(); // Some APIs may not return JSON for DELETE - console.log('DELETE response:', deleteResponseBody); + const deleteResponseBody = await deleteResponse.text(); + }) -test('Post and Delete Address API',async({page,request})=>{ +test('TC-API-03,17: Post and Delete Address API',async({request})=>{ // 1. Post Response - const postResponse = await request.post('https://dev.orderbookings.com/api/user/addnewaddress',{ + const postResponse = await request.post(baseURL+'/user/addnewaddress',{ data: { "addressLine1": "52", "addressLine2": "25", @@ -490,9 +501,9 @@ test('Post and Delete Address API',async({page,request})=>{ }); - expect(postResponse.status()).toBe(200); // HTTP 201 indicates a successful creation + expect(postResponse.status()).toBe(200); const postResponseBody = await postResponse.json(); // Parse the response body - console.log(postResponseBody); + // Validate response body expect(postResponseBody.data).toHaveProperty('id'); // Assuming the API returns an `id` for the new resource @@ -501,7 +512,7 @@ test('Post and Delete Address API',async({page,request})=>{ // 2. Delete Request - const deleteResponse = await request.delete('https://dev.orderbookings.com/api/user/deleteaddress', { + const deleteResponse = await request.delete(baseURL+'/user/deleteaddress', { data:{ "user_id": "670e14cf14f563f755f3e2a1", "address_id": resourceId, @@ -509,98 +520,11 @@ test('Post and Delete Address API',async({page,request})=>{ }); // Validate DELETE response - expect(deleteResponse.status()).toBe(200); // Typically, HTTP 200 or 204 is expected for successful deletions - const deleteResponseBody = await deleteResponse.text(); // Some APIs may not return JSON for DELETE - console.log('DELETE response:', deleteResponseBody); + expect(deleteResponse.status()).toBe(200); + const deleteResponseBody = await deleteResponse.text(); + }) /*--------------------------------------------------------------------------------------------------------------------*/ //Order Page cannot be automated, since the API datas are missing, as it is continued from place order, products are missing -/* -test('Cancel Order API',async({page,request})=>{ - - - const postResponse = await request.post('https://dev.orderbookings.com/api/order/cancelorder',{ - "order_id":"670e240e14f563f755f3e2a4" - - }); - - - // const login = new LoginPage(page); - // await login.gotoLoginPage(); - // await login.loginWithCrtPassword(); - - // await page.waitForTimeout(5000); - - // const order = new OrderPage(page); - // await order.checkFilterButton('ORDER_STATUS_CANCELLED'); - - - - expect(postResponse.status()).toBe(200); // HTTP 201 indicates a successful creation - const postResponseBody = await postResponse.json(); // Parse the response body - // expect.soft(user.orderIdCancel).toContain(postResponseBody.order_id); - - console.log(postResponseBody); - - -}) - - - -test('Post Rate Order Address API',async({page,request})=>{ - - //place an order - - - - - - - - - - //Complete an order - - - - -// Post Response - - - const postResponse = await request.post('https://dev.orderbookings.com/api/order/rateOrder',{ - data: { - "order_id": "67076b44272db54e96e423eb", - "rating":4, - "fcm_token":"kjdfhkdbshigkmadniuaghkk" - }, -}); - - - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - - await page.waitForTimeout(5000); - - const order = new OrderPage(page); - await order.checkFilterButton('ORDER_STATUS_COMPLETE'); - - expect(postResponse.status()).toBe(200); // HTTP 201 indicates a successful creation - const postResponseBody = await postResponse.json(); // Parse the response body - console.log(postResponseBody); - - expect.soft(order.orderID).toContain(postResponseBody.order_id); //id - expect.soft(order.orderRate).toContain(postResponseBody.rating); //name - - await page.close(); - - - - - - -}) - -*/ \ No newline at end of file diff --git a/tests/AppConfig.spec.js b/tests/AppConfig.spec.js index 4494aec..35012fb 100644 --- a/tests/AppConfig.spec.js +++ b/tests/AppConfig.spec.js @@ -2,102 +2,68 @@ const {test, expect} =require('@playwright/test') import { LoginPage } from '../pages/LoginPage'; import { AppConfig } from '../pages/AppConfig'; - -test('AppConfig button is working or not',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); - const config = new AppConfig(page); - await config.openAppConf(); - await page.waitForTimeout(3000) - await expect(await page.locator(config.notificationSoundLoop)).toBeVisible(); -}) +test.beforeEach(async ({ page }) => { + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); +}); -test.skip('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'); +//Merchant Verify that the selected currency symbol is displayed correctly(In Regression Suite) +test('TC-AC-02: Select as Indonesian rupiah (Rp)', async ({page}) =>{ - await page.close(); + //Navigate to App Config Page + const config = new AppConfig(page); + await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); + + //Assertions + const locator = page.locator("//select[@id='oba_appconfig_select_currency']"); + await expect(locator).toContainText('Indonesian rupiah (Rp)'); + await page.waitForTimeout(1000); + 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(); +//(In Regression Suite) +test('TC-AC-03: AppConfig button is working or not',async ({page})=>{ + //Navigate to Login Page + const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); - 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); - -}) + await page.waitForTimeout(5000); + //Navigate to App Config Oage + const config = new AppConfig(page); + await config.openAppConf(); -/*-------------------------------------------------Currency Check-----------------------------------*/ + await page.waitForTimeout(3000) - //Merchant Verify that the selected currency symbol is displayed correctly - test('Select as Indonesian rupiah (Rp)', async ({page}) =>{ + //Assertions + await expect(await page.locator(config.notificationSoundLoop)).toBeVisible(); +}) - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - const config = new AppConfig(page); - await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - const locator = page.locator("//select[@id='oba_appconfig_select_currency']"); - await expect(locator).toContainText('Indonesian rupiah (Rp)'); - await page.waitForTimeout(1000); - await page.close(); - }); /*-----------------------------Call to Action------------------------------------------------*/ - //Call To Action for empty + //Call To Action for empty (In Regression Suite) test.skip('Action call for empty ',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '', 'City','Tamil Nadu'); - // const locator = page.getByRole('Action Call'); - // await expect(locator).toBeFocused(); - // await page.waitForTimeout(3000); - await page.close(); + + await page.close(); }); //Call To Action contains numbers starting with 23 - test('Action contains numbers starting with 23 ',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-05: Action contains numbers starting with 23 ',async ({page})=>{ + + //Navigate to config Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '2355456737', 'City','Tamil Nadu'); + + //Assertions const locator = page.locator("//input[@id='oba_appconfig_call_to_action']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -106,12 +72,13 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ }); //Call To Action for Letters - test('Call To Action for Letters',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-06: Call To Action for Letters',async ({page})=>{ + + //Navigate to Config Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', 'AFHGDGJNBVJ', 'City','Tamil Nadu'); + + //Assertions const locator = page.locator("//input[@id='oba_appconfig_call_to_action']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -120,12 +87,13 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ }); //Call to Action only 9 numbers - test('Call to Action only 9 numbers' ,async({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-07: Call to Action only 9 numbers' ,async({page})=>{ + + //Navigate to config page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '956456737', 'City','Tamil Nadu'); + + //Assertions const locator = page.locator("//input[@id='oba_appconfig_call_to_action']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -134,12 +102,13 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ }) //call to action using specail chars - test('call to action using specail characters', async({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-08: call to action using special characters', async({page})=>{ + + //Navigate to App Configuration Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '95#5456737', 'City','Tamil Nadu'); + + //Assertions const locator = page.locator("//input[@id='oba_appconfig_call_to_action']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -148,12 +117,13 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ }) //call to Action using Space - test('space for action call',async({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-09: space for action call',async({page})=>{ + + //Navigate to App Configuration Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', ' 965 526 ', 'City','Tamil Nadu'); + + //Assertions const locator = page.locator("//input[@id='oba_appconfig_call_to_action']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -162,12 +132,13 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ }); //Merchant add International Number - test('International Number', async({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-10: International Number', async({page})=>{ + + //Navigate to App Configuration Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '456236216514', 'City','Tamil Nadu'); + + //Assertions const locator = page.locator("//input[@id='oba_appconfig_call_to_action']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -176,25 +147,27 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ }) - test('Enter Alphabet', async({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-11: Enter Alphabet', async({page})=>{ + + //Navigate to App Configuration Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', 'hjgfdjsfjk', 'City','Tamil Nadu'); + + //Assertions const locator = page.locator("//input[@id='oba_appconfig_call_to_action']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.waitForTimeout(3000); - await page.close(); + await page.close(); }) - test('11 digits', async({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-12: 11 digits', async({page})=>{ + + //Navigate to App Configuration Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '96548712396', 'City','Tamil Nadu'); + + //Assertions const locator = page.locator("//input[@id='oba_appconfig_call_to_action']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -202,39 +175,40 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ await page.close(); }) - test.skip('10 digits', async({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-16: 10 digits', async({page})=>{ + + //Navigate to App Configuration Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - const actionNumber = await page.locator(("//input[@id='oba_appconfig_call_to_action']").textContent()); - expect.soft(actionNumber).toContain('9565456737'); + + //Assertions + const PhoneNumber = await page.locator("//input[@id='oba_appconfig_call_to_action']").inputValue(); + expect.soft(PhoneNumber).toContain(('9565456737').toString()); await page.close(); }) //Merchant add valid details - test.skip('Valid Number starts with 6,7,8,9',async({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + test('TC-AC-17: Valid Number starts with 6,7,8,9',async({page})=>{ + + //Navigate to App Configuration Page const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '6565456737', 'City','Tamil Nadu'); - const actionNumber = await page.locator(("//input[@id='oba_appconfig_call_to_action']").textContent()); - expect.soft(actionNumber).toContain('9565456737'); + //Assertions + const actionNumber = await page.locator("//input[@id='oba_appconfig_call_to_action']").inputValue(); + expect.soft(actionNumber).toContain(('6565456737').toString()); - await page.waitForTimeout(2000); + await page.close(); }) - +//Unable to assert /*-----------------------------------------------------------------------------------*/ @@ -244,150 +218,162 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); + const locator = page.locator("//option[@value='CITY']"); await expect(locator).toBeVisible(); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user select State - test('select State', async ({page}) =>{ + test.skip('select State', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - // const App = new Appconfig(page); - //await App.Appconfigdetails('Indonesian rupiah (Rp)','5','800','20','9480606707','State','Bijapur@-12'); - await page.waitForTimeout(3000); - await page.close(); + + await page.waitForTimeout(3000); + await page.close(); }); - // + //user select City test.skip('select City', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); + const locator = page.locator(("//option[@value='CITY']").inputValue()); await expect(locator).toBeVisible(); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user select Pincode - test('select Pincode', async ({page}) =>{ + test.skip('select Pincode', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user select Landmark - test('select Landmark', async ({page}) =>{ + test.skip('select Landmark', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user select None - test('select None', async ({page}) =>{ + test.skip('select None', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter the less than cart value - test('less than cart value ', async ({page}) =>{ + test.skip('less than cart value ', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter the cart value equal to the value - test('cart value equal to the value', async ({page}) =>{ + test.skip('cart value equal to the value', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter cart zero - test('enter cart zero ', async ({page}) =>{ + test.skip('enter cart zero ', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter the delivary charges as zero - test('enter the delivary charges as zero', async ({page}) =>{ + test.skip('enter the delivary charges as zero', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter the Delivary chrages as more than given. - test('Delivary chrages as more than given.', async ({page}) =>{ + test.skip('Delivary chrages as more than given.', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter the less cart value and add delivary charg to @@ -395,12 +381,13 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter the less than cart value @@ -409,45 +396,49 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter the zero as cart value and delivary charge - test('enter the zero as cart value and delivary charge', async ({page}) =>{ + test.skip('enter the zero as cart value and delivary charge', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '0', '0', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter sound loop as 0 - test(' enter sound loop as 0', async ({page}) =>{ + test.skip(' enter sound loop as 0', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','0','5', '400', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); //user enter sound loop as 100 - test(' enter sound loop as 100', async ({page}) =>{ + test.skip(' enter sound loop as 100', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','100','5', '400', '35', '9565456737', 'City','Tamil Nadu'); @@ -456,11 +447,12 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ }); //user enter sound loop as 10 - test(' enter sound loop as 10', async ({page}) =>{ + test.skip(' enter sound loop as 10', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','10','5', '400', '35', '9565456737', 'City','Tamil Nadu'); @@ -469,16 +461,17 @@ test.skip('complete AppConfig page to check API',async ({page,request})=>{ }); //user enter cart value to max 999999 - test('enter cart value to max 999999', async ({page}) =>{ + test.skip('enter cart value to max 999999', async ({page}) =>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + const config = new AppConfig(page); await config.functionalityAppConfig('Indonesian rupiah (Rp)','7','5', '999999', '35', '9565456737', 'City','Tamil Nadu'); - await page.waitForTimeout(3000); - await page.close(); + await page.waitForTimeout(3000); + await page.close(); }); diff --git a/tests/CatlogPage.spec.js b/tests/CatlogPage.spec.js index f7f296c..88cc9fb 100644 --- a/tests/CatlogPage.spec.js +++ b/tests/CatlogPage.spec.js @@ -4,94 +4,83 @@ import { CatlogPage } from '../pages/CatlogPage'; +test.beforeEach(async ({ page }) => { -test('CatlogButton is working?',async ({page})=>{ + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); +}); + + + +test('TC-CP-14: CatlogButton is working?',async ({page})=>{ + + //Navigate to catlog page const catlog = new CatlogPage(page); - //await catlog.clickCatalogButton(); await catlog.clickCatalogButton(); await page.waitForTimeout(3000) + + //Assertion await expect(await page.locator(catlog.catlogPageValidate)).toBeVisible(); }) -test('Buds List is selected',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); +//Not able to assert +test.skip('Buds List is selected',async ({page})=>{ + + //Navigate to Catlog page const catlog = new CatlogPage(page); - //await catlog.clickCatalogButton(); await catlog.imageUpload('BUDS_LIST', 'PRODUCTS_LEFT'); await page.waitForTimeout(3000) + }) -test('Buds sliding is selected',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); +test.skip('Buds sliding is selected',async ({page})=>{ + + //Navigate to Catlog page 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); +test.skip('Buds grid is selected',async ({page})=>{ + + //Navigate to Catlog page 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); +test.skip('product left is selected',async ({page})=>{ + + //Navigate to Catlog page 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); +test.skip('product ping pong is selected',async ({page})=>{ + + //Navigate to catlog page 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); +test.skip('product right is selected',async ({page})=>{ + + //Navigate to Catlog Page 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); +test.skip('product grid is selected',async ({page})=>{ + + //Navigate to catlog page const catlog = new CatlogPage(page); - //await catlog.clickCatalogButton(); await catlog.imageUpload('BUDS_GRID', 'PRODUCTS_GRID'); await page.waitForTimeout(3000) diff --git a/tests/ContentPage.spec.js b/tests/ContentPage.spec.js index 35f7b6d..e2af490 100644 --- a/tests/ContentPage.spec.js +++ b/tests/ContentPage.spec.js @@ -3,51 +3,55 @@ 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); +test.beforeEach(async ({ page }) => { + + //Navigate to Login Page + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); +}); + + +test('TC-CON-01: Content page is opening?',async ({page})=>{ + + //Navigate to content page const content = new ContentPage(page); await content.clickContentButton(); + + //Assertion 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); + +//unable to assert +test.skip('Content page is able to save in privacy policy',async ({page})=>{ + + //Navigate to content page 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); +test.skip('Content page is able to save in Terms & Conditions',async ({page})=>{ + + //Navigate to content page 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); +test.skip('Content page is able to save in About Us',async ({page})=>{ + + //Navigate to content page const content = new ContentPage(page); await content.ContentToSave('About Us'); -// await expect(await page.locator(content.contentPageValidate)).toBeVisible(); + await page.waitForTimeout(3000); diff --git a/tests/CouponPage.spec.js b/tests/CouponPage.spec.js index 7c960ed..39a68af 100644 --- a/tests/CouponPage.spec.js +++ b/tests/CouponPage.spec.js @@ -3,55 +3,20 @@ import { LoginPage } from '../pages/LoginPage'; import { CouponPage } from '../pages/Couponpage'; -test('Coupon Button working?',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); - const coupon = new CouponPage(page); - await coupon.viewCoupon(); - await expect(await page.locator("//th[normalize-space()='Coupon Code']")).toBeVisible(); - -}) +test('TC-COU-01: Coupon Button working?',async ({page})=>{ - - -/* -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(); + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to coupon page 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); -}) + //Assertion + await expect(await page.locator("//th[normalize-space()='Coupon Code']")).toBeVisible(); -*/ \ No newline at end of file +}) diff --git a/tests/Feedback.spec.js b/tests/Feedback.spec.js index 7bdcb5f..287adb9 100644 --- a/tests/Feedback.spec.js +++ b/tests/Feedback.spec.js @@ -3,18 +3,27 @@ import { LoginPage } from '../pages/LoginPage'; import { Feedback } from '../pages/Feedback'; -test('Feedback page is opening?',async ({page})=>{ +test('TC-FP-01: Feedback page is opening?',async ({page})=>{ + + //NAVIGATE TO LOGIN PAGE const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //NAVIGATE TO FEEDBACK PAGE const feedback = new Feedback(page); await feedback.clickFeedbackButton(); + + //ASSERTION await expect(await page.locator("//label[normalize-space()='Select feedback Type']")).toBeVisible(); - // await page.waitForTimeout(3000) + }) -test('Submit Feedback_API',async ({request,page})=>{ +test('TC-API-18: Submit Feedback_API',async ({request,page})=>{ + + //POST REQUEST AND STORE RESPONSE const response = await request.post('https://dev.orderbookings.com/api/merchant/submitFeedback', { data:{ @@ -27,26 +36,11 @@ test('Submit Feedback_API',async ({request,page})=>{ "feedback_from_phone": "919480111111" } }); - // 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 feedback = new Feedback(page); - await feedback.clickFeedbackButton(); - expect.soft(feedback.mailID).toContain(res.feedback_from_email); - expect.soft(feedback.feedbackText).toContain(res.feedback_text); - expect.soft(feedback.name).toContain(res.feedback_from_name); - expect.soft((feedback.phone).toString()).toContain(res.feedback_from_phone); */ - const res = await response.json(); - await console.log('ADDED NEW FEEDBACK OF USER'); - await console.log(res); + //ASSERTION expect(res.data).toBe(true); await page.reload(); diff --git a/tests/LoginPage.spec.js b/tests/LoginPage.spec.js index 7c3929a..38cdd5e 100644 --- a/tests/LoginPage.spec.js +++ b/tests/LoginPage.spec.js @@ -5,73 +5,82 @@ import { LoginPage } from '../pages/LoginPage'; //For Valid Details. -test('Login test with correct credentials',async ({page})=>{ +test('TC-LP-01: Login test with correct credentials',async ({page})=>{ + + //Navigate to login page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('xpcv2@rustyload.com','7777777777') + + //Assertion await expect(page).toHaveURL('https://dev.orderbookings.com/merchant/index/index'); //check the expected url is having same url await page.close(); }) -//Invalid Password -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(); //negative invalid email - await page.close(); -}) - -//Invalid Username -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(); //negative invalid email - await page.close(); -}) //@ Email without @ symbol -test('Login test Merchant enters email without @ symbol',async ({page})=>{ +test('TC-LP-03: Login test Merchant enters email without @ symbol',async ({page})=>{ + + //Navigate to Login 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(); //negative invalid email - await page.close(); -}) -// Email with excessive Length -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') + //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) + // Email without domain -test('Login test Merchant enters email without domain',async ({page})=>{ +test('TC-Lp-04: Login test Merchant enters email without domain',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaatram@.com','#12345678A') + + //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) +// Email with excessive Length +test('TC-LP-05: Login test Merchant enters Email with excessive Length',async ({page})=>{ + + //Navigate to Login Page + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaatramiuegkdsfyuydklashmnfbdkashnbv@gmail.com','#12345678A') + + //Assertion + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email + await page.close(); +}) + //Email with consecutive dots -test('Login test Merchant enters Email with consecutive dots',async ({page})=>{ +test('TC-LP-07: Login test Merchant enters Email with consecutive dots',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaatram@gmail..com','#12345678A') + + //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) //Empty Username -test('Login test with Empty Email',async ({page})=>{ +test('TC-LP-08: Login test with Empty Email',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('','#12345678A') + + + //Assertion const locator = page.locator("//input[@name='oba_login_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -79,46 +88,93 @@ test('Login test with Empty Email',async ({page})=>{ }) //Empty Password -test('Login test with no password',async ({page})=>{ +test('TC-LP-09: Login test with no password',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaram@gmail.com','') + + //Assertion const locator = page.locator("//input[@placeholder='Password']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) +//Invalid Username +test('TC-LP-10: Login test with wrong Email',async ({page})=>{ + + //Navigate to Login Page + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaatram@gmail.com','#12345678A') + + //Assertion + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email + await page.close(); +}) + +//Invalid Password +test('TC-LP-11: Login test with wrong password',async ({page})=>{ + //Navigate to login page + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.login('rabisundaram@gmail.com','#123466678A') + + //Assertion + await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email + await page.close(); +}) + + + //Forgot Password working or not? -test('ForgotPassword',async ({page})=>{ +test('TC-LP-12: ForgotPassword',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); + await page.waitForTimeout(3000) await login.forgetPasswordLink() await page.waitForTimeout(3000) + + //Assertion await expect(await page.locator("//button[normalize-space()='RESET']")).toBeVisible(); }) //Back To Login working? -test('BacktoLogin',async ({page})=>{ +test('TC-LP-13: BacktoLogin',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await page.waitForTimeout(3000) await login.forgetPasswordLink() + await page.waitForTimeout(3000) await login.backToLoginLink() + await page.waitForTimeout(3000) + + //Assertion await expect(await page.locator("//button[normalize-space()='SIGN IN']")).toBeVisible(); }) // -test('Invalid mail',async ({page})=>{ +test('TC-LP-14: Invalid mail',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); + await login.login('midhaja','#12345678A') await page.waitForTimeout(3000) - const errorMessage = await page.locator("//div[@role='alert']").textContent() - console.log(errorMessage); + + await page.locator("//div[@role='alert']").textContent() + + //Assertion await expect(await page.locator("//div[@role='alert']")).toBeVisible(); }) diff --git a/tests/NotificationPage.spec.js b/tests/NotificationPage.spec.js index 46173ec..9104e2e 100644 --- a/tests/NotificationPage.spec.js +++ b/tests/NotificationPage.spec.js @@ -4,7 +4,7 @@ import { NotificationPage } from '../pages/NotificationPage'; -test('Notification Button is working?',async ({page}) =>{ +test('TC-NP-01: Notification Button is working?',async ({page}) =>{ //login Function const login = new LoginPage(page); await login.gotoLoginPage(); @@ -66,11 +66,13 @@ test.skip('Duplicate NotifybyName', async ({page}) =>{ }) test.skip('NotifybyArea', async ({page}) =>{ + //login Function const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); await page.waitForTimeout(1000); + //Notify Function using Send Notification by Area const Notified = new Notify(page); await Notified.NotifyMewithArea('Send notification by Area','Shubya','586101','Successfully Added Notification by area'); @@ -89,7 +91,7 @@ test.skip('check time is set',async({page})=>{ await page.waitForTimeout(1000); const Notified = new Notify(page); await Notified.NotifyMewithArea('Send notification by Area','Shubya','ABCDF','Successfully Added Notification by area'); - //await Notified.setDate('2025','April 2025','2'); //unable to set date in the test + await page.waitForTimeout(100); await Notified.setTime('8','45'); await page.waitForTimeout(100); @@ -111,9 +113,12 @@ test.skip('check Send Notification',async({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(1000); + const dash = new DashBoard(page); await dash.gotoNotification() + const Notified = new Notify(page); await Notified.sendNotification(); await page.close(); @@ -127,7 +132,6 @@ test.skip('check file selected',async({page})=>{ await page.waitForTimeout(1000); const Notified = new Notify(page); await Notified.selectFile('C:/PlayWright/files/SS.jpeg'); - //await expect(page.locator('#notificationimage')).toBeAttached(); await Notified.sendNotification(); await page.close(); }) \ No newline at end of file diff --git a/tests/OrderPage.spec.js b/tests/OrderPage.spec.js index bad6186..b8e4ba0 100644 --- a/tests/OrderPage.spec.js +++ b/tests/OrderPage.spec.js @@ -4,89 +4,125 @@ import { LoginPage } from '../pages/LoginPage'; import { OrderPage } from '../pages/OrderPage'; -test('Order Button',async ({page})=>{ +test('TC-OP-01: Order Button',async ({page})=>{ + + //Navigate to login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to order page const order = new OrderPage(page); await order.clickOrdersButton(); await page.waitForTimeout(5000); + + //Assertion await expect(await page.locator("//a[normalize-space()='Order List']")).toBeVisible(); }) -test('Order List Button',async ({page})=>{ +test('Tc-OP-02: Order List Button',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to Order Page const order = new OrderPage(page); await order.clickOrdersListButton(); - // await page.waitForTimeout(5000); + + //Assertion await expect(await page.locator("//select[@id='oba_edit_order_status_filter']")).toBeVisible(); }) -test('Order Status Dropdown Count',async ({page})=>{ +test('TC-OP-03: Order Status Dropdown Count',async ({page})=>{ + + //Navigate to login page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to order page const order = new OrderPage(page); await order.clickOrdersListButton(); + await page.waitForTimeout(5000); + + //Assertion const options = await page.locator('#oba_edit_order_status_filter option') await expect(options).toHaveCount(5); }) -test('Order status dropdown menu',async ({page})=>{ + +test.skip('Order status dropdown menu',async ({page})=>{ + const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); - // await page.waitForTimeout(5000); + + const order = new OrderPage(page); await order.clickOrdersListButton(); - // await page.waitForTimeout(5000); + + const value= await page.locator("//select[@id='oba_edit_order_status_filter']").textContent() console.log(value); }) -test('Order status selected',async ({page})=>{ +test.skip('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_REQUESTED'); - //need to fi + + }) -test('Order declined',async ({page})=>{ +test.skip('Order declined',async ({page})=>{ const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + const order = new OrderPage(page); await order.textBoxSearch('ORDER_STATUS_DECLINED', 'Tomato Rice and Chicken Biriyani'); }) -test('Order requested',async ({page})=>{ +test.skip('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})=>{ +test.skip('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})=>{ +test.skip('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'); @@ -95,13 +131,11 @@ test('Order cancelled',async ({page})=>{ }) -test('Order by ID API',async ({request,page})=>{ +test('TC-OP-30,31,32,33,34: 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(); @@ -109,9 +143,7 @@ test('Order by ID API',async ({request,page})=>{ 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()); diff --git a/tests/ProductPage.spec.js b/tests/ProductPage.spec.js index b0b1fae..7a8c459 100644 --- a/tests/ProductPage.spec.js +++ b/tests/ProductPage.spec.js @@ -2,154 +2,286 @@ const {test, expect} =require('@playwright/test') import { LoginPage } from '../pages/LoginPage'; import { ProductPage } from '../pages/ProductPage'; -test.describe('Product Name Test Cases',()=>{ +//Product Page Button test cases +test.describe('Product Page Button Test Cases',()=>{ -test('Product button',async ({page})=>{ +//Validate Product button working? +test('TC-PP-01: Product button',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.clickProductsButton(); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//a[normalize-space()='Product List']")).toBeVisible(); }) -test('Product list button',async ({page})=>{ + + + +//Validate Product List button working? +test('TC-PP-02: Product list button',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.clickProductlistButton(); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//input[@id='oba_product_search']")).toBeVisible(); }) -test('Add product button',async ({page})=>{ + + + +//Validate Add Product Button working? +test('TC-PP-03: Add product button',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.clickAddProductButton(); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//input[@id='oba_product_name']")).toBeVisible(); }) -test('Product Name is Empty',async ({page})=>{ + + + +// Validate Delete Button is working +test('TC-PP-04: Delete Button is working?',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + await login.OpenOBA(); + + //Navigate to Product Page + const product = new ProductPage(page); + await product.addProductFunctionalityDelete('Idli Chutney & Vadai', '20', '10', '10','8','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion + await expect(page.locator("//button[normalize-space()='Yes, delete it!']")).toBeVisible(); +}) + + +//Yes Delete Button Assertion is pending +test.skip('TC-PP-05: Yes Delete Button is working?',async ({page})=>{ + + //Login to OBA Website + const login = new LoginPage(page); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); - await product.addProductFunctionality('', '250', '10', '5', '20','KK Biriyani'); + await product.addProductFunctionalityDelete('Idli Chutney & Vadai', '20', '10', '10','8','Idli is Tasty'); await page.waitForTimeout(5000); - const locator = page.locator("//input[@id='oba_product_name']"); - await expect(locator).toBeFocused(); - await expect(locator).toBeVisible(); - await page.close(); + await page.locator("//button[normalize-space()='Yes, delete it!']").click(); + }) -test('Product Name starts with space',async ({page})=>{ + + + +//Validate the navigation to Product list page +test('TC-PP-06: Navigate to product list page button',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); + await login.OpenOBA(); + + //Navigate to Product Page + const product = new ProductPage(page); + await product.clickAddProductButton(); await page.waitForTimeout(5000); + + //Assertion + await page.locator("//a[@href='productlist']").click(); + await expect(page.locator("//i[@class='fa fa-lg fa-fw fa-search']")).toBeVisible(); + +}) + +// Validate the edit button +test('TC-PP-07: Edit button in product list page',async ({page})=>{ + + //Login to OBA Website + const login = new LoginPage(page); + await login.OpenOBA(); + + //Navigate to Product Page + const product = new ProductPage(page); + await product.clickProductlistButton(); + await page.waitForTimeout(5000); + + //Assertion + await page.locator("//tbody/tr[1]/td[7]/div[1]/a[1]").click(); + await expect(page.locator("//label[@id='oba_product_name_label']")).toBeVisible(); + +}) + +}) + +test.describe('Product Name Test Cases',()=>{ + + +test('TC-AP-04: Product Name is Empty',async ({page})=>{ + + //Login to OBA Website + const login = new LoginPage(page); + await login.OpenOBA(); + + //Navigate to Product Page + const product = new ProductPage(page); + await product.addProductFunctionality('', '250', '10', '5', '20','KK Biriyani'); + await page.waitForTimeout(5000); + + //Assertion + const locator = page.locator("//input[@id='oba_product_name']"); + await expect(locator).toBeFocused(); + await expect(locator).toBeVisible(); + await page.close(); +}) + + + +test('TC-AP-05: Product Name starts with space',async ({page})=>{ + + //Login to OBA Website + const login = new LoginPage(page); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionality(' Biriyani', '250', '10', '5', '20','KK Biriyani'); //Name with space is accepted i.e space button is not working. await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); - await page.locator("//tbody/tr[2]/td[7]/div[1]/a[1]").click(); - await page.locator("//i[@class='fa fa-lg fa-trash']").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); + }) -test('Enter Number instead of name',async ({page})=>{ +test('TC-AP-06: Enter Number instead of name',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); - await product.addProductFunctionality('96152456321', '250', '10', '5', '20','KK Biriyani'); //Name with space is accepted i.e space button is not working. + await product.addProductFunctionality('96152456321', '250', '10', '5', '20','KK Biriyani'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='96152456321']")).toBeVisible(); - await page.locator("//tbody/tr[2]/td[7]/div[1]/a[1]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) -test.skip('Enter 50 Alphabet ',async ({page})=>{ +test.skip('TC-AP-07: Enter 50 Alphabet ',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); - await product.addProductFunctionality('asdfghjklzmxncbvqwertyuioplkjhgfdsazxcvbnmqwertyui', '250', '10', '5', '20','KK Biriyani');//Name with space is accepted i.e space button is not working. + await product.addProductFunctionality('asdfghjklzmxncbvqwertyuioplkjhgfdsazxcvbnmqwertyui', '250', '10', '5', '20','KK Biriyani'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='asdfghjklzmxncbvqwertyuioplkjhgfdsazxcvbnmqwertyui']")).toBeVisible(); - await page.locator("//tbody/tr[3]/td[7]/div[1]/a[1]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) -test('Enter Special Characters and symbol ',async ({page})=>{ +test('TC-AP-08: Enter Special Characters and symbol ',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionality('#4nskiu*()', '250', '10', '5', '20','KK Biriyani'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='#4nskiu*()']")).toBeVisible(); - await page.locator("//tbody/tr[2]/td[7]/div[1]/a[1]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); + }) -test('Product Name with Alphabet',async ({page})=>{ +test('TC-AP-09: Product Name with Alphabet',async ({page})=>{ + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionality('Biriyani', '250', '10', '5', '20','KK Biriyani'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible(); - await page.locator("//tbody/tr[2]/td[7]/div[1]/a[1]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); + }) -test('Product Name with space',async ({page})=>{ +test('TC-AP-10: Product Name with space',async ({page})=>{ + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Butter Naan', '30', '10', '5', '20','Tasty Butter Naan'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Butter Naan']")).toBeVisible(); - await page.locator("//tbody/tr[2]/td[7]/div[1]/a[1]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); + }) -test('Product Name with special character',async ({page})=>{ +test('TC-AP-11: Product Name with special character',async ({page})=>{ + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '50', '10', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); - await page.locator("//tbody/tr[2]/td[7]/div[1]/a[1]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); + }) -}) + +}) @@ -157,14 +289,19 @@ test('Product Name with special character',async ({page})=>{ test.describe('Product Price Test Cases',()=>{ - test('Empty product prize',async ({page})=>{ + test('TC-AP-20: Empty product prize',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_price']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -172,229 +309,294 @@ test.describe('Product Price Test Cases',()=>{ }) - test.skip('Product prize entered other than numeric value',async ({page})=>{ +test.skip('TC-AP-21: Product prize entered other than numeric value',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page 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})=>{ + test('TC-AP-22: Product prize entered with Negative value',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai','-40', '10', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_price']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test.skip('Product prize entered with Special Characters',async ({page})=>{ + test.skip('TC-AP-23: Product prize entered with Special Characters',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page 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})=>{ +test(' TC-AP-25: Valid Product prize',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai','50', '10', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//b[normalize-space()='50']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) -test('Product prize in decimal value',async ({page})=>{ +test('TC-AP-26: Product prize in decimal value',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Vadai','12.27', '10', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//b[normalize-space()='12.27']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) - test('Product prize',async ({page})=>{ + test('TC-AP-28: Product prize',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai','50', '10', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//b[normalize-space()='50']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) -test('Currency Symbol',async ({page})=>{ +test('TC-AP-27: Currency Symbol',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.clickAddProductButton(); + await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//span[@class='input-group-text']")).toBeVisible(); await page.close(); }) -test('merchant verify price leading with zero',async ({page})=>{ +test('TC-AP-28: merchant verify price leading with zero',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Vadai','129.06', '10', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//b[normalize-space()='129.06']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + await product.deleteProduct(); }) -test('merchant verify maximum length allowed',async ({page})=>{ +test('TC-AP-29: merchant verify maximum length allowed',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Vadai','12095262', '10', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + + //Assertion await expect(page.locator("//b[normalize-space()='12095262']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + await product.deleteProduct(); }) -test('merchant enters prize zero allowed',async ({page})=>{ +test('TC-AP-30: merchant enters prize zero allowed',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Vadai','0', '10', '5', '20','Idli is Tasty'); + await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//b[normalize-space()='0']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) }) test.describe('Quantity Limit Test Cases',()=>{ - test('Managed Radio button Check',async ({page})=>{ + test('TC-AP-31: Managed Radio button Check',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) - test('Empty quantity',async ({page})=>{ + test('TC-AP-33: Empty quantity',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_quantity']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test.skip('Enter other than number',async ({page})=>{ + test.skip('TC-AP-34: Enter other than number',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page 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})=>{ + test('TC-AP-35: merchant enters negative product quantity',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '-30', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_quantity']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test.skip('merchant enters special characters in product quantity',async ({page})=>{ + test.skip('TC-AP-36: merchant enters special characters in product quantity',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page 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})=>{ + test('TC-AP-37: merchant verify valid quantity entry in product quantity',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '5', '6', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='5']")).toBeVisible(); await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) - test('merchant enters decimal quantity',async ({page})=>{ + test('TC-AP-38: merchant enters decimal quantity',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '50.5', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_quantity']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -402,156 +604,200 @@ test.describe('Quantity Limit Test Cases',()=>{ }) - test('merchant enters zero',async ({page})=>{ + test('TC-AP-39: merchant enters zero',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '0', '5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='0']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) }) test.describe('Unmanaged Button',()=>{ - test('UnManaged Radio Button working',async ({page})=>{ + test(' TC-AP-43: UnManaged Radio Button working',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page 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(); + + + //Assertion await expect(await page.locator("//td[normalize-space()='Un-managed']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[3]").click(); - await page.locator("//i[@class='fa fa-lg fa-trash']").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + await product.deleteProduct(); }) }) test.describe('Order Limit Test Cases',()=>{ - test('Empty order',async ({page})=>{ + test('TC-AP-45: Empty order',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_order_limit']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test('Space at the start of order limit',async ({page})=>{ + test('TC-AP-46: Space at the start of order limit',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', ' 6', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(await page.locator("//td[normalize-space()='10']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) - test.skip('Enter character other than numeric value',async ({page})=>{ + test.skip('TC-AP-47: Enter character other than numeric value',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page 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})=>{ + test('TC-AP-48: Negative order limit',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '-52', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_order_limit']"); + await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); - // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) - test.skip('Special characters in order limit',async ({page})=>{ + test.skip('TC-AP-49: Special characters in order limit',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page 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})=>{ + test('TC-AP-51: Decimal Value in order limit',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '100.5', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_order_limit']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); - // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) - test('Order limit leading with zero',async ({page})=>{ + test('TC-AP-52: Order limit leading with zero',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '050', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(await page.locator("//td[normalize-space()='50']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); - // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + + //delete the product saved + await product.deleteProduct(); + }) - test('Maximum order limit',async ({page})=>{ + test('TC-AP-53: Maximum order limit',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '050', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(await page.locator("//td[normalize-space()='50']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) - test('Zero order limit',async ({page})=>{ + test('TC-AP-54: Zero order limit',async ({page})=>{ + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '0', '20','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_order_limit']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -561,147 +807,183 @@ test.describe('Order Limit Test Cases',()=>{ test.describe('Product Description',()=>{ - test.skip('Empty order',async ({page})=>{ + test.skip('TC-AP-13: Empty order',async ({page})=>{ + + + //Login to OBA Website const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to Product Page 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.describe(' Tax in % Test Cases',()=>{ - test.skip('Enter special character',async ({page})=>{ + test.skip('TC-AP-55: Enter special character',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to product page 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.skip('Enter Alphabet',async ({page})=>{ + test.skip('TC-AP-56 : Enter Alphabet',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to product 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.skip('Enter space at the start of the word',async ({page})=>{ + test.skip('TC-AP-57: Enter space at the start of the word',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to product 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})=>{ + test('TC-AP-58: Placeholder check for tax %',async ({page})=>{ + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to product const product = new ProductPage(page); await product.clickAddProductButton(); await page.waitForTimeout(5000); + + //Assertion 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); - const locator = page.locator("//input[@id='oba_product_tax']"); + test('TC-AP-60: Empty Tax %',async ({page})=>{ + + //Navigate to Login Page + const login = new LoginPage(page); + await login.OpenOBA(); + + //Navigate to product + const product = new ProductPage(page); + await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '','Idli is Tasty'); + await page.waitForTimeout(5000); + + + //Assertion + const locator = page.locator("//input[@id='oba_product_tax']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); - // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) - test('Enter Tax leading with zero',async ({page})=>{ + test('TC-AP-61:Enter Tax leading with zero',async ({page})=>{ + + + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + + //Navigate to product const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '055','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + + //delete the product saved + await product.deleteProduct(); }) - test('Enter Tax% is maximum 100',async ({page})=>{ + test('TC-AP-62: Enter Tax% is maximum 100',async ({page})=>{ + + + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + + //Navigate to product const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '100','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); - - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + await product.deleteProduct(); }) - test('Enter Tax% is maximum 110',async ({page})=>{ + test('TC-AP-63: Enter Tax% is maximum 110',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + + //Navigate to product const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '110','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + //delete the product saved + await product.deleteProduct(); }) - test('Enter Tax% in negative value',async ({page})=>{ + + + test('TC-AP-64:Enter Tax% in negative value',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + + //Navigate to product const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '-10','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion const locator = page.locator("//input[@id='oba_product_tax']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); - // await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); + }) - test('Enter Tax% is decimal value',async ({page})=>{ + test('TC-AP-65:Enter Tax% is decimal value',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + await login.OpenOBA(); + + //Navigate to product const product = new ProductPage(page); await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '11.23','Idli is Tasty'); await page.waitForTimeout(5000); + + //Assertion await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible(); - await page.locator("(//i[@class='fa fa-lg fa-edit'])[2]").click(); - await page.locator("//main[@class='app-content']//a[2]").click(); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); - await page.close(); + //delete the product saved + await product.deleteProduct(); }) }) @@ -709,104 +991,26 @@ test.describe('Tax in % Test Cases',()=>{ 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 Delete',()=>{ - - - test('Delete Button is 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.addProductFunctionalityDelete('Idli Chutney & Vadai', '20', '10', '10','8','Idli is Tasty'); - await page.waitForTimeout(5000); - await expect(page.locator("//button[normalize-space()='Yes, delete it!']")).toBeVisible(); - // await product.editProduct(); - // await expect(page.locator("//td[normalize-space()='false']")).toBeVisible(); + test('TC-AP-67: Available and not available checkbox',async ({page})=>{ - }) - test('Yes Delete Button is working?',async ({page})=>{ + //navigate to Login const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); - const product = new ProductPage(page); - await product.addProductFunctionalityDelete('Idli Chutney & Vadai', '20', '10', '10','8','Idli is Tasty'); - await page.waitForTimeout(5000); - await page.locator("//button[normalize-space()='Yes, delete it!']").click(); + await login.OpenOBA(); - // await product.editProduct(); - // await expect(page.locator("//td[normalize-space()='false']")).toBeVisible(); - - }) - test('Navigate to product list page button',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); + //Navigate to product const product = new ProductPage(page); - await product.clickAddProductButton(); + await product.addProductFunctionalityUnmanaged('Idli Chutney & Vadai', '20', '10', '10','8','Idli is Tasty'); await page.waitForTimeout(5000); - await page.locator("//a[@href='productlist']").click(); - - // await product.editProduct(); - await expect(page.locator("//i[@class='fa fa-lg fa-fw fa-search']")).toBeVisible(); - - }) - test('Edit button in product list page',async ({page})=>{ - const login = new LoginPage(page); - await login.gotoLoginPage(); - await login.loginWithCrtPassword(); - await page.waitForTimeout(5000); - const product = new ProductPage(page); - await product.clickProductlistButton(); - await page.waitForTimeout(5000); - await page.locator("//tbody/tr[1]/td[7]/div[1]/a[1]").click(); - - // await product.editProduct(); - await expect(page.locator("//label[@id='oba_product_name_label']")).toBeVisible(); - - }) - - - + //Assertion + await expect(page.locator("//td[normalize-space()='false']")).toBeVisible(); -}) + await product.editProduct(); + await expect(page.locator("//td[normalize-space()='true']")).toBeVisible(); + await product.deleteProduct(); -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(); }) - }) diff --git a/tests/RegisterPage.spec.js b/tests/RegisterPage.spec.js index bb02c41..1b06bb3 100644 --- a/tests/RegisterPage.spec.js +++ b/tests/RegisterPage.spec.js @@ -2,37 +2,21 @@ const {test, expect} =require('@playwright/test') import { RegisterPage } from '../pages/RegisterPage'; - /* -------------------------- TEST CASE FOR VALID DETAILS --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ - -test.describe('GroupWithCorrectDetails',()=>{ - -// Register Link Check -test('RegisterLink Check',async ({page})=>{ - const register = new RegisterPage(page); - await register.gotoRegisterPage(); - await expect(await page.locator("//button[@class='btn btn-primary btn-block']")).toBeVisible(); -}) - - -// Register with correct details -test('Register page entering with correct 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'); - await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); - await page.close(); -}) -}) - /* ---------------------------------------------------TEST CASES FOR NAME--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ test.describe('TC_Name',()=>{ - test('Name with empty space is entered',async ({page})=>{ + test('TC-RP-01: Name with empty space is entered',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter value for register await register.register('', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_username']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -40,70 +24,112 @@ test.describe('TC_Name',()=>{ }) - /* + //Numbers are accepted as name - test('Instead of names, Numbers is entered',async ({page})=>{ + test.skip('TC-RP-02: Instead of names, Numbers is entered',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('52658954623', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_username']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test('50 characters are entered',async ({page})=>{ + test.skip('TC-RP-03: 50 characters are entered',async ({page})=>{ + + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('dhjdgabjfbdiuafhdkjbaiughjfkshloadfishjkfglik', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_username']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test('Merchant enters special characters and symbol',async ({page})=>{ + test.skip('TC-RP-04: Merchant enters special characters and symbol',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('^%$#%$^&*&', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_username']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - */ + + + test('TC-RP-05: Name with Alphabet',async ({page})=>{ - test('Name with Alphabet',async ({page})=>{ + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Mano', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();//already verified again sign up will be displayed. await page.close(); }) - test('Name with space',async ({page})=>{ + test('TC-RP-06: Name with space',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Mano Aravind', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); //already verified again sign up will be displayed. await page.close(); }) - test('Name with special character',async ({page})=>{ + test('TC-RP-07: Name with special character',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Mano_Aravind', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); //already verified again sign up will be displayed. await page.close(); }) - test('Names with accented characters',async ({page})=>{ + test('TC-RP-08: Names with accented characters',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Ôôerwed', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); //already verified again sign up will be displayed. await page.close(); }) @@ -116,31 +142,48 @@ test.describe('TC_Name',()=>{ test.describe('TC_Email',()=>{ - test('Email with empty space',async ({page})=>{ + test('TC-RP-10: Email with empty space',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', '','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test('Email without @',async ({page})=>{ + test('TC-RP-11: Email without @',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'rabisundaramgmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - - test('Email with numbers only',async ({page})=>{ + test('TC-RP-12: Email without domain',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); - await register.register('Micheal Rabi', '5484564525','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Enter The value in register page + await register.register('Micheal Rabi', 'rabisundaram@.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); @@ -148,114 +191,195 @@ test.describe('TC_Email',()=>{ }) - test('Email with special characters only',async ({page})=>{ + + + test.skip('TC-RP-13: Invalid email format',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); - await register.register('Micheal Rabi', '^&#^*($*$(*%','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Enter The value in register page + await register.register('Micheal Rabi', ' asfg@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - - test('Email without domain',async ({page})=>{ + + + test.skip('TC-RP-14: Invalid email domain',async ({page})=>{ + + //Go to register 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'); + + //Enter The value in register page + await register.register('Micheal Rabi', 'asfg@asfg.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - /* - // functionality doubt - test('Email with Upper case letters',async ({page})=>{ + + + + + + test('TC-RP-15: Email with invalid characters',async ({page})=>{ + + //Go to register 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'); + + //Enter The value in register page + await register.register('Micheal Rabi', 'user!@.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test('Invalid email format',async ({page})=>{ + + test.skip('TC-RP-16: Email with Excessive length',async ({page})=>{ + + //Go to register 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'); + + //Enter The value in register page + await register.register('Micheal Rabi', 'userudgjhbdsayiujhgbkujhgvbvkujyhgdsakhgjvkdjf!@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test('Invalid email domain',async ({page})=>{ + test('TC-RP-17: Email with consecutive dots',async ({page})=>{ + + //Go to register 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'); + + //Enter The value in register page + await register.register('Micheal Rabi', 'manoaravcind...com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) - test('Email with Excessive length',async ({page})=>{ + + + test('TC-RP-19: Email with subdomain ',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); - await register.register('Micheal Rabi', 'userudgjhbdsayiujhgbkujhgvbvkujyhgdsakhgjvkdjf!@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); - const locator = page.locator("//input[@id='oba_signup_emailid']"); - await expect(locator).toBeFocused(); - await expect(locator).toBeVisible(); + + //Enter The value in register page + await register.register('Micheal Rabi', 'example@gmail.example.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Email with special character in local part',async ({page})=>{ + test.skip('TC-RP-20: Email with special character in local part',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) + + test('TC-RP-21: Email with uppercase characters',async ({page})=>{ - */ - - - test('Email with invalid characters',async ({page})=>{ + //Go to register 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'); - const locator = page.locator("//input[@id='oba_signup_emailid']"); - await expect(locator).toBeFocused(); - await expect(locator).toBeVisible(); + + //Enter The value in register page + await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Email with consecutive dots',async ({page})=>{ + + + test('TC-RP-23: Email with special characters only',async ({page})=>{ + + //Go to register 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'); + + //Enter The value in register page + await register.register('Micheal Rabi', '^&#^*($*$(*%','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) + - test('Email with subdomain ',async ({page})=>{ + + // functionality doubt + test.skip('TC-RP-24: Email with Upper case letter',async ({page})=>{ + + //Go to register 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'); - await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); + + //Enter The value in register page + await register.register('Micheal Rabi', 'RABISUNDARAM@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + + //Assertion + const locator = page.locator("//input[@id='oba_signup_emailid']"); + await expect(locator).toBeFocused(); + await expect(locator).toBeVisible(); await page.close(); }) - - test('Email with uppercase characters',async ({page})=>{ + + + test('TC-RP-25: Email with numbers only',async ({page})=>{ + + //Go to register 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'); - await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); + + //Enter The value in register page + await register.register('Micheal Rabi', '5484564525','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion + const locator = page.locator("//input[@id='oba_signup_emailid']"); + await expect(locator).toBeFocused(); + await expect(locator).toBeVisible(); await page.close(); }) + }) @@ -264,92 +388,148 @@ test.describe('TC_Email',()=>{ test.describe('TC_Phone',()=>{ - test('Phone number with 10 numbers',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'); - await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); - await page.close(); - }) - test('Phone number with 10 characters',async ({page})=>{ + test('TC-RP-26: Phone number with 10 characters',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','asdfghjklk','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_phone']"); await expect(locator).toBeFocused(); await page.close(); }) - test('Phone number with Special characters',async ({page})=>{ + test('TC-RP-27: Phone number with Special characters',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','%$%^%^&&*','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_phone']"); await expect(locator).toBeFocused(); await page.close(); }) - test('Phone with Alphabets',async ({page})=>{ + test('TC-RP-28: Phone with Alphabets',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','ASDFGHJK','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_phone']"); await expect(locator).toBeFocused(); await page.close(); }) - test('Phone with 11 numbers',async ({page})=>{ + test('TC-RP-29: Phone with 11 numbers',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','96005200465','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_phone']"); await expect(locator).toBeFocused(); await page.close(); }) - test('Phone with 9 numbers',async ({page})=>{ + test('TC-RP-30: Phone with 9 numbers',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','960052004','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_phone']"); await expect(locator).toBeFocused(); await page.close(); }) - test('Phone with starting with space',async ({page})=>{ + test('TC-RP-31: Phone with starting with space',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com',' 960052004','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_phone']"); await expect(locator).toBeFocused(); await page.close(); }) - test('Phone number empty',async ({page})=>{ + test('TC-RP-32: Phone number empty',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com',' ','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_phone']"); await expect(locator).toBeFocused(); await page.close(); }) - test('Phone with International number',async ({page})=>{ + test('TC-RP-33: Phone with International number',async ({page})=>{ + + //Go to register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter The value in register page await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','123453678798','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_phone']"); await expect(locator).toBeFocused(); await page.close(); }) + + test('TC-RP-36: Phone number with 10 numbers',async ({page})=>{ + + //Go to register Page + const register = new RegisterPage(page); + await register.gotoRegisterPage(); + + //Enter The value in register page + await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); + await page.close(); + }) + }) @@ -359,41 +539,70 @@ test.describe('TC_Phone',()=>{ test.describe('TC_Address',()=>{ - test('Empty address',async ({page})=>{ + test('TC-RP-37: Empty address',async ({page})=>{ + + // Go to Register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter value for Register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + + //Assertion const locator = page.locator("//textarea[@id='oba_signup_address']"); await expect(locator).toBeFocused(); await page.close(); }) -/* Need to check showing error +// Need to check showing error + + test.skip('TC-RP-38: Exccesive length address',async ({page})=>{ - test('Exccesive length address',async ({page})=>{ + // Go to Register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + + //Enter value for Register 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'); + + //Assertion const locator = page.locator("//textarea[@id='oba_signup_address']"); await expect(locator).toBeFocused(); await page.close(); }) - test('Except & all other alphanumeric',async ({page})=>{ + test.skip('TC-RP-39: Except & all other alphanumeric',async ({page})=>{ + + // Go to Register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + + //Enter value for Register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','#$@#^%$#@main road','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//textarea[@id='oba_signup_address']"); await expect(locator).toBeFocused(); await page.close(); }) -*/ - test('Valid Address',async ({page})=>{ + + test('TC-RP-40: Valid Address',async ({page})=>{ + + // Go to Register Page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + + //Enter value for Register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) @@ -405,50 +614,80 @@ test.describe('TC_Address',()=>{ test.describe('TC_Company Name',()=>{ - test('Company name is empty',async ({page})=>{ + test('TC-RP-43: Company name is empty',async ({page})=>{ + + //navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //enter value in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', '', 'SweetMart', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_company_name']"); await expect(locator).toBeFocused(); await page.close(); }) -/* These are accepted so need to check with functinality - test.only('Company name with numbers',async ({page})=>{ +//These are accepted so need to check with functinality + test.skip('TC-RP-44: Company name with numbers',async ({page})=>{ + + //go to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic 12345', 'SweetMart', 'Balurghat'); + + //assertion const locator = page.locator("//input[@id='oba_signup_company_name']"); await expect(locator).toBeFocused(); await page.close(); }) - test.only('Company name with 1000 Alphabets',async ({page})=>{ + test.skip('TC-RP-45: Company name with 1000 Alphabets',async ({page})=>{ + + //go to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'sarhjkfgbdsiugfjksdauygasjbiuadsgbjhsdbauifgadsjhbfuifgj', 'SweetMart', 'Balurghat'); + + //assertion const locator = page.locator("//input[@id='oba_signup_company_name']"); await expect(locator).toBeFocused(); await page.close(); }) - test.only('Company name with special characters symbols',async ({page})=>{ + test.skip('TC-RP-46: Company name with special characters symbols',async ({page})=>{ + + //go to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic@1234', 'SweetMart', 'Balurghat'); + + //assertion const locator = page.locator("//input[@id='oba_signup_company_name']"); await expect(locator).toBeFocused(); await page.close(); }) -*/ - test('Company name with special characters '-' is acceptable',async ({page})=>{ + + test('TC-RP-49: Company name with special characters '-' is acceptable',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram - panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'SweetMart', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) @@ -460,31 +699,55 @@ test.describe('TC_Company Name',()=>{ test.describe('TC_BusinessType',()=>{ - test('SweetMart Selection',async ({page})=>{ + test('TC-RP-50: SweetMart Selection',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'SweetMart', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Fruitmart Selection',async ({page})=>{ + test('TC-RP-51: Fruitmart Selection',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'FruitMart', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Bisleri supply selection',async ({page})=>{ + test('TC-RP-52: Bisleri supply selection',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'BisleriSupply', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) - test('Others Selection',async ({page})=>{ + test('TC-RP-53: Others Selection',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) @@ -495,57 +758,80 @@ test.describe('TC_BusinessType',()=>{ test.describe('TC_Password',()=>{ - test('minimum 8 length password',async ({page})=>{ + test('TC-RP-56: minimum 8 length password',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#123456' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_password']"); await expect(locator).toBeFocused(); await page.close(); await page.close(); }) - /* //password is space, 25 characters, only special characters are accepted. need to check functions - test.only('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'); - const locator = page.locator("//input[@id='oba_signup_password']"); - await expect(locator).toBeFocused(); - await page.close(); - await page.close(); - }) - test.only('Password entered with 25 characters',async ({page})=>{ + test.skip('TC-RP-57: Password entered with 25 characters',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','dsojarlgpojldm905432kjbnk' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_password']"); await expect(locator).toBeFocused(); await page.close(); await page.close(); }) - test.only('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'); - const locator = page.locator("//input[@id='oba_signup_password']"); - await expect(locator).toBeFocused(); - await page.close(); - await page.close(); - }) - */ - test('Password with upper and lower case',async ({page})=>{ + + test('TC-RP-59: Password with upper and lower case',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#ADgrdomi' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); - await page.close(); + + //Assertion + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); + await page.close(); }) - test('Too short Password is not accepted',async ({page})=>{ + + //password is space, 25 characters, only special characters are accepted. need to check functions + test.skip('TC-RP-60: Password with space',async ({page})=>{ + + //Navigate to register page + const register = new RegisterPage(page); + await register.gotoRegisterPage(); + + //Enter values in register + await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#123 456' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); + + //Assertion + const locator = page.locator("//input[@id='oba_signup_password']"); + await expect(locator).toBeFocused(); + await page.close(); + await page.close(); + }) + + test('TC-RP-61: Too short Password is not accepted',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','1' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); + + //Assertion const locator = page.locator("//input[@id='oba_signup_password']"); await expect(locator).toBeFocused(); await page.close(); @@ -553,17 +839,40 @@ test.describe('TC_Password',()=>{ }) }) +test.skip('TC-RP-63: Password with only special character',async ({page})=>{ + + //Navigate to register page + const register = new RegisterPage(page); + await register.gotoRegisterPage(); + + //Enter values in register + await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#%^$%^&&**' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); + + //Assertion + const locator = page.locator("//input[@id='oba_signup_password']"); + await expect(locator).toBeFocused(); + await page.close(); + await page.close(); +}) + + //------------------------------------- TEST CASES FOR City ----------------------------------------------------------------------------- test.describe('TC_City',()=>{ - test('City Selection',async ({page})=>{ + test('TC-RP-55: City Selection',async ({page})=>{ + + //Navigate to register page const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter values in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#1234567A' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat'); - await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); + + //Assertion + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) @@ -575,25 +884,65 @@ test.describe('TC_City',()=>{ //------------------------------------- TEST CASE FOR ALREADY SIGNUP BUTTON ------------------------------------------------------------------------------------------------------------------------------------ - test('Already sign up ', async ({page}) =>{ + test('TC-RP-65: Already sign up ', async ({page}) =>{ + //Navigate to register const register = new RegisterPage(page); await register.alreadySignUpCheck(); - + //Assertion const locator = page.locator("//input[@name='oba_login_emailid']"); await expect(locator).toBeFocused(); }) //------------------------------------ TEST CASE FOR COUNTRY CODE ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - test('India Country code',async ({page})=>{ + test('TC-RP-66: India Country code',async ({page})=>{ + + //Navigate to register const register = new RegisterPage(page); await register.gotoRegisterPage(); + + //Enter value in register await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); await page.close(); }) + + /* -------------------------- TEST CASE FOR VALID DETAILS --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ + + test.describe('GroupWithCorrectDetails',()=>{ + + // Register Link Check + test('TC-RP-68: RegisterLink Check',async ({page})=>{ + + //Go to register page + const register = new RegisterPage(page); + await register.gotoRegisterPage(); + + //Assertion + await expect(await page.locator("//button[@class='btn btn-primary btn-block']")).toBeVisible(); + }) + + + // Register with correct details + test('TC-Rp-67: Register page entering with correct details',async ({page})=>{ + + //Navigate to Register page + const register = new RegisterPage(page); + await register.gotoRegisterPage(); + + //Enter value in register page + await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat'); + + //Assertion + await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); + await page.close(); + }) + }) + \ No newline at end of file diff --git a/tests/RunnerList.spec.js b/tests/RunnerList.spec.js index d0575a2..a52eda3 100644 --- a/tests/RunnerList.spec.js +++ b/tests/RunnerList.spec.js @@ -3,14 +3,21 @@ import { LoginPage } from '../pages/LoginPage'; import { RunnerListPage } from '../pages/RunnerListPage'; - test('RunnerList Button is working?',async ({page})=>{ +test('TC-RP-01: RunnerList Button is working?',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to Runner Page const runner = new RunnerListPage(page); await runner.clickrunnerListButton(); await page.waitForTimeout(5000); + + //Assertions 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 + +}) \ No newline at end of file diff --git a/tests/UserPage.spec.js b/tests/UserPage.spec.js index e17e2a9..a038062 100644 --- a/tests/UserPage.spec.js +++ b/tests/UserPage.spec.js @@ -2,27 +2,63 @@ const {test, expect} =require('@playwright/test') import { LoginPage } from '../pages/LoginPage'; import { UserPage } from '../pages/UserPage'; +//User button is working?(In Regression Suite) +test('TC-UP-01: User Button is working',async ({page})=>{ -test('User Button is working',async ({page})=>{ + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to User Page const user = new UserPage(page); await user.userPageButton(); + await page.waitForTimeout(5000); + + //Assertions await expect(await page.locator("//span[@class='flip-indecator']")).toBeVisible(); }) -test('Active user Button check',async ({page})=>{ + +//Assertions is not done(In Regression Suite) +test.skip('TC-UP-02: Active user Button check',async ({page})=>{ + + //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.loginWithCrtPassword(); + await page.waitForTimeout(5000); + + //Navigate to user page const user = new UserPage(page); await user.activeUserButtonCheck(); + + await page.waitForTimeout(5000); + +}) + + +//Search Button Check(In regression suite) +test('TC-UP-03: Search Button Check',async ({page})=>{ + + //Navigate to Login Page + const login = new LoginPage(page); + await login.gotoLoginPage(); + await login.loginWithCrtPassword(); + + await page.waitForTimeout(5000); + + //Navigate to user page + const user = new UserPage(page); + await user.searchUserValidation('DAYA'); + await page.waitForTimeout(5000); - - //await expect(await page.locator("//span[@class='flip-indecator']")).toBeVisible(); + //Assertion + await expect(await page.locator("//td[normalize-space()='DAYA']")).toBeVisible(); + }) \ No newline at end of file