/* eslint-disable linebreak-style */ /* eslint-disable max-len */ import { DewElement } from "../element"; import { ReadLocators } from "../../readLocators"; import { CommonKeyword } from '../commonKeyword'; const locators:any = ReadLocators.readJson(); /** * EProcCartIcon class */ export class EProcCartIcon { /** * To navigate to view details of items in Cart */ static async viewItemsInCart() { await CommonKeyword.clickElement(locators.eProcViewCartXpath); } /** * 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(locators.eProcCountOfItemsInCartXpath)) { const count = await DewElement.grabTextFrom(locators.eProcCountOfItemsInCartXpath); 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(locators.eProcAmountCartItemsXpath); return amountWithCurrency; } }