Browse Source

Updated Commit

OBA_Micheal
Micheal 8 months ago
parent
commit
3459003c7b
10 changed files with 1178 additions and 162 deletions
  1. +1
    -0
      pages/Couponpage.js
  2. +6
    -2
      pages/Feedback.js
  3. +24
    -0
      pages/ProductPage.js
  4. +12
    -1
      pages/RegisterPage.js
  5. +1
    -1
      tests/ContentPage.spec.js
  6. +32
    -5
      tests/Feedback.spec.js
  7. +34
    -34
      tests/LoginPage.spec.js
  8. +521
    -0
      tests/ObaApiTest.spec.js
  9. +272
    -41
      tests/ProductPage.spec.js
  10. +275
    -78
      tests/RegisterPage.spec.js

+ 1
- 0
pages/Couponpage.js View File

@ -10,6 +10,7 @@ class CouponPage {
this.discountType="//select[@id='oba_coupon_discount_type']";
this.minCartAmount="//input[@id='coupon_dicsount_cart_amount']";
this.enterDiscountAmount="//input[@id='coupon_discount']";
this.calenderSelect="//input[@id='valid_from']";
this.validFromDate="//input[@id='valid_from']";
this.validFromMonth="//input[@id='valid_from']";


+ 6
- 2
pages/Feedback.js View File

@ -7,9 +7,13 @@ class Feedback {
this.searchFeedback="//input[@id='oba_feedback_search']";
this.searchButton="//i[@class='fa fa-lg fa-fw fa-search']";
this.feedbackButton="//span[normalize-space()='Feedback']";
this.mailID="//td[normalize-space()='King@gmail.com']";
this.feedbackText="//td[normalize-space()='Trial Version']";
this.name="//td[normalize-space()='kalki']";
this.phone="//td[normalize-space()='919480111111']";
}
async clickContentButton(){
await this.page.locator(this.contentButton).click();
async clickFeedbackButton(){
await this.page.locator(this.feedbackButton).click();
}
}

+ 24
- 0
pages/ProductPage.js View File

@ -23,6 +23,7 @@ class ProductPage {
this.searchBox="//i[@class='fa fa-lg fa-fw fa-search']";
this.editButton="//i[@class='fa fa-lg fa-edit']";
this.saveButton="//button[@class='btn btn-primary btn-block']";
this.deleteButton="//i[@class='fa fa-lg fa-trash']";
this.searchProduct="//input[@id='oba_product_search']";
this.searchButton="//button[@id='oba_product_search_btn']";
}
@ -61,6 +62,29 @@ class ProductPage {
await this.page.locator(this.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Biriyani.jpg");
await this.page.locator(this.saveButton).click();
}
async addProductFunctionalityDelete(productName, productPrize, productQuantity, orderLimitvalue, taxin, shortDescription){
await this.page.locator(this.productsButton).click();
await this.page.locator(this.addProductButton).click();
await this.page.locator(this.productName).fill(productName);
await this.page.locator(this.productPrize).fill(productPrize);
await this.page.locator(this.managedRadioButton).check();
await this.page.locator(this.productQuantityValue).fill(productQuantity);
await this.page.locator(this.orderLimit).fill(orderLimitvalue);
await this.page.locator(this.taxIn).fill(taxin);
await this.page.locator(this.productAvailableCheck).check();
await this.page.locator(this.isLiveCheck).check();
await this.page.locator(this.shortDescription).fill(shortDescription);
await this.page.waitForSelector('.CodeMirror');
await this.page.evaluate(() => {
const codeMirrorElement = document.querySelector('.CodeMirror');
codeMirrorElement.CodeMirror.setValue('Yummy! Delicious Biriyani Taste the Beauty of Kanyakumari');
});
await this.page.locator(this.productImage).click();
await this.page.locator(this.uploadImage).setInputFiles("C:/Automate Testing/OBA Automation/Biriyani.jpg");
await this.page.locator(this.deleteButton).click();
}
async addProductFunctionalityForAll(productName, productPrize, productQuantity, orderLimitvalue, taxin, shortDescription){
await this.page.locator(this.productsButton).click();


+ 12
- 1
pages/RegisterPage.js View File

@ -16,10 +16,21 @@ exports.RegisterPage = class RegisterPage {
this.alreadysignupLink="//a[normalize-space()='Already Sign Up ?']";
}
async gotoRegisterPage(){
await this.page.goto('https://jaicrm1.orderbookings.com/login/');
await this.page.goto('https://dev.orderbookings.com/login/');
await this.page.locator(this.registerHereLink).click();
}
async alreadySignUpCheck(){
await this.page.goto('https://dev.orderbookings.com/login/');
await this.page.locator(this.registerHereLink).click();
await this.page.locator(this.alreadysignupLink).click();
}
async register(name, email, phoneNumber, address, password,phoneCode, companyName, businessType, city){


+ 1
- 1
tests/ContentPage.spec.js View File

@ -13,7 +13,7 @@ test('Content page is opening?',async ({page})=>{
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);


+ 32
- 5
tests/Feedback.spec.js View File

@ -3,14 +3,41 @@ import { LoginPage } from '../pages/LoginPage';
import { Feedback } from '../pages/Feedback';
test('Content page is opening?',async ({page})=>{
test('Feedback page is opening?',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
await page.waitForTimeout(5000);
const content = new ContentPage(page);
await content.clickContentButton();
await expect(await page.locator(content.contentPageValidate)).toBeVisible();
const feedback = new Feedback(page);
await feedback.clickFeedbackButton();
await expect(await page.locator("//label[normalize-space()='Select feedback Type']")).toBeVisible();
// await page.waitForTimeout(3000)
})
test.only('Submit Feedback_API',async ({request,page})=>{
const response = await request.post('https://dev.orderbookings.com/api/merchant/submitFeedback',
{
data:{
"feedback_created_ts": null,
"feedback_from_email": "bigil@gmail.com",
"feedback_text": "sdfasdf4fsdf",
"feedback_updated_ts": null,
"merchantCode": "919480707707",
"feedback_from_name": "Bigil",
"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);
})

+ 34
- 34
tests/LoginPage.spec.js View File

@ -2,105 +2,104 @@ const {test, expect} =require('@playwright/test')
import { LoginPage } from '../pages/LoginPage';
//For Valid Details.
test('Login test with correct credentials',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('xpcv2@rustyload.com','7777777777')
await expect(page).toHaveURL('https://dev.orderbookings.com/merchant/index/index')
// await expect(await page.locator("//p[contains(text(),'Micheal Rabi')]")).toBeVisible();
await 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();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
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();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
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})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('rabisundaatramgmail.com','#12345678A')
await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await 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')
await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await 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})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('rabisundaatram@.com','#12345678A')
await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await 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})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('rabisundaatram@gmail..com','#12345678A')
await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await 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})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('','#12345678A')
// await expect(await page.locator("//p[contains(text(),'Micheal Rabi')]")).toBeVisible();
const locator = page.locator("//input[@name='oba_login_emailid']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
//Empty Password
test('Login test with no password',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('rabisundaram@gmail.com','')
// const msg=await page.locator("//input[@placeholder='Password']").getAttribute("ariaHasPopup");
// console.log(msg);
await page.close();
})
test('Login test with no Email',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('','#12345678A')
//document.querySelector('input').value = 'New Value';
// await page.waitForTimeout(3000)
// await expect(await this.page.getByLabel('rabisundaram@gmail.com')).toBeVisible();
const locator = page.locator("//input[@placeholder='Password']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
//Forgot Password working or not?
test('ForgotPassword',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await page.waitForTimeout(3000)
await login.forgetPasswordLink()
await page.waitForTimeout(3000)
await expect(await page.locator("//button[normalize-space()='RESET']")).toBeVisible();
await expect(await page.locator("//button[normalize-space()='RESET']")).toBeVisible();
})
//Back To Login working?
test('BacktoLogin',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
@ -112,6 +111,7 @@ test('BacktoLogin',async ({page})=>{
await expect(await page.locator("//button[normalize-space()='SIGN IN']")).toBeVisible();
})
//
test('Invalid mail',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();


+ 521
- 0
tests/ObaApiTest.spec.js View File

@ -0,0 +1,521 @@
import { test, expect } from '@playwright/test';
const { chromium } = require('playwright');
import { OrderDetails } from '../../OBAPages/Orderapipage.spec';
import { Appconfig } from '../../OBAPages/AppConfig.spec';
const FormData =require('form-data');
//order sync to get order details using userid and user phone number and mercchant id.
test ('OrderSync of completed orders',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_USER')
const res=await response.json();
let OrderedBy = res.data[0].ordered_by_name; //you will get user from this.
let Orderstatus = res.data[0].order_status; //order status i will get from response
const orderdetail = new OrderDetails(page);
await orderdetail.navigateToOrderDetails();
const result= await orderdetail.searchOrder(Orderstatus,OrderedBy);
const username = result.OrderId;
const userid =result.OrderId;
const useremail = result.OrderId;
const userphone = result.OrderId;
const userorderitems = result.Order_items;
const userorderstatus = result.OrderStatusis;
let ordercost = result.Order_cost;
let orderqty = result.Order_qty;
expect.soft(userid).toContain(res.data[0].id); //id
expect.soft(username).toContain(res.data[0].ordered_by_name); //name
expect.soft(useremail).toContain(res.data[0].ordered_by_email); //email
expect.soft(userphone).toContain(res.data[0].ordered_by_phone); //phone
expect.soft(userorderitems).toContain((res.data[0].ordered_items[0]).toString()); //order items
expect.soft(ordercost).toContain((res.data[0].order_cost).toString()); //order cost
expect.soft(orderqty).toContain((res.data[0].ordered_items_qty[0]).toString()); // order qty
expect.soft(userorderstatus).toContain(res.data[0].order_status); // order status is complete
await page.close();
})
//C:\PlayWright\tests\navigatetomen.spec.js
//unable to automate becasue its contains bug in the orderitems,order qty,order item price.
//locator finds two locators when we run the automated testcode.
test.skip('OrderSync for Pending ',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_USER')
const res=await response.json();
const orderdetail = new OrderDetails(page);
await orderdetail.navigateToOrderDetails();
const result= await orderdetail.searchOrder('ORDER_STATUS_CANCELLED','Shubya');
const username = result.OrderId;
const userid =result.OrderId;
const useremail = result.OrderId;
const userphone = result.OrderId;
const userorderitems = result.Order_items;
const userorderstatus = result.OrderStatusis;
let ordercost = result.Order_cost;
let orderqty = result.Order_qty;
expect.soft(userid).toContain(res.data[1].id); //id
expect.soft(username).toContain(res.data[1].ordered_by_name); //name
expect.soft(useremail).toContain(res.data[1].ordered_by_email); //email
expect.soft(userphone).toContain(res.data[1].ordered_by_phone); //phone
expect.soft(userorderitems).toContain((res.data[1].ordered_items[1]).toString()); //order items
expect.soft(ordercost).toContain((res.data[1].order_cost).toString()); //order cost
expect.soft(orderqty).toContain((res.data[1].ordered_items_qty[1]).toString()); // order qty
expect.soft(userorderstatus).toContain(res.data[1].order_status); // order status is complete
await page.close();
})
test('GetUserDetails',async({request,page})=>{
const response = await request.get('https://dev.orderbookings.com/api/user/userreg?phone=919480111222&merchantCode=919480707707')
const res=await response.json();
const orderdetail = new OrderDetails(page);
await orderdetail.navigateTouser();
const result = await orderdetail.searchUserDetails('Shubya');
const userDetails = result.userDetails;
const merchantid = result.merchantid;
const userstatus = result.isActive;
expect.soft(userDetails).toContain(res.data.name);
expect.soft(userDetails).toContain(res.data.email);
expect.soft(userDetails).toContain(res.data.phone);
expect.soft(merchantid).toContain(res.data.merchantCode);
expect.soft(userDetails).toContain(res.data.area[0]);
expect.soft(userDetails).toContain(res.data.multiple_address_list[0].addressLine1);
expect.soft((userstatus).toString()).toContain((res.data.is_user_active).toString());
await page.close();
})
let useraddressid; // USER ADDRESS ID
test('Get Delete Post Patch Address of User',async({request,page})=>{
const response = await request.get('https://dev.orderbookings.com/api/user/addresslist?user_id=670766e4272db54e96e423e0')
const res=await response.json();
await console.log('GET ADDRESS OF USER');
await console.log(res);
const userdetail = new OrderDetails(page);
await userdetail.navigateTouser();
const result = await userdetail.updateUserAddress('Shubya');
await page.reload();
const user_Address_updated = result.user_Address_updated;
const user_area_updated =result.user_area_updated;
expect.soft(user_Address_updated).toContain((res.data[0].addressLine1).toString());
expect.soft(user_Address_updated).toContain((res.data[0].addressLine2).toString());
expect.soft(user_Address_updated).toContain((res.data[0].postalCode).toString());
expect.soft(user_area_updated).toContain(res.data[0].area);
const responseofdelete = await request.delete('https://dev.orderbookings.com/api/user/deleteaddress', {
data: {
"user_id": "670766e4272db54e96e423e0",
"address_id": "67076a2d272db54e96e423e8"
}
})
await console.log('DELETE ADDRESS OF USER');
await console.log(responseofdelete.json);
const response1 = await request.post('https://dev.orderbookings.com/api/user/addnewaddress', {
data: {
"addressLine1": "Adding address through the code1",
"addressLine2": "api is my home",
"city": "",
"stateOrProvince": "",
"postalCode": "123456",
"phone": "917777777777",
"deliveryInstructions": null,
"isDefault": true,
"user_id": "670766e4272db54e96e423e0",
"title": "Api test address1",
"area": "Mumbai"
}
})
const res1 = await response1.json();
useraddressid = res1.data.id;
await console.log(useraddressid);
await console.log('ADDED NEW ADDRESS OF USER');
await console.log(res1);
await page.reload();
const result1 = await userdetail.updateUserAddress('Shubya');
const user_Address_updated1 = result1.user_Address_updated;
const user_area_updated1 =result1.user_area_updated;
expect.soft(user_Address_updated1).toContain(res1.data.addressLine1);
expect.soft(user_Address_updated1).toContain((res1.data.addressLine2).toString());
expect.soft(user_Address_updated1).toContain((res1.data.postalCode).toString());
expect.soft(user_area_updated1).toContain(res1.data.area);
const response2 = await request.patch('https://dev.orderbookings.com/api/user/updateaddress', {
data: {
"addressLine1": "Update address through api request from code",
"addressLine2": "api",
"city": "Bijapur",
"stateOrProvince": "Goa",
"postalCode": "555555",
"phone": "919999999999",
"deliveryInstructions": null,
"isDefault": true,
"title": "test thought patch method address",
"area": "Mumbai",
"address_id": useraddressid
}
})
const res2 = await response2.json();
await console.log('UPDATED ADDRESS OF USER');
await console.log(res2);
const result2 = await userdetail.updateUserAddress('Shubya');
const user_Address_updated2 = result2.user_Address_updated;
const user_area_updated2 =result2.user_area_updated;
//await page.reload();
expect.soft(user_Address_updated2).toContain((res2.data.addressLine1).toString());
expect.soft(user_Address_updated2).toContain((res2.data.addressLine2).toString());
expect.soft(user_Address_updated2).toContain((res2.data.postalCode).toString());
expect.soft(user_area_updated2).toContain(res1.data.area);
await page.close();
})
//get order by order id and compare with web ui in the order list.
test('GET ORDER BY ORDER_ID',async ({request,page})=>{
let Orderstatus;
let OrderedBy;
const response1 = await request.get('https://dev.orderbookings.com/api/order/getorder/67076a2f272db54e96e423e9', {
data: {
"order_id": "6710b588b03c253fa86cf9cb",
"note": "note added again"
}
})
const res = await response1.json();
OrderedBy = res.data.ordered_by_name;
Orderstatus = res.data.order_status;
const orderdetail = new OrderDetails(page);
await orderdetail.navigateToOrderDetails();
const result= await orderdetail.searchOrder(Orderstatus,OrderedBy);
const username = result.OrderId;
const userid =result.OrderId;
const useremail = result.OrderId;
const userphone = result.OrderId;
const userorderitems = result.Order_items;
const userorderstatus = result.OrderStatusis;
let ordercost = result.Order_cost;
let orderqty = result.Order_qty;
expect.soft(userid).toContain(res.data.id); //id
expect.soft(username).toContain(res.data.ordered_by_name); //name
expect.soft(useremail).toContain(res.data.ordered_by_email); //email
expect.soft(userphone).toContain(res.data.ordered_by_phone); //phone
expect.soft(userorderitems).toContain((res.data.ordered_items[0]).toString()); //order items
expect.soft(ordercost).toContain((res.data.order_cost).toString()); //order cost
expect.soft(orderqty).toContain((res.data.ordered_items_qty[0]).toString()); // order qty
expect.soft(userorderstatus).toContain(res.data.order_status); // order status is complete
await page.close();
})
//app configuration details are compared with api response.
test('GET APP Config Details',async ({request,page})=>{
const response = await request.get('https://dev.orderbookings.com/api/config/919480707707?merchantCode=919480707707')
const res = await response.json();
const orderdetail = new OrderDetails(page);
await orderdetail.NavigatetoAppconfig();
await page.reload();
const appconfig = new Appconfig(page);
const app = await appconfig.GetAppConfigDetailsforApiRequest(); ////Currency,soundloop,canceltime,mincartvalue,deliletycharge,Actioncall,selecttype,Area
let currency = app.selectedCurrency;
let soundloop = app.soundloop;
let canceltime = app.canceltime;
let mincartvalue = app.mincartvalue;
let delivarycharge = app.delivarycharge;
let actioncall = app.Actioncall;
let selecttype = app.selectedtype;
let area = app.Area;
let MerachantCode = app.Merchantcode;
let profileDetails = app.ProfileDetails;
expect.soft(currency).toContain(res.data.currency_code); //currency
expect.soft(soundloop).toContain((res.data.notification_sound_loop).toString()); //soundloop
expect.soft(canceltime).toContain((res.data.cancellation_till).toString()); //canceltime
expect.soft(mincartvalue).toContain((res.data.minimum_cart_price).toString()); //mincartvalue
expect.soft(delivarycharge).toContain((res.data.delivery_charge).toString()); //delivarycharge
expect.soft(actioncall).toContain(res.data.call_to_action); //actioncall
expect.soft(selecttype).toContain(res.data.area_type);
expect.soft(MerachantCode).toContain(res.data.merchantCode); //merchant code
expect.soft(profileDetails).toContain(res.data.merchant_details.name); //Company Name
expect.soft(profileDetails).toContain(res.data.merchant_details.email); //Merchant Email
await page.close();
//expect.soft(area).toContain(res.data.area); //area
})
//unable to automate bcoz of the formdata cant be sent properly and unable to handle table data to comparre with response.
//place order -- complete order
//place order --- cancel order
//Place order using api request
let Orderstatus;
let OrderedBy;
let OrderId;
test('Place Order', async ({ request, page }) => {
const formData = new FormData();
const jsondata = {
"order_id": "",
"amount_received": 0,
"order_status": "ORDER_STATUS_PENDING",
"ordered_by_phone": "919480111222",
"ordered_by_user_id": "670766e4272db54e96e423e0",
"order_cost": 748,
"order_tax": 748,
"order_gross_amount": 1496,
"ordered_items": [
"Jeans Pant",
"T-Shirt"
],
"ordered_items_sku": [
"jeans_pant",
"t-shirt_"
],
"ordered_items_qty": [
1,
2
],
"ordered_items_tax": [
4,
9
],
"ordered_items_price": [
0,
0
],
"merchantCode": "919480707707",
"order_validation_pin": 254034,
"note": "",
"ordered_items_notes": [],
"images_arraylist": [],
"image_latitude": 0,
"image_longitude": 0,
"use_amount_from_wallet": false,
"service_request_date": 1729137865273,
"order_rating": 0,
"order_is_approved": true,
"ordered_items_audio": [],
"logs": [],
"ordered_by_name": "Shubya",
"ordered_by_email": "Shubya111@gmail.com",
"ordered_by_area": [
"Mumbai"
],
"order_time": "40860000",
"order_last_updated_on": "",
"order_complete_time": "",
"order_cancel_time": "",
"order_assigned_to": "",
"ordered_delivered_by": "",
"order_payment_received": false,
"order_has_audio_file": false,
"order_has_admin_audio_file": false,
"order_has_image_file": false,
"ordered_by_address": "67079c7b272db54e96e423f4",
"invoiceid": "",
"amount_from_wallet": 0,
"coupon": "",
"cart": [
{
"id": "670767d0272db54e96e423e4",
"available": true,
"sku": "jeans_pant",
"name": "Jeans Pant",
"description": "M.S.Dhoni Special Edition Jeans Pant.",
"quantity": 1,
"price": 300,
"image": "",
"tax_in_percent": 4,
"total": 312,
"actual": 312,
"order_limit": 100,
"short_description": "M.S.Dhoni Special Edition Jeans Pant.",
"is_live": true
},
{
"id": "67076794272db54e96e423e3",
"available": true,
"sku": "t-shirt_",
"name": "T-Shirt",
"description": "M.S.Dhoni Special Edition T-Shirts.",
"quantity": 2,
"price": 200,
"image": "",
"tax_in_percent": 9,
"total": 436,
"actual": 218,
"order_limit": 100,
"short_description": "M.S.Dhoni Special Edition T-Shirts.",
"is_live": true
}
],
"cart_total_amount": 748,
"coupon_applied": false,
"products": [],
"total_saving": 0
};
// Append JSON data as string to formData
formData.append('order_req', JSON.stringify(jsondata));
// Send POST request with headers and formData
const response = await request.post('https://dev.orderbookings.com/api/order/placeorder', {
headers: {
'Content-Type': 'multipart/form-data; boundary=<calculated when request is sent>'
},
body: formData
});
const res = await response.json();
console.log(res);
});
// OrderedBy = res.data.ordered_by_name; //you will get user from this.
// Orderstatus = res.data.order_status; //order status i will get from response
// OrderId = res.data.order_id; // you will get order id
// const orderdetail = new OrderDetails(page);
// await orderdetail.navigateToOrderDetails(); //navigate to order list
// await orderdetail.toFindOrders(Orderstatus,OrderedBy); //calling method to find order by status and user
// const tableValues = await orderdetail.getTablevalues(OrderId); // calling method to get table values
// const flattenedValues = tableValues.flat();
// expect(flattenedValues.some(value => value.includes(OrderId))).toBe(true);
// await page.close();
//table values compare with the order id and trying to fetch the the data of that order from order list.
test('get values of table',async({page})=>{
const userdetail = new OrderDetails(page);
await userdetail.navigateToOrderDetails();
await userdetail.toFindOrders();
const tableValues = await userdetail.getTablevalues('670f55a814f563f755f3e2a9');
const flattenedValues = tableValues.flat();
expect(flattenedValues.some(value => value.includes('670f55a814f563f755f3e2a9'))).toBe(true);
console.log(flattenedValues);
})
//cancel order is api request to check whether the order is cancelled or not through the api request and compare with the web ui.
test('cancel Order',async({request,page})=>{
let Orderstatus;
let OrderedBy;
let Orderphone;
const response1 = await request.post('https://dev.orderbookings.com//api/order/cancelorder', {
data: {
"order_id":"6710bac8b03c253fa86cf9cd"
}
})
const res = response1.json();
await console.log(res);
OrderedBy = res.data.ordered_by_name;
Orderstatus = res.data.order_status;
Orderphone = res.data.ordered_by_phone;
const orderdetail = new OrderDetails(page);
await orderdetail.navigateToOrderDetails();
await orderdetail.toFindOrders(Orderstatus,OrderedBy); //calling method to find order by status and user
const tableValues = await orderdetail.getTablevalues(Orderphone); // calling method to get table values
const flattenedValues = tableValues.flat();
expect(flattenedValues.some(value => value.includes(Orderphone))).toBe(true);
await page.close();
} )
//category and products are unable to fetch from the api request and unable to compare with the web ui.
//from tree unable to click mens and women category and unable to fetch the products from the api request and unable to compare with the web ui
//
test('Category and Products', async ({ request,page }) => {
const catdetails = new OrderDetails(page);
await catdetails.NavigatetoCatlog();
// await page.reload();
let Category1 = await catdetails.NavigatetoMens();
let Name1 = await Category1.catnames;
let catlogViewType1 = await Category1.selecteddcattype;
let Productviewtype1 = await Category1.selecctedprodtype;
let Catislive1 = await Category1.isActive;
let merchantid = await Category1.merchatcode;
// const Catproducts1 = await Category1.Productsincluded;
//await console.log(Catproducts1);
//api request
const response = await request.get('https://dev.orderbookings.com/api/bud/919480707707');
const res = await response.json();
// await console.log(res);
let cat1 =res.data.buds[1].name;
let catlog1ViewType1 =res.data.buds[1].childview;
let cat1Productviewtype =res.data.buds[1].product_childview;
let cat1islive = res.data.buds[1].is_live;
let merchantcode =res.data.buds[1].merchantCode;
var cat2 = res.data.buds[2].name; //womens
var cat3 = res.data.buds[3].name; //kids
expect.soft(Name1).toEqual(cat1);
expect.soft(merchantid).toEqual(merchantcode)
expect.soft(catlogViewType1).toEqual(catlog1ViewType1);
expect.soft(Productviewtype1).toEqual(cat1Productviewtype);
expect.soft(Catislive1).toEqual(cat1islive);
//expect.soft(Catproducts1).toContain();
let Category2 = await catdetails.NavigatetoWomens();
const Name2 = await Category2.catnames;
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;
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 catdetails.NavigatetoKids();
const Name3 = await Category3.catnames;
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;
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);
//expect.soft(Catproducts3).toContain(res.data.buds[3].products);
})

+ 272
- 41
tests/ProductPage.spec.js View File

@ -3,6 +3,7 @@ import { LoginPage } from '../pages/LoginPage';
import { ProductPage } from '../pages/ProductPage';
test.describe('Product Name Test Cases',()=>{
test('Product button',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
@ -41,8 +42,10 @@ test('Product Name is Empty',async ({page})=>{
const product = new ProductPage(page);
await product.addProductFunctionality('', '250', '10', '5', '20','KK Biriyani');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible();
//Empty Name (Please fill out this field) need to locate.
const locator = page.locator("//input[@id='oba_product_name']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
test('Product Name starts with space',async ({page})=>{
const login = new LoginPage(page);
@ -50,10 +53,14 @@ test('Product Name starts with space',async ({page})=>{
await login.loginWithCrtPassword();
await page.waitForTimeout(5000);
const product = new ProductPage(page);
await product.addProductFunctionality(' Biriyani', '250', '10', '5', '20','KK Biriyani');
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);
// await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible();
//Name with space is accepted i.e space button is not working.
await expect(page.locator("//td[normalize-space()='Biriyani']")).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();
})
test('Enter Number instead of name',async ({page})=>{
const login = new LoginPage(page);
@ -61,10 +68,14 @@ test('Enter Number instead of name',async ({page})=>{
await login.loginWithCrtPassword();
await page.waitForTimeout(5000);
const product = new ProductPage(page);
await product.addProductFunctionality('96152456321', '250', '10', '5', '20','KK Biriyani');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible();
//Name with space is accepted i.e space button is not working.
await product.addProductFunctionality('96152456321', '250', '10', '5', '20','KK Biriyani'); //Name with space is accepted i.e space button is not working.
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='96152456321']")).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();
})
test('Enter 50 Alphabet ',async ({page})=>{
const login = new LoginPage(page);
@ -72,10 +83,14 @@ test('Enter 50 Alphabet ',async ({page})=>{
await login.loginWithCrtPassword();
await page.waitForTimeout(5000);
const product = new ProductPage(page);
await product.addProductFunctionality('asdfghjklzmxncbvqwertyuioplkjhgfdsazxcvbnmqwertyui', '250', '10', '5', '20','KK Biriyani');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible();
//Name with space is accepted i.e space button is not working.
await product.addProductFunctionality('asdfghjklzmxncbvqwertyuioplkjhgfdsazxcvbnmqwertyui', '250', '10', '5', '20','KK Biriyani');//Name with space is accepted i.e space button is not working.
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='asdfghjklzmxncbvqwertyuioplkjhgfdsazxcvbnmqwertyui']")).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();
})
test('Enter Special Characters and symbol ',async ({page})=>{
const login = new LoginPage(page);
@ -85,8 +100,11 @@ test('Enter Special Characters and symbol ',async ({page})=>{
const product = new ProductPage(page);
await product.addProductFunctionality('#4nskiu*()', '250', '10', '5', '20','KK Biriyani');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Biriyani']")).toBeVisible();
//Name with space is accepted i.e space button is not working.
await expect(page.locator("//td[normalize-space()='#4nskiu*()']")).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();
})
test('Product Name with Alphabet',async ({page})=>{
@ -98,6 +116,10 @@ test('Product Name with Alphabet',async ({page})=>{
await product.addProductFunctionality('Biriyani', '250', '10', '5', '20','KK Biriyani');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='Biriyani']")).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();
})
test('Product Name with space',async ({page})=>{
const login = new LoginPage(page);
@ -108,6 +130,10 @@ test('Product Name with space',async ({page})=>{
await product.addProductFunctionalityForAll('Butter Naan', '30', '10', '5', '20','Tasty Butter Naan');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='Butter Naan']")).toBeVisible();
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();
})
test('Product Name with special character',async ({page})=>{
const login = new LoginPage(page);
@ -118,10 +144,19 @@ test('Product Name with special character',async ({page})=>{
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '50', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
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();
})
})
test.describe('Product Price Test Cases',()=>{
test('Empty product prize',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
@ -130,9 +165,14 @@ test.describe('Product Price Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
const locator = page.locator("//input[@id='oba_product_price']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
test('Product prize entered other than numeric value',async ({page})=>{
test.skip('Product prize entered other than numeric value',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -151,9 +191,13 @@ test.describe('Product Price Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai','-40', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
const locator = page.locator("//input[@id='oba_product_price']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
test('Product prize entered with Special Characters',async ({page})=>{
test.skip('Product prize entered with Special Characters',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -172,6 +216,10 @@ test('Valid Product prize',async ({page})=>{
await product.addProductFunctionalityForAll('Idli Chutney & Vadai','50', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//b[normalize-space()='50']")).toBeVisible();
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();
})
test('Product prize in decimal value',async ({page})=>{
const login = new LoginPage(page);
@ -182,9 +230,13 @@ test('Product prize in decimal value',async ({page})=>{
await product.addProductFunctionalityForAll('Vadai','12.27', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//b[normalize-space()='12.27']")).toBeVisible();
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();
})
test('Valid Product prize',async ({page})=>{
test('Product prize',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -193,7 +245,12 @@ test('Product prize in decimal value',async ({page})=>{
await product.addProductFunctionalityForAll('Idli Chutney & Vadai','50', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//b[normalize-space()='50']")).toBeVisible();
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();
})
test('Currency Symbol',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
@ -203,6 +260,7 @@ test('Currency Symbol',async ({page})=>{
await product.clickAddProductButton();
await page.waitForTimeout(5000);
await expect(page.locator("//span[@class='input-group-text']")).toBeVisible();
await page.close();
})
test('merchant verify price leading with zero',async ({page})=>{
@ -214,6 +272,10 @@ test('merchant verify price leading with zero',async ({page})=>{
await product.addProductFunctionalityForAll('Vadai','1209.06', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//b[normalize-space()='12,09.06']")).toBeVisible();
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();
})
test('merchant verify maximum length allowed',async ({page})=>{
const login = new LoginPage(page);
@ -224,6 +286,10 @@ test('merchant verify maximum length allowed',async ({page})=>{
await product.addProductFunctionalityForAll('Vadai','12095262', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//b[normalize-space()='12095262']")).toBeVisible();
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();
})
test('merchant enters prize zero allowed',async ({page})=>{
const login = new LoginPage(page);
@ -234,11 +300,17 @@ test('merchant enters prize zero allowed',async ({page})=>{
await product.addProductFunctionalityForAll('Vadai','0', '10', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//b[normalize-space()='0']")).toBeVisible();
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();
})
})
test.describe('Quantity Limit Test Cases',()=>{
test('Managed Radio button Check',async ({page})=>{
test('Managed Radio button Check',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -246,7 +318,11 @@ test.describe('Quantity Limit Test Cases',()=>{
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();
await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).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();
})
test('Empty quantity',async ({page})=>{
const login = new LoginPage(page);
@ -256,9 +332,12 @@ test.describe('Quantity Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
const locator = page.locator("//input[@id='oba_product_quantity']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
test('Enter other than number',async ({page})=>{
test.skip('Enter other than number',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -268,6 +347,7 @@ test.describe('Quantity Limit Test Cases',()=>{
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
})
test('merchant enters negative product quantity',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
@ -276,9 +356,12 @@ test.describe('Quantity Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '-30', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
const locator = page.locator("//input[@id='oba_product_quantity']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
test('merchant enters special characters in product quantity',async ({page})=>{
test.skip('merchant enters special characters in product quantity',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -297,6 +380,11 @@ test.describe('Quantity Limit Test Cases',()=>{
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '5', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='5']")).toBeVisible();
await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).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();
})
test('merchant enters decimal quantity',async ({page})=>{
@ -307,7 +395,11 @@ test.describe('Quantity Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '50.5', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
const locator = page.locator("//input[@id='oba_product_quantity']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
test('merchant enters zero',async ({page})=>{
@ -319,10 +411,15 @@ test.describe('Quantity Limit Test Cases',()=>{
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '0', '5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='0']")).toBeVisible();
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();
})
})
test.describe('Unmanaged Button',()=>{
test('UnManaged Radio Button working',async ({page})=>{
test('UnManaged Radio Button working',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -332,9 +429,16 @@ test('UnManaged Radio Button working',async ({page})=>{
await page.waitForTimeout(5000);
//await expect(page.locator("//td[normalize-space()='Tandoori']")).toBeVisible();
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();
})
})
test.describe('Order Limit Test Cases',()=>{
test('Empty order',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
@ -343,7 +447,10 @@ test.describe('Order Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '', '20','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
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})=>{
const login = new LoginPage(page);
@ -353,9 +460,13 @@ test.describe('Order Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', ' 6', '20','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
await expect(await page.locator("//td[normalize-space()='10']")).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();
})
test('Enter character other than numeric value',async ({page})=>{
test.skip('Enter character other than numeric value',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -363,6 +474,7 @@ test.describe('Order Limit Test Cases',()=>{
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})=>{
@ -373,9 +485,13 @@ test.describe('Order Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '-52', '20','Idli is Tasty');
await page.waitForTimeout(5000);
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('Special characters in order limit',async ({page})=>{
test.skip('Special characters in order limit',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -393,6 +509,10 @@ test.describe('Order Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '100.5', '20','Idli is Tasty');
await page.waitForTimeout(5000);
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})=>{
@ -403,6 +523,11 @@ test.describe('Order Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '050', '20','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(await page.locator("//td[normalize-space()='50']")).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 expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
})
test('Maximum order limit',async ({page})=>{
@ -413,7 +538,11 @@ test.describe('Order Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '050', '20','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
await expect(await page.locator("//td[normalize-space()='50']")).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();
})
test('Zero order limit',async ({page})=>{
const login = new LoginPage(page);
@ -423,12 +552,16 @@ test.describe('Order Limit Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '0', '20','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
const locator = page.locator("//input[@id='oba_product_order_limit']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
})
test.describe('Product Description',()=>{
test('Empty order',async ({page})=>{
test.skip('Empty order',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -441,7 +574,9 @@ test.describe('Product Description',()=>{
})
test.describe('Tax in % Test Cases',()=>{
test('Enter special character',async ({page})=>{
test.skip('Enter special character',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -451,7 +586,7 @@ test.describe('Tax in % Test Cases',()=>{
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
})
test('Enter Alphabet',async ({page})=>{
test.skip('Enter Alphabet',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -461,7 +596,7 @@ test.describe('Tax in % Test Cases',()=>{
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
})
test('Enter space at the start of the word',async ({page})=>{
test.skip('Enter space at the start of the word',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
@ -489,6 +624,10 @@ test.describe('Tax in % Test Cases',()=>{
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']");
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})=>{
@ -500,6 +639,10 @@ test.describe('Tax in % Test Cases',()=>{
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '055','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
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();
})
test('Enter Tax% is maximum 100',async ({page})=>{
const login = new LoginPage(page);
@ -510,6 +653,11 @@ test.describe('Tax in % Test Cases',()=>{
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '100','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
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();
})
test('Enter Tax% is maximum 110',async ({page})=>{
const login = new LoginPage(page);
@ -519,7 +667,12 @@ test.describe('Tax in % Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '110','Idli is Tasty');
await page.waitForTimeout(5000);
// await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).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();
})
test('Enter Tax% in negative value',async ({page})=>{
const login = new LoginPage(page);
@ -529,6 +682,10 @@ test.describe('Tax in % Test Cases',()=>{
const product = new ProductPage(page);
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '-10','Idli is Tasty');
await page.waitForTimeout(5000);
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})=>{
@ -540,11 +697,18 @@ test.describe('Tax in % Test Cases',()=>{
await product.addProductFunctionalityForAll('Idli Chutney & Vadai', '20', '10', '10', '11.23','Idli is Tasty');
await page.waitForTimeout(5000);
await expect(page.locator("//td[normalize-space()='Idli Chutney & Vadai']")).toBeVisible();
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();
})
})
test.describe('Product Live CheckBox',()=>{
test('Available and not available checkbox',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
@ -560,8 +724,76 @@ test.describe('Product Live CheckBox',()=>{
})
})
/*
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('Yes 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 page.locator("//button[normalize-space()='Yes, delete it!']").click();
// 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);
const product = new ProductPage(page);
await product.clickAddProductButton();
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();
})
})
test.describe('Product Live CheckBox',()=>{
test('available checkbox',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
@ -628,4 +860,3 @@ test('Product Page6',async ({page})=>{
console.log(value);
await expect(page.locator("//td[normalize-space()='Biriyani']")).toContainText('Biriyani');
})
*/

+ 275
- 78
tests/RegisterPage.spec.js View File

@ -1,46 +1,63 @@
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();
//console.log('RegisterLink is working');
})
test('Register page entering with correvt details',async ({page})=>{
// 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');
//console.log('Successfully Registered');
// console.log('Email is registered successfully and mail is sent');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
})
/* ---------------------------------------------------TEST CASES FOR NAME--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
test.describe('TC_Name',()=>{
test('Name with empty space is entered',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Name is empty it should get error');
const locator = page.locator("//input[@id='oba_signup_username']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
/*
//Numbers are accepted as name
test('Instead of names, Numbers is entered',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('52658954623', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Number is entered it should get error');
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('dhjdgabjfbdiuafhdkjbaiughjfkshloadfishjkfglik', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('50 Characters is entered it should get error');
const locator = page.locator("//input[@id='oba_signup_username']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
@ -48,49 +65,64 @@ test.describe('TC_Name',()=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('^%$#%$^&*&', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Special Characters is entered it should get error');
const locator = page.locator("//input[@id='oba_signup_username']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
*/
test('Name with Alphabet',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Mano', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Alphabets are acceptable');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Mano Aravind', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Names with Space are acceptable');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Mano_Aravind', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Names with Special character are acceptable');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Ôôerwed', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Names with accented characters are acceptable');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible(); //already verified again sign up will be displayed.
await page.close();
})
})
/* ---------------------------------------------------TEST CASES FOR EMAIL ID--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
test.describe('TC_Email',()=>{
test('Email with empty space',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', '','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Email is empty it should get error');
const locator = page.locator("//input[@id='oba_signup_emailid']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
@ -98,23 +130,62 @@ test.describe('TC_Email',()=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaramgmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Email without @ symbol it should get error');
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', '5484564525','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();
await page.close();
})
test('Email with special characters only',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', '^&#^*($*$(*%','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Email without domain it should get error');
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})=>{
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');
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', ' asfg@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Invalid email format it should get error');
const locator = page.locator("//input[@id='oba_signup_emailid']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
@ -122,69 +193,92 @@ test.describe('TC_Email',()=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'asfg@asfg.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Invalid email domain it should get error');
const locator = page.locator("//input[@id='oba_signup_emailid']");
await expect(locator).toBeFocused();
await expect(locator).toBeVisible();
await page.close();
})
test('Email with invalid characters',async ({page})=>{
test('Email with Excessive length',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'user!@.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Email with invalid characters it should get error');
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();
await page.close();
})
test('Email with Excessive length',async ({page})=>{
test('Email with special character in local part',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'userudgjhbdsayiujhgbkujhgvbvkujyhgdsakhgjvkdjf!@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Email with Excessive length it should get error');
await register.register('Micheal Rabi', '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('Email with consecutive dots',async ({page})=>{
*/
test('Email with invalid characters',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'manoaravcind...com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Email with consecutive dots it should get error');
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();
await page.close();
})
test('Email with subdomain ',async ({page})=>{
test('Email with consecutive dots',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'example@gmail.example.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Email with subdomain is accepted');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await register.register('Micheal Rabi', 'manoaravcind...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();
await page.close();
})
test('Email with special character in local part',async ({page})=>{
test('Email with subdomain ',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Email with special character in local part is accepted');
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();
await page.close();
})
test('Email with uppercase characters',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','9600520046','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Email with uppercase characters is accepted');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
})
//-------------------------------------------------TEST CASE FOR PHONE FIELD----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
test.describe('TC_Phone',()=>{
test('Phone number with 10 characters',async ({page})=>{
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');
// console.log('10 characters is not accepted');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
test('Phone number with 10 characters',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','asdfghjklk','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('10 characters is not accepted');
const locator = page.locator("//input[@id='oba_signup_phone']");
await expect(locator).toBeFocused();
await page.close();
})
@ -192,129 +286,184 @@ test.describe('TC_Phone',()=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','%$%^%^&&*','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Special characters is not accepted');
const locator = page.locator("//input[@id='oba_signup_phone']");
await expect(locator).toBeFocused();
await page.close();
})
test('Phone with Alphabets',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','ASDFGHJK','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Alphabets is not accepted');
const locator = page.locator("//input[@id='oba_signup_phone']");
await expect(locator).toBeFocused();
await page.close();
})
test('Phone with 11 numbers',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','96005200465','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('11 numbers is not accepted');
const locator = page.locator("//input[@id='oba_signup_phone']");
await expect(locator).toBeFocused();
await page.close();
})
test('Phone with 9 numbers',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','960052004','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('9 numbers is not accepted');
const locator = page.locator("//input[@id='oba_signup_phone']");
await expect(locator).toBeFocused();
await page.close();
})
test('Phone with starting with space',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com',' 960052004','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('space at the start of the number is not accepted');
const locator = page.locator("//input[@id='oba_signup_phone']");
await expect(locator).toBeFocused();
await page.close();
})
test('Phone number empty',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com',' ','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('blank number is not accepted');
const locator = page.locator("//input[@id='oba_signup_phone']");
await expect(locator).toBeFocused();
await page.close();
})
test('Phone with International number',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'akshay.vasav@gmail.com','123453678798','Thalavaipuram panagudi','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('International number is not accepted');
const locator = page.locator("//input[@id='oba_signup_phone']");
await expect(locator).toBeFocused();
await page.close();
})
})
//--------------------------------- TEST CASE FOR ADDRESS FIELD --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test.describe('TC_Address',()=>{
test('Empty address',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Empty address is not accepted');
const locator = page.locator("//textarea[@id='oba_signup_address']");
await expect(locator).toBeFocused();
await page.close();
})
/* Need to check showing error
test('Exccesive length address',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Main road thalavai panagudim nindia tamil nadu england ntirunelveli gwhsjdas8iukjgbiu7gk uifygh8idhb','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
// console.log('Exccesive length address is not accepted');
const locator = page.locator("//textarea[@id='oba_signup_address']");
await expect(locator).toBeFocused();
await page.close();
})
test('Except & all other alphanumeric',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','#$@#^%$#@main road','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Except & all other alphanumeric are not accepted');
const locator = page.locator("//textarea[@id='oba_signup_address']");
await expect(locator).toBeFocused();
await page.close();
})
*/
test('Valid Address',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic Technologies', 'SweetMart', 'Balurghat');
//console.log('Valid address');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
})
//----------------------------- TEST CASES FOR COMPANY NAME ----------------------------------------------------------------------------------------------------------------------------------------------*/
test.describe('TC_Company Name',()=>{
test('Company name is empty',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', '', 'SweetMart', 'Balurghat');
//console.log('Company name is empty not acceptable');
const locator = page.locator("//input[@id='oba_signup_company_name']");
await expect(locator).toBeFocused();
await page.close();
})
test('Company name with numbers',async ({page})=>{
/* These are accepted so need to check with functinality
test.only('Company name with numbers',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic 12345', 'SweetMart', 'Balurghat');
//console.log('Company name with numbers is not acceptable');
const locator = page.locator("//input[@id='oba_signup_company_name']");
await expect(locator).toBeFocused();
await page.close();
})
test('Company name with 1000 Alphabets',async ({page})=>{
test.only('Company name with 1000 Alphabets',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'sarhjkfgbdsiugfjksdauygasjbiuadsgbjhsdbauifgadsjhbfuifgj', 'SweetMart', 'Balurghat');
// console.log('Company name with 1000 Alphabets is not acceptable');
const locator = page.locator("//input[@id='oba_signup_company_name']");
await expect(locator).toBeFocused();
await page.close();
})
test('Company name with special characters symbols',async ({page})=>{
test.only('Company name with special characters symbols',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic@1234', 'SweetMart', 'Balurghat');
// console.log('Company name with special characters symbols is not acceptable');
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram - panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'SweetMart', 'Balurghat');
// console.log('Company name with special characters '-' is acceptable');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
})
//------------------------------------- TEST CASES FOR BUSINESS MART -----------------------------------------------------------------------------*/
test.describe('TC_BusinessType',()=>{
test('SweetMart Selection',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'SweetMart', 'Balurghat');
// console.log('Sweetmart is selected');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
@ -322,7 +471,6 @@ test.describe('TC_BusinessType',()=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'FruitMart', 'Balurghat');
// console.log('Fruitmart is selected');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
@ -330,7 +478,6 @@ test.describe('TC_BusinessType',()=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'BisleriSupply', 'Balurghat');
// console.log('BisleriSupply is selected');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
@ -338,46 +485,60 @@ test.describe('TC_BusinessType',()=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#12345678A' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat');
// console.log('Others is selected');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
})
//------------------------------------- TEST CASES FOR Password -----------------------------------------------------------------------------*/
test.describe('TC_Password',()=>{
test('minimum 8 length password',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#123456' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat');
// console.log('minimum 8 length password is needed, it shows error');
const locator = page.locator("//input[@id='oba_signup_password']");
await expect(locator).toBeFocused();
await page.close();
await page.close();
})
test('Password with space',async ({page})=>{
/* //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');
// console.log('password with space, it shows error');
const locator = page.locator("//input[@id='oba_signup_password']");
await expect(locator).toBeFocused();
await page.close();
await page.close();
})
test('Password entered with 25 characters',async ({page})=>{
test.only('Password entered with 25 characters',async ({page})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','dsojarlgpojldm905432kjbnk' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat');
// console.log('password with only special character, it shows error');
const locator = page.locator("//input[@id='oba_signup_password']");
await expect(locator).toBeFocused();
await page.close();
await page.close();
})
test('Password with only special character',async ({page})=>{
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');
//console.log('password with only special character, it shows error');
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#ADgrdomi' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat');
// console.log('password with upper and lower case is accepted');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
@ -385,18 +546,54 @@ test.describe('TC_Password',()=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','1' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat');
// console.log('password is too short,it shows error');
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})=>{
const register = new RegisterPage(page);
await register.gotoRegisterPage();
await register.register('Micheal Rabi', 'rabisundaram@gmail.com','9600520046','Thalavaipuram panagudi ','#1234567A' ,'India(91)', 'Mobigic-Technology', 'Others', 'Balurghat');
// console.log('City is selected');
await expect(await page.locator("//button[normalize-space()='Sign UP']")).toBeVisible();
await page.close();
})
})
//------------------------------------- TEST CASE FOR ALREADY SIGNUP BUTTON ------------------------------------------------------------------------------------------------------------------------------------
test('Already sign up ', async ({page}) =>{
const register = new RegisterPage(page);
await register.alreadySignUpCheck();
const locator = page.locator("//input[@name='oba_login_emailid']");
await expect(locator).toBeFocused();
})
//------------------------------------ TEST CASE FOR COUNTRY CODE -------------------------------------------------------------------------------------------------------------------------------------------------------------------
test('India Country code',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();
})

Loading…
Cancel
Save