const {test, expect} =require('@playwright/test')
|
|
import { LoginPage } from '../pages/LoginPage';
|
|
import { AdddressListAPI } from '../pages/AddressListAPI';
|
|
import { OrderPage } from '../pages/OrderPage';
|
|
|
|
|
|
test('API Testing',async function ({ request, page }) {
|
|
const responsePost=await request.post('https://dev.orderbookings.com/api/user/addresslist?user_id=670e14cf14f563f755f3e2a1',{
|
|
data: {
|
|
"addressLine1": "25",
|
|
"addressLine2": "ParangiMalai",
|
|
"city": "Chennai",
|
|
"stateOrProvince": "TN",
|
|
"postalCode": "6000025",
|
|
"phone": "919480111111",
|
|
"deliveryInstructions": null,
|
|
"isDefault": false,
|
|
"user_id": "670e14cf14f563f755f3e2a1",
|
|
"title": "test address",
|
|
"area": "Chennai"
|
|
}
|
|
|
|
})
|
|
|
|
const res1 = await responsePost.json();
|
|
useraddressid= res1.data.id;
|
|
|
|
console.log(res1);
|
|
|
|
/*
|
|
const response = await request.get('https://dev.orderbookings.com/api/user/addresslist?user_id=670e14cf14f563f755f3e2a1');
|
|
console.log(await response.json());
|
|
const res = await response.json();
|
|
const login = new LoginPage(page);
|
|
await login.gotoLoginPage();
|
|
await login.loginWithCrtPassword();
|
|
await page.waitForTimeout(5000);
|
|
const order = new OrderPage(page);
|
|
await order.clickOrdersListButton();
|
|
// await address.openAppConf();
|
|
// await page.waitForTimeout(3000)
|
|
// await expect(await page.locator(config.notificationSoundLoop)).toBeVisible();
|
|
// expect.soft("//div[normalize-space()='Address : 37, Thomas Mount, 627109']").toContain(res.data[0].addressLine1);
|
|
//expect.soft("//div[normalize-space()='Address : 37, Thomas Mount, 627109']").toContain(res.data[0].addressLine2);
|
|
//expect.soft("//div[normalize-space()='Address : 37, Thomas Mount, 627109']").toContain((res.data[0].postalCode).toString());
|
|
//expect.soft("//div[normalize-space()='Phone : 919480111111']").toContain((res.data[0].phone).toString());
|
|
//expect.soft("//div[normalize-space()='order_id : 670e249314f563f755f3e2a5']").toContain(res.data[0].id);
|
|
//expect.soft("//div[normalize-space()='Phone : 919480111111']").toContain((res.data[0].phone).toString());
|
|
|
|
|
|
|
|
const responseDelete = await request.delete('https://dev.orderbookings.com/api/user/deleteaddress', {
|
|
data: {
|
|
"user_id": "670e14cf14f563f755f3e2a1",
|
|
"address_id": "670e249314f563f755f3e2a3"
|
|
}
|
|
})
|
|
console.log(await responseDelete.json());
|
|
|
|
|
|
await page.reload();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|