|
| 1 | +package screens; |
| 2 | + |
| 3 | +import io.appium.java_client.TouchAction; |
| 4 | +import io.appium.java_client.android.AndroidDriver; |
| 5 | +import io.appium.java_client.pagefactory.AppiumFieldDecorator; |
| 6 | +import io.appium.java_client.touch.offset.PointOption; |
| 7 | +import org.openqa.selenium.WebElement; |
| 8 | +import org.openqa.selenium.support.FindBy; |
| 9 | +import org.openqa.selenium.support.PageFactory; |
| 10 | + |
| 11 | +import java.util.List; |
| 12 | + |
| 13 | +public class CashboxScreen { |
| 14 | + public CashboxScreen(AndroidDriver driver) { |
| 15 | + PageFactory.initElements(new AppiumFieldDecorator(driver), this); |
| 16 | + } |
| 17 | + |
| 18 | + // Main Menus(Tabs) |
| 19 | + @FindBy(id = "com.progoti.tallykhata:id/item_cash") |
| 20 | + WebElement tabCashbox; |
| 21 | + |
| 22 | + //common input keyboard buttons |
| 23 | + @FindBy(id = "com.progoti.tallykhata:id/btnZero") |
| 24 | + WebElement btnZero; |
| 25 | + @FindBy(id = "com.progoti.tallykhata:id/btnOne") |
| 26 | + WebElement btnOne; |
| 27 | + @FindBy(id = "com.progoti.tallykhata:id/btnTwo") |
| 28 | + WebElement btnTwo; |
| 29 | + @FindBy(id = "com.progoti.tallykhata:id/btnThree") |
| 30 | + WebElement btnThree; |
| 31 | + @FindBy(id = "com.progoti.tallykhata:id/btnFour") |
| 32 | + WebElement btnFour; |
| 33 | + @FindBy(id = "com.progoti.tallykhata:id/btnFive") |
| 34 | + WebElement btnFive; |
| 35 | + @FindBy(id = "com.progoti.tallykhata:id/btnSix") |
| 36 | + WebElement btnSix; |
| 37 | + @FindBy(id = "com.progoti.tallykhata:id/btnSeven") |
| 38 | + WebElement btnSeven; |
| 39 | + @FindBy(id = "com.progoti.tallykhata:id/btnEight") |
| 40 | + WebElement btnEight; |
| 41 | + @FindBy(id = "com.progoti.tallykhata:id/btnNine") |
| 42 | + WebElement btnNine; |
| 43 | + @FindBy(id = "com.progoti.tallykhata:id/btnAdd") |
| 44 | + WebElement btnAdd; |
| 45 | + @FindBy(id = "com.progoti.tallykhata:id/btnSubtract") |
| 46 | + WebElement btnSubtract; |
| 47 | + @FindBy(id = "com.progoti.tallykhata:id/btnMultiply") |
| 48 | + WebElement btnMultiply; |
| 49 | + @FindBy(id = "com.progoti.tallykhata:id/btnDivide") |
| 50 | + WebElement btnDivide; |
| 51 | + @FindBy(id = "com.progoti.tallykhata:id/btnPercentage") |
| 52 | + WebElement btnPercentage; |
| 53 | + @FindBy(id = "com.progoti.tallykhata:id/btnEquals") |
| 54 | + WebElement btnEqual; |
| 55 | + @FindBy(id = "com.progoti.tallykhata:id/btnDot") |
| 56 | + WebElement btnDot; |
| 57 | + @FindBy(id = "com.progoti.tallykhata:id/btnAC") |
| 58 | + WebElement btnAC; |
| 59 | + @FindBy(id = "com.progoti.tallykhata:id/btnClear") |
| 60 | + WebElement btnClear; |
| 61 | + |
| 62 | + // Common |
| 63 | + @FindBy(id = "com.progoti.tallykhata:id/back_button") |
| 64 | + WebElement btnBack; |
| 65 | + @FindBy(id = "com.progoti.tallykhata:id/btnConfirmCashSale") |
| 66 | + WebElement btnPorobortiOrThikAcheOrNischit; |
| 67 | + @FindBy(id = "com.progoti.tallykhata:id/etSaleInput") |
| 68 | + WebElement inputDilamOrPelam; |
| 69 | + @FindBy(id = "com.progoti.tallykhata:id/etDescription") |
| 70 | + WebElement inputBiboron; |
| 71 | + @FindBy(id = "com.progoti.tallykhata:id/ivLayCamera") |
| 72 | + WebElement btnChobi; |
| 73 | + @FindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.FrameLayout/androidx.appcompat.widget.LinearLayoutCompat/android.widget.RelativeLayout/android.widget.ImageView[2]") |
| 74 | + WebElement btnClickChobi; |
| 75 | + @FindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.FrameLayout/androidx.appcompat.widget.LinearLayoutCompat[2]/androidx.appcompat.widget.LinearLayoutCompat/android.widget.ImageView[2]") |
| 76 | + WebElement btnConfirmChobi; |
| 77 | + @FindBy(id = "com.progoti.tallykhata:id/layoutCalender") |
| 78 | + WebElement btnCalender; |
| 79 | + @FindBy(xpath = "//android.view.View[@content-desc=\"25 January 2023\"]") |
| 80 | + WebElement btnCalenderDate; |
| 81 | + @FindBy(id = "android:id/button1") |
| 82 | + WebElement btnCalenderDateOk; |
| 83 | + @FindBy(id = "com.progoti.tallykhata:id/tvConfirmMessage") |
| 84 | + WebElement textConfirmMessage; |
| 85 | + @FindBy(id = "com.progoti.tallykhata:id/iv_details_report") |
| 86 | + WebElement btnReport; |
| 87 | + @FindBy(id = "com.progoti.tallykhata:id/tvTxnAmount") |
| 88 | + List<WebElement> textTransactionAmountInCommonReport; |
| 89 | + @FindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.LinearLayout[3]/android.widget.LinearLayout") |
| 90 | + WebElement textTotalTransactionAmountInCommonReport; |
| 91 | + |
| 92 | + // Cashbox Main page elements |
| 93 | + @FindBy(id = "com.progoti.tallykhata:id/tvTotalSale") |
| 94 | + public WebElement textAjkerBecha; |
| 95 | + @FindBy(id = "com.progoti.tallykhata:id/tvCurrentCashAmount") |
| 96 | + public WebElement textBortomanCash; |
| 97 | + @FindBy(id = "com.progoti.tallykhata:id/tvTotalPabo") |
| 98 | + public WebElement textAjPelam; |
| 99 | + @FindBy(id = "com.progoti.tallykhata:id/tvTotalDebo") |
| 100 | + public WebElement textAjDilam; |
| 101 | + @FindBy(id = "com.progoti.tallykhata:id/tvBakiAdaiAmount") |
| 102 | + WebElement textBakiAday; |
| 103 | + @FindBy(id = "com.progoti.tallykhata:id/tvSupplierPaymentAmount") |
| 104 | + WebElement textPaymentDeya; |
| 105 | + @FindBy(id = "com.progoti.tallykhata:id/iv_view") |
| 106 | + WebElement btnEye; |
| 107 | + @FindBy(id = "com.progoti.tallykhata:id/lay_tagada_message") |
| 108 | + WebElement btnCashboxMilai; |
| 109 | + @FindBy(id = "com.progoti.tallykhata:id/llCashBecha") |
| 110 | + WebElement objectCashBechaDetailsContainer; |
| 111 | + @FindBy(id = "com.progoti.tallykhata:id/tvCashBechaAmount") |
| 112 | + WebElement textCashBecha; |
| 113 | + @FindBy(id = "com.progoti.tallykhata:id/llCashKena") |
| 114 | + WebElement objectCashKenaDetailsContainer; |
| 115 | + @FindBy(id = "com.progoti.tallykhata:id/tvCashKenaAmount") |
| 116 | + WebElement textCashKena; |
| 117 | + @FindBy(id = "com.progoti.tallykhata:id/llKhoroch") |
| 118 | + WebElement objectKhorochDetailsContainer; |
| 119 | + @FindBy(id = "com.progoti.tallykhata:id/tvKhorochAmount") |
| 120 | + WebElement textKhoroch; |
| 121 | + @FindBy(id = "com.progoti.tallykhata:id/llMalikDilo") |
| 122 | + WebElement objectMalikDiloDetailsContainer; |
| 123 | + @FindBy(id = "com.progoti.tallykhata:id/tvMalikDiloAmount") |
| 124 | + WebElement textMalikDilo; |
| 125 | + @FindBy(id = "com.progoti.tallykhata:id/llMalikNilo") |
| 126 | + WebElement objectMalikNiloDetailsContainer; |
| 127 | + @FindBy(id = "com.progoti.tallykhata:id/tvMalikNiloAmount") |
| 128 | + WebElement textMalikNilo; |
| 129 | + |
| 130 | + // Cashbox Cash Hisab Page elements |
| 131 | + @FindBy(id = "com.progoti.tallykhata:id/tv_btn_cash_box") |
| 132 | + WebElement tabCashboxReportInCashHisab; |
| 133 | + @FindBy(id = "com.progoti.tallykhata:id/tv_btn_cash_report") |
| 134 | + public WebElement tabCashReportInCashHisab; |
| 135 | + @FindBy(id = "com.progoti.tallykhata:id/check_box_report_details") |
| 136 | + WebElement inputCheckboxBistaritoInCashHisab; |
| 137 | + @FindBy(id = "com.progoti.tallykhata:id/tv_starting_cash_amount") |
| 138 | + WebElement textDinerShuruteCashInCashHisab; |
| 139 | + @FindBy(id = "com.progoti.tallykhata:id/tv_cash_becha_amount") |
| 140 | + WebElement textCashBechaInCashHisab; |
| 141 | + @FindBy(id = "com.progoti.tallykhata:id/tv_baki_aday_amount") |
| 142 | + WebElement textBakiAdayInCashHisab; |
| 143 | + @FindBy(id = "com.progoti.tallykhata:id/tv_malik_dilo_amount") |
| 144 | + WebElement textMalikDiloInCashHisab; |
| 145 | + @FindBy(id = "com.progoti.tallykhata:id/tv_cash_kena_amount") |
| 146 | + WebElement textCashKenaInCashHisab; |
| 147 | + @FindBy(id = "com.progoti.tallykhata:id/tv_supplier_payment_amount") |
| 148 | + WebElement textPaymentDeyaInCashHisab; |
| 149 | + @FindBy(id = "com.progoti.tallykhata:id/tv_khoroch_amount") |
| 150 | + WebElement textKhorochInCashHisab; |
| 151 | + @FindBy(id = "com.progoti.tallykhata:id/tv_malik_nilo_amount") |
| 152 | + WebElement textMalikNiloInCashHisab; |
| 153 | + @FindBy(id = "com.progoti.tallykhata:id/tv_total_pelam_amount") |
| 154 | + public WebElement textMotPelamInCashHisab; |
| 155 | + @FindBy(id = "com.progoti.tallykhata:id/tv_total_dilam_amount") |
| 156 | + public WebElement textMotDilamInCashHisab; |
| 157 | + @FindBy(id = "com.progoti.tallykhata:id/tv_balance_amount") |
| 158 | + public WebElement textBalanceInCashHisab; |
| 159 | + @FindBy(id = "com.progoti.tallykhata:id/tv_cash_balance_pelam_amount") |
| 160 | + public WebElement textCashBalancePelamInCashHisab; |
| 161 | + @FindBy(id = "com.progoti.tallykhata:id/tv_cash_balance_dilam_amount") |
| 162 | + WebElement textCashBalanceDilamInCashHisab; |
| 163 | + @FindBy(id = "com.progoti.tallykhata:id/btn_cb_milai") |
| 164 | + WebElement btnCashboxMilaiInCashHisab; |
| 165 | + @FindBy(id = "com.progoti.tallykhata:id/tv_maliker_balance_amount") |
| 166 | + public WebElement textMalikerBalanceInCashHisab; |
| 167 | + |
| 168 | + // Cashbox Cashbox milai Page elements |
| 169 | + @FindBy(id = "com.progoti.tallykhata:id/etCashboxInput") |
| 170 | + WebElement inputCashboxeAche; |
| 171 | + @FindBy(id = "com.progoti.tallykhata:id/tv_current_cash_amount") |
| 172 | + WebElement textBortomanCashInCashboxMilai; |
| 173 | + @FindBy(id = "com.progoti.tallykhata:id/tv_cashbox_amount") |
| 174 | + WebElement textCashboxeAcheInCashboxMilai; |
| 175 | + @FindBy(id = "com.progoti.tallykhata:id/tv_adjusted_amount") |
| 176 | + WebElement textTakaGhattiOrBartiInCashboxMilai; |
| 177 | + @FindBy(id = "com.progoti.tallykhata:id/btn_different_cash_entry") |
| 178 | + WebElement btnOnnoCashEntryInCashboxMilai; |
| 179 | + |
| 180 | + public String cashBecha(AndroidDriver driver, String biboron) throws InterruptedException { |
| 181 | + tabCashbox.click(); |
| 182 | + Thread.sleep(2000); |
| 183 | + (new TouchAction(driver)).tap(PointOption.point(675, 165)).perform(); |
| 184 | + Thread.sleep(1000); |
| 185 | + objectCashBechaDetailsContainer.click(); |
| 186 | + btnThree.click(); |
| 187 | + btnThree.click(); |
| 188 | + inputBiboron.sendKeys(biboron); |
| 189 | + btnChobi.click(); |
| 190 | + btnClickChobi.click(); |
| 191 | + btnConfirmChobi.click(); |
| 192 | + btnCalender.click(); |
| 193 | + btnCalenderDateOk.click(); |
| 194 | + btnPorobortiOrThikAcheOrNischit.click(); |
| 195 | + return textConfirmMessage.getText(); |
| 196 | + } |
| 197 | + |
| 198 | + public String cashKena(String biboron) { |
| 199 | + tabCashbox.click(); |
| 200 | + objectCashKenaDetailsContainer.click(); |
| 201 | + btnNine.click(); |
| 202 | + inputBiboron.sendKeys(biboron); |
| 203 | + btnChobi.click(); |
| 204 | + btnClickChobi.click(); |
| 205 | + btnConfirmChobi.click(); |
| 206 | + btnPorobortiOrThikAcheOrNischit.click(); |
| 207 | + return textConfirmMessage.getText(); |
| 208 | + } |
| 209 | + |
| 210 | + public String khoroch(String biboron) { |
| 211 | + tabCashbox.click(); |
| 212 | + objectKhorochDetailsContainer.click(); |
| 213 | + btnSeven.click(); |
| 214 | + inputBiboron.sendKeys(biboron); |
| 215 | + btnCalender.click(); |
| 216 | + btnCalenderDateOk.click(); |
| 217 | + btnPorobortiOrThikAcheOrNischit.click(); |
| 218 | + return textConfirmMessage.getText(); |
| 219 | + } |
| 220 | + |
| 221 | + public String malikDilo(String biboron) { |
| 222 | + tabCashbox.click(); |
| 223 | + objectMalikDiloDetailsContainer.click(); |
| 224 | + btnNine.click(); |
| 225 | + inputBiboron.sendKeys(biboron); |
| 226 | + btnPorobortiOrThikAcheOrNischit.click(); |
| 227 | + return textConfirmMessage.getText(); |
| 228 | + } |
| 229 | + |
| 230 | + public String malikNilo() { |
| 231 | + tabCashbox.click(); |
| 232 | + objectMalikNiloDetailsContainer.click(); |
| 233 | + btnOne.click(); |
| 234 | + btnNine.click(); |
| 235 | + btnPorobortiOrThikAcheOrNischit.click(); |
| 236 | + return textConfirmMessage.getText(); |
| 237 | + } |
| 238 | + |
| 239 | + public String closeEyeButton() { |
| 240 | + btnEye.click(); |
| 241 | + return textAjkerBecha.getText(); |
| 242 | + } |
| 243 | + |
| 244 | + public String cashboxMilai() throws InterruptedException { |
| 245 | + btnCashboxMilai.click(); |
| 246 | + btnFour.click(); |
| 247 | + btnPorobortiOrThikAcheOrNischit.click(); |
| 248 | + String textGhatti = textTakaGhattiOrBartiInCashboxMilai.getText(); |
| 249 | + btnPorobortiOrThikAcheOrNischit.click(); |
| 250 | + btnEye.click(); |
| 251 | + return textGhatti; |
| 252 | + } |
| 253 | + |
| 254 | + public void cashboxReport() throws InterruptedException { |
| 255 | + btnReport.click(); |
| 256 | + Thread.sleep(1000); |
| 257 | + System.out.println("textMotDilamInCashHisab " + textMotDilamInCashHisab.getText()); |
| 258 | + System.out.println("textMotPelamInCashHisab " + textMotPelamInCashHisab.getText()); |
| 259 | + System.out.println("textBalanceInCashHisab " + textBalanceInCashHisab.getText()); |
| 260 | + } |
| 261 | + |
| 262 | + public void cashReport() throws InterruptedException { |
| 263 | + tabCashReportInCashHisab.click(); |
| 264 | + Thread.sleep(1000); |
| 265 | + System.out.println("textMotDilamInCashHisabCashReport " + textMotDilamInCashHisab.getText()); |
| 266 | + System.out.println("textMotPelamInCashHisabCashReport " + textMotPelamInCashHisab.getText()); |
| 267 | + System.out.println("textCashBalancePelamInCashHisabCashReport " + textCashBalancePelamInCashHisab.getText()); |
| 268 | + System.out.println("textMalikerBalanceInCashHisabCashReport " + textMalikerBalanceInCashHisab.getText()); |
| 269 | + } |
| 270 | +} |
0 commit comments