/* eslint-disable linebreak-style */ /* eslint-disable max-len */ import { DewElement } from "../element"; import { CommonKeyword } from '../commonKeyword'; /** * EProcCartIcon class */ export class EProcCartIcon { /** * To navigate to view details of items in Cart */ static async viewItemsInCart() { await CommonKeyword.clickElement(`div`, `eproc-cart-spotlight`); } /** * To get count of items present in cart * @return {int} count - number of items present in cart */ static async getCountOfItemsInCart() { try { if (await DewElement.checkIfElementPresent(`.//eproc-cart-spotlight//span[contains(@class,'items-count')]`)) { const count = await DewElement.grabTextFrom(`.//eproc-cart-spotlight//span[contains(@class,'items-count')]`); return count; } } catch (err) { console.log(`No item in cart`); return err; } } /** * To get sum total of amount of items present in cart * @return {String} amountWithCurrency - sum of amount of items in cart */ static async getTotalAmountOfCartItems() { const amountWithCurrency = await DewElement.grabTextFrom(`.//eproc-cart-spotlight//div/div[2]`); return amountWithCurrency; } }