public void TestBasicSearchTxnByDocID(string tcName, IssuingTestCase tc) { RunIssuingTest(tc, out doc_ID); //SearchPage searchPage = S1.IssuingPage.NavigateToSearchPage(); S1.NavigateToSearchPage(); bool searched = S1.SearchPage.SearchTxnByDocID(doc_ID); if (searched) { string displayedDocID = S1.SearchPage.GetColumnValue(0, COLUMNS.DOC_ID); //(searchPage.S_SearchedResults[0].Doc_ID).Replace(" ", ""); Assert.AreEqual(doc_ID, displayedDocID); } else { Assert.Fail("Search Transaction by Doc ID is not performed"); } }
public void TestBasicVoid(string tcName, IssuingTestCase tc) { RunIssuingTest(tc, out doc_ID); //VoidPage voidPage = S1.IssuingPage.NavigateToVoidPage(); S1.NavigateToVoidPage(); if (!S1.VoidPage.searchPage.S_DocID.Visible) { S1.NavigateToVoidPage(); } bool searched = S1.VoidPage.SearchTxnByDocID(doc_ID); if (searched) { //voidPage.searchPage.S_SearchedResults.BodyIndex = 2; string displayedDocID = S1.VoidPage.searchPage.GetColumnValue(0, COLUMNS.DOC_ID); //(searchPage.S_SearchedResults[0].Doc_ID).Replace(" ", ""); Assert.AreEqual(doc_ID, displayedDocID); bool voidPerformed = S1.VoidPage.VoidTransaction(0); if (voidPerformed) { S1.NavigateToVoidPage(); if (!S1.VoidPage.searchPage.S_DocID.Visible) { S1.NavigateToVoidPage(); } if (!S1.VoidPage.VerifyTransactionState(doc_ID)) { Assert.Fail("After performing void operation; Transaction state is not displayed as Voided"); } } else { Assert.Fail("Unable to perform void operation"); } } else { Assert.Fail("Search Transaction by Doc ID to void transaction is not performed"); } }
public void TestBasicReissue(string tcName, IssuingTestCase tc) { //Dictionary<string, string> details = new Dictionary<string, string>(); string new_Doc_ID = null; RunIssuingTest(tc, out doc_ID); S1.NavigateToReIssuePage(); bool reIssued = S1.ReIssuePage.ReissueTrxn(doc_ID, out new_Doc_ID); if (reIssued) { S1.NavigateToReIssuePage(); try { Assert.AreEqual("Voided", S1.ReIssuePage.GetStateOfTrxn(doc_ID)); } catch (Exception e) { S1.NavigateToReIssuePage(); Assert.AreEqual("Voided", S1.ReIssuePage.GetStateOfTrxn(doc_ID)); } S1.NavigateToReIssuePage(); try { Assert.AreEqual("Issued", S1.ReIssuePage.GetStateOfTrxn(new_Doc_ID)); } catch (Exception e) { S1.NavigateToReIssuePage(); Assert.AreEqual("Issued", S1.ReIssuePage.GetStateOfTrxn(new_Doc_ID)); } } else { Assert.Fail("Not able to re issue the transaction"); } }
private void RunIssuingTest(IssuingTestCase tc, out string doc_ID, [CallerMemberName] string callerName = "") { LoginDetails login = tc.Login; TravellerDetails traveller = tc.Traveller; PurchaseDetails purchase = tc.Purchase; RefundDetails refund = tc.Refund; bool loggedIn = S1.Login(login.Username, login.Password); Assert.IsTrue(loggedIn); WebDriver.WaitForElement(S1.IssuingPage.AutofillSearchButton, 10); //System.Threading.Thread.Sleep(3000); if (traveller.Autofill != null && !string.IsNullOrEmpty(traveller.Autofill.Identifier)) { if (S1.IssuingPage.AddTokenButton.Visible) { S1.IssuingPage.AddTokenButton.Click(); WebDriver.SwitchTo().Frame("travellerIFrame"); SetValue(traveller.Autofill.Identifier, S1, s1 => s1.SGPIdentifier); S1.IssuingPage.SG_IDSaveButton.Click(); WebDriver.SwitchTo().DefaultContent(); } else { SetValue(traveller.Autofill.Identifier, S1, s1 => s1.Identifier); } if (traveller.Autofill.Identifier == traveller.Passport.Number) { WebDriver.TabAndReturnFocusedElement(); if (S1.IssuingPage.AutofillSearchButton.Visible) { S1.IssuingPage.AutofillSearchButton.Click(); } if (!string.IsNullOrEmpty(traveller.Passport.Country)) { SetValue(traveller.Passport.Country.ToUpper(), S1, s1 => s1.PassportAutofillCountry); } } bool autofill = S1.SearchAutofillTraveller(); System.Threading.Thread.Sleep(3000); if (!autofill) { Bitmap screenshot = WebDriver.TakeScreenshot(); SaveBitmap(WebDriver.TakeScreenshot(), "BasicIssuingwithAutofillTest_" + login.Username); throw new AssertionException("Basic Issuing with Autofill failed for user: "******"dd/MM/yyyy"); //if (item.Receipt.Date == "" || DateTime.Today.Date.Subtract(Convert.ToDateTime(Convert.ToDateTime(item.Receipt.Date) // .ToString("dd/MM/yyyy"))).Days > 60) //{ item.Receipt.Date = receiptDate; //} } catch (Exception) { } SetValue(item.Receipt.Date, currentRow, row => row.ReceiptDate); } SetValue(item.Description, currentRow, row => row.GoodsDescription); SetValue(item.Quantity, currentRow, row => row.Quantity); SetValue(item.Price, currentRow, row => row.Price); SetValue(item.PurchaseAmount, currentRow, row => row.PurchaseAmount); SetValue(item.GrossAmount, currentRow, row => row.GrossAmount); SetValue(item.Amount1, currentRow, row => row.Amount1); SetValue(item.Amount2, currentRow, row => row.Amount2); SetValue(item.Amount3, currentRow, row => row.Amount3); SetValue(item.Amount4, currentRow, row => row.Amount4); SetValue(item.Amount5, currentRow, row => row.Amount5); SetValue(item.Vat, currentRow, row => row.VAT); } SetValue(purchase.PurchaseDate, S1, s1 => s1.PurchaseDate); SetValue(purchase.MerchandiseDescription, S1, s1 => s1.MerchandiseDescription); SetValue(purchase.ShopInvoiceNumber, S1, s1 => s1.ShopInvoiceNumber); var result = S1.IssueTff(); string docid = result.DocID; doc_ID = docid; if (string.IsNullOrEmpty(docid) && !tc.ExpectError) { SaveBitmap(result.Bitmap, callerName + "_" + tc.Login.Username); throw new AssertionException("Issuing TFF failed with error: " + result.ToastMsg); } else if (string.IsNullOrEmpty(docid) && tc.ExpectError) { Assert.Pass("TFF was not issued (expected behavior), with error: " + result.ToastMsg); } else { //Assert.Pass("TFF was issued successfully. DocID: " + docid); S1.IssuingPage.CloseButton.Click(); } }
public void MultiItemIssuingTest(string tcName, IssuingTestCase tc) { RunIssuingTest(tc, out doc_ID); }
public void BasicIssuingTest(string username, string password, string identifier, string travellerID, string firstname, string lastname, string passport, string passportCountry, string email, string dateOfBirth, string gender, string address, string city, string zipCode, string residenceCountry, string receiptNum, string receiptDate, string goodsDescription, string quantity, string price, string purchaseAmount, string grossAmount, string amount1, string amount2, string amount3, string amount4, string amount5, string vat, string refundService, string refundMethod, string creditCardNum, string cardScheme, string expiryDate, string IBANNo, string BICNo, string bankName, string bankAddress, string bankAccountNo, string merchandiseDesc, string shopInvoiceNumber, string purchaseDate, string arrivalDate, string departureDate, string finalDestination, string tourGuideNumber, bool expectError) { if (creditCardNum != string.Empty) { Regex.Replace(creditCardNum, @"\s+", ""); } IssuingTestCase tc = new IssuingTestCase { ExpectError = expectError, Login = new LoginDetails { Username = username, Password = password }, Traveller = new TravellerDetails { Autofill = new AutofillDetails { Identifier = identifier, TravellerID = travellerID }, FirstName = firstname, LastName = lastname, Passport = new PassportDetails { Number = passport, Country = passportCountry }, Address = new AddressDetails { Street = address, City = city, ZipCode = zipCode, Country = residenceCountry }, Email = email, BirthDate = dateOfBirth, Gender = gender, Flight = new FlightDetails { ArrivalDate = arrivalDate, DepartureDate = departureDate, FinalDestination = finalDestination, TourGuideNumber = tourGuideNumber } }, Purchase = new PurchaseDetails { Items = new List <ItemDetails>(), MerchandiseDescription = merchandiseDesc, ShopInvoiceNumber = shopInvoiceNumber, PurchaseDate = purchaseDate }, Refund = new RefundDetails { Service = refundService, Method = refundMethod, CreditCard = new CreditCardDetails { CreditCardNumber = creditCardNum, CardScheme = cardScheme, ExpiryDate = expiryDate }, Bank = new BankDetails { IBAN = IBANNo, BIC = BICNo, Name = bankName, Address = bankAddress, AccountNumber = bankAccountNo, AccountName = firstname + " " + lastname } } }; tc.Purchase.Items.Add(new ItemDetails { Receipt = new ReceiptDetails { Number = receiptNum, Date = receiptDate }, Description = goodsDescription, Quantity = quantity, Price = price, PurchaseAmount = purchaseAmount, GrossAmount = grossAmount, Amount1 = amount1, Amount2 = amount2, Amount3 = amount3, Amount4 = amount4, Amount5 = amount5, Vat = vat, }); RunIssuingTest(tc, out doc_ID); }
public void TestBasicAmend(string tcName, IssuingTestCase tc) { string new_Doc_ID = null; RunIssuingTest(tc, out doc_ID); //IssuingTestCase amendedTC = (IssuingTestCase)tc.Clone(); S1.NavigateToAmendPage(); ModifyDetails.ModifyTravellerDetails(tc.Traveller); ModifyDetails.ModifyPurchaseDetails(tc.Purchase); S1.AmendPage.searchPage.SearchTxnByDocID(doc_ID); ((Label)S1.AmendPage.searchPage.GetAmendButton(0)).Click(); if (string.IsNullOrEmpty(S1.Firstname)) { System.Threading.Thread.Sleep(1000); } SetValue(tc.Traveller.FirstName, S1, s1 => s1.Firstname); SetValue(tc.Traveller.LastName, S1, s1 => s1.Lastname); bool Amended = S1.AmendPage.AmendTxn(out new_Doc_ID); if (Amended) { S1.NavigateToAmendPage(); try { Assert.AreEqual("Voided", S1.AmendPage.GetStateOfTrxn(doc_ID)); Assert.Pass("Working till here"); } catch (Exception e) { S1.NavigateToAmendPage(); Assert.AreEqual("Voided", S1.AmendPage.GetStateOfTrxn(doc_ID)); } S1.NavigateToAmendPage(); try { Assert.AreEqual("Issued", S1.AmendPage.GetStateOfTrxn(new_Doc_ID)); } catch (Exception e) { S1.NavigateToAmendPage(); Assert.AreEqual("Issued", S1.AmendPage.GetStateOfTrxn(new_Doc_ID)); } S1.NavigateToAmendPage(); S1.AmendPage.searchPage.SearchTxnByDocID(new_Doc_ID);//.GetStateOfTrxn(new_Doc_ID); ((Label)S1.AmendPage.searchPage.GetAmendButton(0)).Click(); S1.AmendPage.WebDriver.WaitForElement(S1.AmendPage.ModifyButton, 5); if (string.IsNullOrEmpty(S1.Firstname)) { System.Threading.Thread.Sleep(1000); } if (!ModifyDetails.verifyModifieldsDetials(S1.AmendPage, tc)) { Assert.Fail("Modified values are not displayed after Amend operation " + tc.Traveller.FirstName + " = " + S1.AmendPage.issuingPage.Firstname.Value + " : " + S1.AmendPage.issuingPage.Lastname.Value); } } else { Assert.Fail("Not able to Amend the transaction"); } }