|
const {test, expect} =require('@playwright/test')
|
|
import { LoginPage } from '../pages/LoginPage';
|
|
import { AppConfig } from '../pages/AppConfig';
|
|
|
|
|
|
test('AppConfig button is working or not',async ({page})=>{
|
|
const login = new LoginPage(page);
|
|
await login.gotoLoginPage();
|
|
await login.loginWithCrtPassword();
|
|
await page.waitForTimeout(5000);
|
|
const config = new AppConfig(page);
|
|
await config.openAppConf();
|
|
await page.waitForTimeout(3000)
|
|
await expect(await page.locator(config.notificationSoundLoop)).toBeVisible();
|
|
})
|
|
|
|
|
|
test('complete AppConfig page to check API',async ({page,request})=>{
|
|
const login = new LoginPage(page);
|
|
await login.gotoLoginPage();
|
|
await login.loginWithCrtPassword();
|
|
await page.waitForTimeout(5000);
|
|
const config = new AppConfig(page);
|
|
await config.functionalityAppConfig('UAE dirham (د.إ;)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu');
|
|
|
|
await page.close();
|
|
|
|
const response = await request.get('https://dev.orderbookings.com/api/config/919480707707?merchantCode=919480707707')
|
|
console.log(await response.json())
|
|
const res = await response.json();
|
|
//const login = new LoginPage(page);
|
|
await login.gotoLoginPage();
|
|
await login.loginWithCrtPassword();
|
|
//await page.waitForTimeout(5000);
|
|
// const config = new AppConfig(page);
|
|
await config.openAppConf();
|
|
|
|
expect.soft(config.merchantCode).toContain(res.data.merchantCode);
|
|
|
|
const textBoxValue=await page.locator(config.calltoactionAPI).inputValue();
|
|
expect.soft(textBoxValue).toContain(res.data.call_to_action);
|
|
|
|
//const currencyValue=await page.locator(config.currencyAPI).inputValue();
|
|
// expect.soft(currencyValue).toContain(res.data.currency_code);
|
|
|
|
const notificationLoop = await page.locator(config.notificationSoundLoopAPI).inputValue();
|
|
expect.soft(notificationLoop).toContain((res.data.notification_sound_loop).toString());
|
|
|
|
const cancellationTillResponse = await page.locator(config.cancellationTillAPI).inputValue();
|
|
expect.soft(cancellationTillResponse).toContain((res.data.cancellation_till).toString());
|
|
|
|
const minimumCartPrizeResponse = await page.locator(config.minimumCartPrizeAPI).inputValue();
|
|
expect.soft( minimumCartPrizeResponse).toContain((res.data.minimum_cart_price).toString());
|
|
|
|
const deliveryChargeResponse = await page.locator(config.deliveryChargeAPI).inputValue();
|
|
expect.soft( deliveryChargeResponse).toContain((res.data.delivery_charge).toString());
|
|
|
|
expect.soft(config.areaSelection).toContain(res.data.area_type);
|
|
|
|
})
|
|
|
|
|
|
test('complete AppConfig page to check API',async ({page,request})=>{
|
|
const login = new LoginPage(page);
|
|
await login.gotoLoginPage();
|
|
await login.loginWithCrtPassword();
|
|
await page.waitForTimeout(5000);
|
|
const config = new AppConfig(page);
|
|
await config.functionalityAppConfig('Argentine peso ($)','7','5', '400', '35', '9565456737', 'City','Tamil Nadu');
|
|
// await page.close();
|
|
// await page.waitForTimeout(5000);
|
|
|
|
//await login.gotoLoginPage();
|
|
//await login.loginWithCrtPassword();
|
|
//await page.waitForTimeout(5000);
|
|
//await config.openAppConf();
|
|
//const text =page.locator(config.currency).allInnerTexts();
|
|
//console.log(text);
|
|
|
|
|
|
//expect.soft(config.currencyAPI).toContain("Argentine peso ($)");
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
test('AppConfig 3',async ({page})=>{
|
|
const login = new LoginPage(page);
|
|
await login.gotoLoginPage();
|
|
await login.loginWithCrtPassword();
|
|
await page.waitForTimeout(5000);
|
|
const config = new AppConfig(page);
|
|
// await config.toggleButton();
|
|
await config.areaSelectionTest('State');
|
|
await page.waitForTimeout(3000)
|
|
// await expect(await page.locator("//div[@class='card is_shop_open_card']//span[@class='flip-indecator']").isChecked()).toBeTruthy();
|
|
// await expect(await expect("//div[@class='card is_shop_open_card']//span[@class='flip-indecator']").toHaveText('ON'))
|
|
// await config.functionalityAppConfig('UAE dirham (د.إ;)', '400', '35', '9565456737', 'State', 'Tamil Nadu');
|
|
// await page.waitForTimeout(3000)
|
|
// await expect(page.getByLabel("ON")).toBeVisible();
|
|
|
|
})
|
|
|
|
test('APITesting for app config',async ({request,page})=>{
|
|
const response = await request.get('https://dev.orderbookings.com/api/config/919480707707?merchantCode=919480707707')
|
|
console.log(await response.json())
|
|
const res = await response.json();
|
|
const login = new LoginPage(page);
|
|
await login.gotoLoginPage();
|
|
await login.loginWithCrtPassword();
|
|
await page.waitForTimeout(5000);
|
|
const config = new AppConfig(page);
|
|
await config.openAppConf();
|
|
|
|
expect.soft(config.merchantCode).toContain(res.data.merchantCode);
|
|
|
|
const textBoxValue=await page.locator(config.calltoactionAPI).inputValue();
|
|
expect.soft(textBoxValue).toContain(res.data.call_to_action);
|
|
|
|
//const currencyValue=await page.locator(config.currencyAPI).inputValue();
|
|
// expect.soft(currencyValue).toContain(res.data.currency_code);
|
|
|
|
const notificationLoop = await page.locator(config.notificationSoundLoopAPI).inputValue();
|
|
expect.soft(notificationLoop).toContain((res.data.notification_sound_loop).toString());
|
|
|
|
const cancellationTillResponse = await page.locator(config.cancellationTillAPI).inputValue();
|
|
expect.soft(cancellationTillResponse).toContain((res.data.cancellation_till).toString());
|
|
|
|
const minimumCartPrizeResponse = await page.locator(config.minimumCartPrizeAPI).inputValue();
|
|
expect.soft( minimumCartPrizeResponse).toContain((res.data.minimum_cart_price).toString());
|
|
|
|
const deliveryChargeResponse = await page.locator(config.deliveryChargeAPI).inputValue();
|
|
expect.soft( deliveryChargeResponse).toContain((res.data.delivery_charge).toString());
|
|
|
|
expect.soft(config.areaTypeAPI).toContain(res.data.area_type);
|
|
|
|
|
|
|
|
|
|
|
|
// const toggleButton = await page.locator(config.onOffButton).isChecked();
|
|
// const isNowToggledOn = await toggleButton.getAttribute('OFF') === 'true';
|
|
// expect.soft(toggleButton).toContain(res.data.isShopOpen);
|
|
// expect(toggleButton).toBe(true)
|
|
|
|
|
|
//expect.soft(config.currencyAPI).toContain(res.data.currency_code);
|
|
// expect.soft(coupon.couponCodeGuest).toContain(res.data[0].campaign_code);
|
|
// expect.soft(coupon.forUsersGuest).toContain(res.data[0].for);
|
|
})
|
|
|
|
*/
|