OBA Website automated using playwright
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

48 lines
2.2 KiB

const {test, expect} =require('@playwright/test')
import { LoginPage } from '../pages/LoginPage';
import { CouponPage } from '../pages/Couponpage';
test('Login test with correct credentials',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
await page.waitForTimeout(5000);
//const coupon = new CouponPage(page);
// await coupon.CalenderCheck();
})
test('APITesting_Coupon Get Details as User',async ({request,page})=>{
const response = await request.get('https://dev.orderbookings.com/api/available-coupon/670e14cf14f563f755f3e2a1/919480707707')
console.log(await response.json())
//expect(response.status()).toBe(200)
// const text = await response.text();
// expect(text).toContain('Manju')
const res = await response.json();
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
await page.waitForTimeout(5000);
const coupon = new CouponPage(page);
await coupon.viewCoupon();
expect.soft(coupon.shortDescription).toContain(res.data[2].name);
expect.soft(coupon.descriptionCheck).toContain(res.data[2].description);
expect.soft(coupon.internalCouponValue).toContain(res.data[2].code);
expect.soft(coupon.couponCode).toContain(res.data[2].campaign_code);
expect.soft(coupon.forUsers).toContain(res.data[2].for);
})
test('APITesting_Coupon Get Details as Guest',async ({request,page})=>{
const response = await request.get('https://dev.orderbookings.com/api/available-coupon-guest/919480707707')
console.log(await response.json())
const res = await response.json();
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.loginWithCrtPassword();
await page.waitForTimeout(5000);
const coupon = new CouponPage(page);
await coupon.viewCoupon();
expect.soft(coupon.shortDescriptionGuest).toContain(res.data[0].name);
expect.soft(coupon.descriptionCheckGuest).toContain(res.data[0].description);
expect.soft(coupon.internalCouponValueGuest).toContain(res.data[0].code);
expect.soft(coupon.couponCodeGuest).toContain(res.data[0].campaign_code);
expect.soft(coupon.forUsersGuest).toContain(res.data[0].for);
})