exports.OrderPage = class OrderPage { constructor(page) { this.page = page; this.ordersButton="//span[normalize-space()='Orders']"; this.ordersListButton="//a[normalize-space()='Order List']"; this.exportButton="//a[@class='treeview-item active']"; this.orderStatus="//select[@id='oba_edit_order_status_filter']"; this.usernameTextbox="//input[@id='oba_order_search']"; this.textBox="//input[@id='oba_order_search']"; this.filterButton="#oba_edit_order_filter"; this.orderName="//div[normalize-space()='Name : Shubya']"; this.orderEmail="//div[normalize-space()='Email : Shubya111@gmail.com']"; this.orderPhone="//div[normalize-space()='Phone : 919480111222']"; this.orderCost="//td[normalize-space()='200']"; this.orderQty="//tbody/tr[1]/td[6]"; this.orderAddressAPI="//div[normalize-space()='Address : 37, Thomas Mount, 627109']"; //orderidfor cancel this.orderIdCancel="//div[normalize-space()='order_id : 670e240e14f563f755f3e2a4']"; //Order list XPaths to crooss check this.orderdetails1 ="//table[@class='table table-sm']"; // order id,name,email,phone this.OrderStatuses ="//tbody//tr//td[3]"; //order status this.Ordercost ="//tbody//tr//td[2]"; //order cost this.OrderItems ="//tbody//tr//td[5]"; //order items this.OrderPrice ="//tbody//tr//td[7]"; //order price this.OrderPaymentStatus ="tbody tr td:nth-child(10)"; //order payment status this.orderlatestUpdate ="//tbody//tr//td[9]"; //order latest update this.Order_qty = "//tbody//tr//td[6]"; //order qty //OrderID Check xpath this.userid="//div[normalize-space()='order_id : 670e249314f563f755f3e2a5']"; this.username="//div[normalize-space()='Name : DAYA']"; this.useremail="//div[normalize-space()='Email : Daya1234@gmail.com']"; this.userphone="//div[normalize-space()='Phone : 919480111111']"; this.userorderitems="//td[normalize-space()='T-Shirt']"; this.ordercost="//td[normalize-space()='604']"; this.orderqty="//td[normalize-space()='3']"; this.userorderstatus="//strong[normalize-space()='ORDER_STATUS_PENDING']"; //Order Rate Api this.orderID="//div[normalize-space()='order_id : 67076b44272db54e96e423eb']"; this.orderRate="//tbody/tr[3]/td[8]"; } async clickOrdersButton(){ await this.page.locator(this.ordersButton).click(); } async clickOrdersListButton(){ await this.page.locator(this.ordersButton).click(); //await page.waitForTimeout(5000); await this.page.locator(this.ordersListButton).click(); } async orderStatusCheck(orderStatus){ await this.page.locator(this.ordersButton).click(); //await page.waitForTimeout(5000); await this.page.locator(this.ordersListButton).click(); await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); // await page.waitForTimeout(5000); } async checkFilterButton(orderStatus){ await this.page.locator(this.ordersButton).click(); //await page.waitForTimeout(5000); await this.page.locator(this.ordersListButton).click(); await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); // await page.waitForTimeout(5000); await this.page.locator(this.filterButton).click(); } async textBoxSearch(orderStatus, textBox){ await this.page.locator(this.ordersButton).click(); //await page.waitForTimeout(5000); await this.page.locator(this.ordersListButton).click(); await this.page.locator(this.orderStatus).selectOption({label:orderStatus}); // await page.waitForTimeout(5000); await this.page.locator(this.textBox).fill(textBox); await this.page.locator(this.filterButton).click(); } async searchOrder(orderStatus,username){ await this.page.locator(this.OrderStatus).selectOption(orderStatus); // add order status await this.page.locator(this.usernameTextbox).fill(username); // add user name await this.page.locator(this.filterButton).click(); //click filter button const OrderId = await this.page.locator(this.orderdetails1).textContent(); // get order id const OrderStatusis = await this.page.locator(this.OrderStatuses).textContent(); // get order status const Order_cost = await this.page.locator(this.Ordercost).textContent(); // get order cost const Order_items = await this.page.locator(this.OrderItems).textContent(); // get order items const Order_price =await this.page.locator(this.OrderPrice ).textContent(); // get order price const Order_payment =await this.page.locator(this.OrderPaymentStatus).textContent(); // get order payment status const Order_latestupdate =await this.page.locator(this.orderlatestUpdate).textContent(); //get oder latest update var Order_qty =await this.page.locator(this.Order_qty).textContent(); // get order quanity return {OrderId,OrderStatusis,Order_cost,Order_items,Order_price,Order_payment,Order_latestupdate,Order_qty} // returning all those values. } }